@blinkdotnew/cli 0.6.0 → 0.6.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.
package/dist/cli.js CHANGED
@@ -1,14 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
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
- });
12
4
  var __esm = (fn, res) => function __init() {
13
5
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
14
6
  };
@@ -16,15 +8,6 @@ var __export = (target, all) => {
16
8
  for (var name in all)
17
9
  __defProp(target, name, { get: all[name], enumerable: true });
18
10
  };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (let key of __getOwnPropNames(from))
22
- if (!__hasOwnProp.call(to, key) && key !== except)
23
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
- }
25
- return to;
26
- };
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
11
 
29
12
  // src/lib/project.ts
30
13
  var project_exports = {};
@@ -2076,9 +2059,9 @@ After linking, most commands work without specifying a project_id:
2076
2059
  clearProjectConfig();
2077
2060
  console.log("Unlinked.");
2078
2061
  });
2079
- program2.command("status").description("Show current agent, project, and auth context").action(() => {
2062
+ program2.command("status").description("Show current agent, project, and auth context").action(async () => {
2080
2063
  const config = readProjectConfig();
2081
- const { resolveAgentId: resolveAgentId3 } = (init_agent(), __toCommonJS(agent_exports));
2064
+ const { resolveAgentId: resolveAgentId3 } = await Promise.resolve().then(() => (init_agent(), agent_exports));
2082
2065
  const agentId = resolveAgentId3();
2083
2066
  const agentSource = process.env.BLINK_AGENT_ID ? "BLINK_AGENT_ID env" : process.env.BLINK_ACTIVE_AGENT ? "BLINK_ACTIVE_AGENT env" : null;
2084
2067
  if (agentId) {
@@ -2106,12 +2089,12 @@ After linking, most commands work without specifying a project_id:
2106
2089
  // src/commands/auth.ts
2107
2090
  import chalk10 from "chalk";
2108
2091
  import { createServer } from "http";
2092
+ import { randomBytes } from "crypto";
2109
2093
  var TIMEOUT_MS = 12e4;
2110
2094
  function getBaseUrl() {
2111
2095
  return process.env.BLINK_APP_URL || "https://blink.new";
2112
2096
  }
2113
2097
  function generateState() {
2114
- const { randomBytes } = __require("crypto");
2115
2098
  return randomBytes(24).toString("base64url");
2116
2099
  }
2117
2100
  function findFreePort() {
@@ -2168,7 +2151,11 @@ function startCallbackServer(port, expectedState) {
2168
2151
  resolveCb(result);
2169
2152
  });
2170
2153
  server.listen(port, "127.0.0.1");
2171
- return { promise, close: () => server.close() };
2154
+ server.unref();
2155
+ return { promise, close: () => {
2156
+ server.close();
2157
+ server.closeAllConnections?.();
2158
+ } };
2172
2159
  }
2173
2160
  async function openBrowserLogin(port, state) {
2174
2161
  const url = `${getBaseUrl()}/auth/cli?port=${port}&state=${state}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Blink CLI — full-stack cloud infrastructure from your terminal. Deploy, database, auth, storage, backend, domains, and more.",
5
5
  "bin": {
6
6
  "blink": "dist/cli.js"
@@ -4,6 +4,7 @@ import { writeConfig, clearConfig } from '../lib/config.js'
4
4
  import { printJson, isJsonMode } from '../lib/output.js'
5
5
  import chalk from 'chalk'
6
6
  import { createServer, type IncomingMessage, type ServerResponse } from 'node:http'
7
+ import { randomBytes } from 'node:crypto'
7
8
  import type { AddressInfo } from 'node:net'
8
9
 
9
10
  const TIMEOUT_MS = 120_000
@@ -20,7 +21,6 @@ function getBaseUrl(): string {
20
21
  }
21
22
 
22
23
  function generateState(): string {
23
- const { randomBytes } = require('node:crypto')
24
24
  return randomBytes(24).toString('base64url')
25
25
  }
26
26
 
@@ -83,7 +83,8 @@ function startCallbackServer(
83
83
  })
84
84
 
85
85
  server.listen(port, '127.0.0.1')
86
- return { promise, close: () => server.close() }
86
+ server.unref()
87
+ return { promise, close: () => { server.close(); server.closeAllConnections?.() } }
87
88
  }
88
89
 
89
90
  async function openBrowserLogin(port: number, state: string) {
@@ -131,9 +131,9 @@ After linking, most commands work without specifying a project_id:
131
131
 
132
132
  program.command('status')
133
133
  .description('Show current agent, project, and auth context')
134
- .action(() => {
134
+ .action(async () => {
135
135
  const config = readProjectConfig()
136
- const { resolveAgentId } = require('../lib/agent.js') as typeof import('../lib/agent.js')
136
+ const { resolveAgentId } = await import('../lib/agent.js')
137
137
 
138
138
  // Agent context
139
139
  const agentId = resolveAgentId()