@flash-tunnel/adapter-cloudflare 0.0.0 → 0.1.0

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.mjs +8 -2
  2. package/package.json +7 -3
package/dist/index.mjs CHANGED
@@ -282,6 +282,12 @@ function createCloudflareDns(options) {
282
282
 
283
283
  const ADAPTER_ID = "cloudflare";
284
284
  const QUICK_URL_PATTERN = /https:\/\/[a-z0-9-]+\.trycloudflare\.com/;
285
+ function shellCommand(path) {
286
+ if (process.platform === "win32" && /\s/.test(path) && !path.startsWith('"')) {
287
+ return `"${path}"`;
288
+ }
289
+ return path;
290
+ }
285
291
  function createCloudflareTunnel(options = {}) {
286
292
  const cloudflaredPath = options.cloudflaredPath ?? "cloudflared";
287
293
  const api = options.apiToken ? new CloudflareApi({
@@ -313,7 +319,7 @@ function createCloudflareTunnel(options = {}) {
313
319
  return api;
314
320
  }
315
321
  function ensureCloudflared() {
316
- const check = spawnSync(cloudflaredPath, ["--version"], {
322
+ const check = spawnSync(shellCommand(cloudflaredPath), ["--version"], {
317
323
  encoding: "utf8",
318
324
  shell: process.platform === "win32",
319
325
  timeout: 1e4,
@@ -461,7 +467,7 @@ function createCloudflareTunnel(options = {}) {
461
467
  });
462
468
  }
463
469
  const args = named ? ["--no-autoupdate", "tunnel", "run"] : ["--no-autoupdate", "tunnel", "--url", localUrl];
464
- const child = spawn(cloudflaredPath, args, {
470
+ const child = spawn(shellCommand(cloudflaredPath), args, {
465
471
  shell: process.platform === "win32",
466
472
  stdio: ["ignore", "pipe", "pipe"],
467
473
  windowsHide: true,
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@flash-tunnel/adapter-cloudflare",
3
3
  "type": "module",
4
- "version": "0.0.0",
4
+ "version": "0.1.0",
5
5
  "license": "MIT",
6
+ "homepage": "https://github.com/flash-tunnel/flash-tunnel#readme",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "git+https://github.com/flash-tunnel/flash-tunnel.git"
9
10
  },
11
+ "bugs": {
12
+ "url": "https://github.com/flash-tunnel/flash-tunnel/issues"
13
+ },
10
14
  "exports": {
11
15
  ".": {
12
16
  "types": "./dist/index.d.mts",
@@ -26,8 +30,8 @@
26
30
  "access": "public"
27
31
  },
28
32
  "dependencies": {
29
- "@flash-tunnel/types": "0.0.0",
30
- "@flash-tunnel/utils": "0.0.0"
33
+ "@flash-tunnel/types": "0.1.0",
34
+ "@flash-tunnel/utils": "0.1.0"
31
35
  },
32
36
  "scripts": {
33
37
  "stub": "unbuild --stub",