@rubriclab/bunl 0.0.21 → 0.0.22
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/build/client.js +56 -0
- package/client.ts +12 -0
- package/package.json +1 -1
package/build/client.js
CHANGED
|
@@ -434,6 +434,53 @@ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
|
434
434
|
defineLazyProperty(apps, "browser", () => "browser");
|
|
435
435
|
defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
436
436
|
var open_default = open;
|
|
437
|
+
// package.json
|
|
438
|
+
var package_default = {
|
|
439
|
+
bin: {
|
|
440
|
+
bunl: "build/client.js"
|
|
441
|
+
},
|
|
442
|
+
name: "@rubriclab/bunl",
|
|
443
|
+
description: "Expose localhost to the world",
|
|
444
|
+
version: "0.0.22",
|
|
445
|
+
license: "MIT",
|
|
446
|
+
repository: {
|
|
447
|
+
type: "git",
|
|
448
|
+
url: "git+https://github.com/RubricLab/bunl.git"
|
|
449
|
+
},
|
|
450
|
+
dependencies: {
|
|
451
|
+
"human-id": "^4.1.1",
|
|
452
|
+
open: "^10.1.0"
|
|
453
|
+
},
|
|
454
|
+
devDependencies: {
|
|
455
|
+
"@types/bun": "latest"
|
|
456
|
+
},
|
|
457
|
+
main: "build/client.js",
|
|
458
|
+
scripts: {
|
|
459
|
+
server: "bun server.ts",
|
|
460
|
+
"dev:server": "bun --hot server.ts",
|
|
461
|
+
client: "bun --hot client.ts",
|
|
462
|
+
demo: "bun --hot demo.ts",
|
|
463
|
+
"client:upgrade": "bun rm -g @rubriclab/bunl && bun i -g @rubriclab/bunl@latest",
|
|
464
|
+
build: "BUILD=build/client.js && bun build client.ts --outdir build --target bun && echo -e \"#! /usr/bin/env bun
|
|
465
|
+
$(cat $BUILD)\" > $BUILD",
|
|
466
|
+
"npm:publish": "bun run build && npm publish"
|
|
467
|
+
},
|
|
468
|
+
type: "module",
|
|
469
|
+
peerDependencies: {
|
|
470
|
+
typescript: "^5.0.0"
|
|
471
|
+
},
|
|
472
|
+
publishConfig: {
|
|
473
|
+
"@RubricLab:registry": "https://registry.npmjs.org",
|
|
474
|
+
access: "public",
|
|
475
|
+
registry: "https://registry.npmjs.org"
|
|
476
|
+
},
|
|
477
|
+
homepage: "https://github.com/RubricLab/bunl#readme",
|
|
478
|
+
keywords: [
|
|
479
|
+
"local",
|
|
480
|
+
"tunnel",
|
|
481
|
+
"rubric"
|
|
482
|
+
]
|
|
483
|
+
};
|
|
437
484
|
|
|
438
485
|
// client.ts
|
|
439
486
|
async function main({
|
|
@@ -457,6 +504,7 @@ async function main({
|
|
|
457
504
|
if (open2)
|
|
458
505
|
open_default(data.url);
|
|
459
506
|
}
|
|
507
|
+
console.log(data.pathname);
|
|
460
508
|
if (data.method) {
|
|
461
509
|
const res = await fetch(`${url}${data.pathname || ""}`, {
|
|
462
510
|
method: data.method,
|
|
@@ -504,10 +552,18 @@ var { values } = parseArgs({
|
|
|
504
552
|
open: {
|
|
505
553
|
type: "boolean",
|
|
506
554
|
short: "o"
|
|
555
|
+
},
|
|
556
|
+
version: {
|
|
557
|
+
type: "boolean",
|
|
558
|
+
short: "v"
|
|
507
559
|
}
|
|
508
560
|
},
|
|
509
561
|
allowPositionals: true
|
|
510
562
|
});
|
|
563
|
+
if (values.version) {
|
|
564
|
+
console.log(package_default.version);
|
|
565
|
+
process.exit();
|
|
566
|
+
}
|
|
511
567
|
if (!values.port)
|
|
512
568
|
throw "pass -p 3000";
|
|
513
569
|
var { port, domain, subdomain, open: open2 } = values;
|
package/client.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parseArgs } from "util";
|
|
2
2
|
import browser from "open";
|
|
3
|
+
import app from "./package.json";
|
|
3
4
|
|
|
4
5
|
async function main({
|
|
5
6
|
url,
|
|
@@ -27,6 +28,8 @@ async function main({
|
|
|
27
28
|
if (open) browser(data.url);
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
console.log(data.pathname);
|
|
32
|
+
|
|
30
33
|
if (data.method) {
|
|
31
34
|
const res = await fetch(`${url}${data.pathname || ""}`, {
|
|
32
35
|
method: data.method,
|
|
@@ -85,10 +88,19 @@ const { values } = parseArgs({
|
|
|
85
88
|
type: "boolean",
|
|
86
89
|
short: "o",
|
|
87
90
|
},
|
|
91
|
+
version: {
|
|
92
|
+
type: "boolean",
|
|
93
|
+
short: "v",
|
|
94
|
+
},
|
|
88
95
|
},
|
|
89
96
|
allowPositionals: true,
|
|
90
97
|
});
|
|
91
98
|
|
|
99
|
+
if (values.version) {
|
|
100
|
+
console.log(app.version);
|
|
101
|
+
process.exit();
|
|
102
|
+
}
|
|
103
|
+
|
|
92
104
|
if (!values.port) throw "pass -p 3000";
|
|
93
105
|
|
|
94
106
|
const { port, domain, subdomain, open } = values;
|