@sharpe-jupyter/connect 0.3.0 → 0.3.2

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 (2) hide show
  1. package/dist/index.js +14 -23
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -78,15 +78,23 @@ async function ensureCloudflared() {
78
78
  // src/ripgrep.ts
79
79
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, chmodSync as chmodSync2, unlinkSync as unlinkSync2, createWriteStream as createWriteStream2 } from "fs";
80
80
  import { join as join2 } from "path";
81
- import { homedir as homedir2, arch as arch2 } from "os";
81
+ import { homedir as homedir2, arch as arch2, platform as platform2 } from "os";
82
82
  import { pipeline as pipeline2 } from "stream/promises";
83
83
  import { Readable as Readable2 } from "stream";
84
84
  import { execSync as execSync2 } from "child_process";
85
85
  var RIPGREP_VERSION = "15.1.0";
86
86
  function getAssetName() {
87
+ const os = platform2();
87
88
  const cpu = arch2();
88
- const triple = cpu === "arm64" ? "aarch64-apple-darwin" : "x86_64-apple-darwin";
89
- return `ripgrep-${RIPGREP_VERSION}-${triple}.tar.gz`;
89
+ if (os === "darwin") {
90
+ const triple = cpu === "arm64" ? "aarch64-apple-darwin" : "x86_64-apple-darwin";
91
+ return `ripgrep-${RIPGREP_VERSION}-${triple}.tar.gz`;
92
+ }
93
+ if (os === "linux") {
94
+ const triple = cpu === "arm64" ? "aarch64-unknown-linux-gnu" : "x86_64-unknown-linux-musl";
95
+ return `ripgrep-${RIPGREP_VERSION}-${triple}.tar.gz`;
96
+ }
97
+ throw new Error(`Unsupported platform: ${os}/${cpu}`);
90
98
  }
91
99
  function getBinDir2() {
92
100
  return join2(homedir2(), ".sharpe", "bin");
@@ -138,11 +146,11 @@ async function checkJupyterHealth(port2) {
138
146
  import { execSync as execSync3, spawn } from "child_process";
139
147
  import { existsSync as existsSync3 } from "fs";
140
148
  import { join as join3 } from "path";
141
- import { homedir as homedir3, platform as platform2 } from "os";
149
+ import { homedir as homedir3, platform as platform3 } from "os";
142
150
  var SHARPE_DIR = join3(homedir3(), ".sharpe");
143
151
  var VENV_DIR = join3(SHARPE_DIR, "venv");
144
152
  var SHARPE_BIN_DIR = join3(SHARPE_DIR, "bin");
145
- var IS_WIN = platform2() === "win32";
153
+ var IS_WIN = platform3() === "win32";
146
154
  var BIN_DIR = IS_WIN ? "Scripts" : "bin";
147
155
  function venvBin(name) {
148
156
  return join3(VENV_DIR, BIN_DIR, IS_WIN ? `${name}.exe` : name);
@@ -180,8 +188,7 @@ function startJupyter(port2) {
180
188
  "--ServerApp.token=",
181
189
  "--ServerApp.password=",
182
190
  "--ServerApp.allow_remote_access=True",
183
- "--ServerApp.disable_check_xsrf=True",
184
- '--ServerApp.jpserver_extensions={"sharpe_log_handler.handler": true}'
191
+ "--ServerApp.disable_check_xsrf=True"
185
192
  ],
186
193
  { stdio: ["ignore", "pipe", "pipe"], env }
187
194
  );
@@ -581,22 +588,6 @@ Close whatever is using it and try again, or use a different port:
581
588
  }
582
589
  });
583
590
  }
584
- let wasDisconnected = false;
585
- const monitorTunnel = (data) => {
586
- const text = data.toString();
587
- if (/Retrying|connection.*failed|ERR/i.test(text) && !wasDisconnected) {
588
- wasDisconnected = true;
589
- setTunnelConnected(false);
590
- pushEvent("Connection interrupted, reconnecting...");
591
- }
592
- if (text.includes("Registered tunnel connection") && wasDisconnected) {
593
- wasDisconnected = false;
594
- setTunnelConnected(true);
595
- pushEvent("Reconnected to Sharpe");
596
- }
597
- };
598
- tunnelChild.stderr?.on("data", monitorTunnel);
599
- tunnelChild.stdout?.on("data", monitorTunnel);
600
591
  tunnelChild.on("exit", () => {
601
592
  if (!cleanedUp.current) {
602
593
  setTunnelConnected(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharpe-jupyter/connect",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Connect a local JupyterHub to Sharpe via Cloudflare Tunnel",
5
5
  "type": "module",
6
6
  "bin": {