@blinkdotnew/cli 0.5.0 → 0.5.1
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/dist/cli.js +10 -2
- package/package.json +1 -1
- package/src/commands/auth.ts +4 -2
package/dist/cli.js
CHANGED
|
@@ -3,6 +3,12 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
7
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
8
|
+
}) : x)(function(x) {
|
|
9
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
10
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
11
|
+
});
|
|
6
12
|
var __esm = (fn, res) => function __init() {
|
|
7
13
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
14
|
};
|
|
@@ -2080,7 +2086,8 @@ function getBaseUrl() {
|
|
|
2080
2086
|
return process.env.BLINK_APP_URL || "https://blink.new";
|
|
2081
2087
|
}
|
|
2082
2088
|
function generateState() {
|
|
2083
|
-
|
|
2089
|
+
const { randomBytes } = __require("crypto");
|
|
2090
|
+
return randomBytes(24).toString("base64url");
|
|
2084
2091
|
}
|
|
2085
2092
|
function findFreePort() {
|
|
2086
2093
|
return new Promise((resolve, reject) => {
|
|
@@ -2143,7 +2150,8 @@ async function openBrowserLogin(port, state) {
|
|
|
2143
2150
|
const open = await import("open").then((m) => m.default).catch(() => null);
|
|
2144
2151
|
if (open) await open(url).catch(() => {
|
|
2145
2152
|
});
|
|
2146
|
-
console.log(chalk10.
|
|
2153
|
+
else console.log(chalk10.yellow(" Browser did not open automatically."));
|
|
2154
|
+
console.log(chalk10.dim(` If needed, visit: ${url}
|
|
2147
2155
|
`));
|
|
2148
2156
|
}
|
|
2149
2157
|
async function waitForCallback(promise) {
|
package/package.json
CHANGED
package/src/commands/auth.ts
CHANGED
|
@@ -20,7 +20,8 @@ function getBaseUrl(): string {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function generateState(): string {
|
|
23
|
-
|
|
23
|
+
const { randomBytes } = require('node:crypto')
|
|
24
|
+
return randomBytes(24).toString('base64url')
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
function findFreePort(): Promise<number> {
|
|
@@ -89,7 +90,8 @@ async function openBrowserLogin(port: number, state: string) {
|
|
|
89
90
|
const url = `${getBaseUrl()}/auth/cli?port=${port}&state=${state}`
|
|
90
91
|
const open = await import('open').then(m => m.default).catch(() => null)
|
|
91
92
|
if (open) await open(url).catch(() => {})
|
|
92
|
-
console.log(chalk.
|
|
93
|
+
else console.log(chalk.yellow(' Browser did not open automatically.'))
|
|
94
|
+
console.log(chalk.dim(` If needed, visit: ${url}\n`))
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
async function waitForCallback(
|