pinokiod 7.5.7 → 7.5.8

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.
@@ -1,6 +1,7 @@
1
1
  const path = require('path')
2
2
  const fs = require('fs')
3
3
  const os = require('os')
4
+ const CondaRuntimeGuard = require('../../shell_conda_runtime_guard')
4
5
  class Shell {
5
6
  async applyBluefairyDefault(req = {}, kernel) {
6
7
  if (!req.params) {
@@ -179,9 +180,13 @@ class Shell {
179
180
  req.params.rows = req.client.rows
180
181
  req.params.cols = req.client.cols
181
182
  }
182
- let response = await kernel.shell.run(req.params, options, async (stream) => {
183
+ Object.defineProperty(req.params, CondaRuntimeGuard.SHELL_RUN_GUARD, {
184
+ configurable: true,
185
+ value: true,
186
+ })
187
+ let response = await kernel.shell.run(req.params, options, async (stream, type) => {
183
188
  // process.stdout.write(stream.raw)
184
- ondata(stream)
189
+ ondata(stream, type)
185
190
  })
186
191
  return response
187
192
  }
@@ -2,12 +2,18 @@ const fs = require('fs')
2
2
  const fetch = require('cross-fetch')
3
3
  const { rimraf } = require('rimraf')
4
4
  const decompress = require('decompress');
5
- const NODE_VERSION = "22.21.1"
5
+ const NODE_VERSION = "24.18.0"
6
+ const PNPM_VERSION = "11.9.0"
7
+
8
+ const normalizeVersion = (version) => {
9
+ const match = String(version || "").match(/^\d+\.\d+\.\d+/)
10
+ return match ? match[0] : null
11
+ }
6
12
 
7
13
  class Node {
8
14
  description = "Installs Node.js and pnpm in the Pinokio environment."
9
15
  cmd() {
10
- return `nodejs=${NODE_VERSION} pnpm`
16
+ return `nodejs=${NODE_VERSION} pnpm=${PNPM_VERSION}`
11
17
  }
12
18
  async install(req, ondata) {
13
19
  await this.kernel.bin.exec({
@@ -18,13 +24,12 @@ class Node {
18
24
  }, ondata)
19
25
  }
20
26
  async installed() {
21
- if (this.kernel.bin.installed.conda && this.kernel.bin.installed.conda_versions) {
22
- let version = this.kernel.bin.installed.conda_versions.nodejs
23
- if (version !== NODE_VERSION) {
24
- return false
25
- }
27
+ if (!this.kernel.bin.installed.conda.has("nodejs") || !this.kernel.bin.installed.conda.has("pnpm")) {
28
+ return false
26
29
  }
27
- return this.kernel.bin.installed.conda.has("nodejs") && this.kernel.bin.installed.conda.has("pnpm")
30
+
31
+ const versions = this.kernel.bin.installed.conda_versions || {}
32
+ return normalizeVersion(versions.nodejs) === NODE_VERSION && normalizeVersion(versions.pnpm) === PNPM_VERSION
28
33
  }
29
34
  env() {
30
35
  return {
package/kernel/shell.js CHANGED
@@ -22,6 +22,7 @@ const AnsiStreamTracker = require('./ansi_stream_tracker')
22
22
  const ShellStateSync = require('./shell_state_sync')
23
23
  const ShellRunTemplate = require('./api/shell_run_template')
24
24
  const { PYTHON_INSTALL_SPEC } = require('./bin/conda-pins')
25
+ const CondaRuntimeGuard = require('./shell_conda_runtime_guard')
25
26
  const home = os.homedir()
26
27
 
27
28
  function normalizeComparablePath(filePath, platform) {
@@ -1349,6 +1350,25 @@ class Shell {
1349
1350
  venv_activation = []
1350
1351
  }
1351
1352
 
1353
+ const managedBasePrefix = this.kernel.bin && typeof this.kernel.bin.path === "function"
1354
+ ? this.kernel.bin.path("miniforge")
1355
+ : this.kernel.path("bin/miniforge")
1356
+ const flowSessionKey = [this.id, this.start_time].filter(Boolean).join(':')
1357
+ if (params[CondaRuntimeGuard.SHELL_RUN_GUARD]) {
1358
+ CondaRuntimeGuard.applyCondaRuntimeGuard(params, {
1359
+ cwd: params.path,
1360
+ managedBasePrefix,
1361
+ ondata: (stream, type) => {
1362
+ if (this.ondata) {
1363
+ this.ondata(stream, type)
1364
+ }
1365
+ },
1366
+ platform: this.platform,
1367
+ sessionKey: flowSessionKey || this.group || (params.$parent && (params.$parent.id || params.$parent.path)) || params.id || params.path,
1368
+ shellName: this.shell,
1369
+ })
1370
+ }
1371
+
1352
1372
  // 3. construct params.message
1353
1373
  let activation = conda_activation.concat(venv_activation)
1354
1374
  if (this.kernel.bin && typeof this.kernel.bin.activationCommands === "function") {