shadcn-studio-extension-cli 0.1.2 → 0.1.4

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.
@@ -1,6 +1,6 @@
1
1
  # Third-Party Licenses
2
2
 
3
- ## shadcn-studio-extension-cli@0.1.1
3
+ ## shadcn-studio-extension-cli@0.1.3
4
4
  - License: AGPL-3.0-only
5
5
  - Repository: https://github.com/stagewise-io/stagewise
6
6
  - Publisher: stagewise GmbH
@@ -11089,7 +11089,7 @@
11089
11089
  "format": "esm"
11090
11090
  },
11091
11091
  "src/server/proxy.ts": {
11092
- "bytes": 1963,
11092
+ "bytes": 2335,
11093
11093
  "imports": [
11094
11094
  {
11095
11095
  "path": "../../node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/index.js",
@@ -11102,14 +11102,14 @@
11102
11102
  "original": "../config"
11103
11103
  },
11104
11104
  {
11105
- "path": "src/server/error-page.ts",
11105
+ "path": "src/utils/logger.ts",
11106
11106
  "kind": "import-statement",
11107
- "original": "./error-page"
11107
+ "original": "../utils/logger"
11108
11108
  },
11109
11109
  {
11110
- "path": "src/utils/logger.ts",
11110
+ "path": "src/server/error-page.ts",
11111
11111
  "kind": "import-statement",
11112
- "original": "../utils/logger"
11112
+ "original": "./error-page"
11113
11113
  },
11114
11114
  {
11115
11115
  "path": "src/server/proxy-utils/headers-rewrites.ts",
@@ -11125,7 +11125,7 @@
11125
11125
  "format": "esm"
11126
11126
  },
11127
11127
  "src/server/index.ts": {
11128
- "bytes": 9985,
11128
+ "bytes": 9992,
11129
11129
  "imports": [
11130
11130
  {
11131
11131
  "path": "../../node_modules/.pnpm/express@4.21.2/node_modules/express/index.js",
@@ -11191,7 +11191,7 @@
11191
11191
  "format": "esm"
11192
11192
  },
11193
11193
  "src/utils/banner.ts": {
11194
- "bytes": 2354,
11194
+ "bytes": 2609,
11195
11195
  "imports": [
11196
11196
  {
11197
11197
  "path": "../../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js",
@@ -11247,8 +11247,24 @@
11247
11247
  ],
11248
11248
  "format": "esm"
11249
11249
  },
11250
+ "src/utils/check-port.ts": {
11251
+ "bytes": 809,
11252
+ "imports": [
11253
+ {
11254
+ "path": "node:net",
11255
+ "kind": "import-statement",
11256
+ "external": true
11257
+ },
11258
+ {
11259
+ "path": "<runtime>",
11260
+ "kind": "import-statement",
11261
+ "external": true
11262
+ }
11263
+ ],
11264
+ "format": "esm"
11265
+ },
11250
11266
  "src/index.ts": {
11251
- "bytes": 10221,
11267
+ "bytes": 10820,
11252
11268
  "imports": [
11253
11269
  {
11254
11270
  "path": "../../node_modules/.pnpm/open@10.1.2/node_modules/open/index.js",
@@ -11315,6 +11331,11 @@
11315
11331
  "kind": "import-statement",
11316
11332
  "original": "./utils/telemetry"
11317
11333
  },
11334
+ {
11335
+ "path": "src/utils/check-port.ts",
11336
+ "kind": "dynamic-import",
11337
+ "original": "./utils/check-port.js"
11338
+ },
11318
11339
  {
11319
11340
  "path": "<runtime>",
11320
11341
  "kind": "import-statement",
@@ -11329,7 +11350,7 @@
11329
11350
  "imports": [],
11330
11351
  "exports": [],
11331
11352
  "inputs": {},
11332
- "bytes": 6268144
11353
+ "bytes": 6271207
11333
11354
  },
11334
11355
  "dist/index.cjs": {
11335
11356
  "imports": [
@@ -12178,6 +12199,11 @@
12178
12199
  "kind": "require-call",
12179
12200
  "external": true
12180
12201
  },
12202
+ {
12203
+ "path": "node:net",
12204
+ "kind": "require-call",
12205
+ "external": true
12206
+ },
12181
12207
  {
12182
12208
  "path": "node:process",
12183
12209
  "kind": "require-call",
@@ -13719,6 +13745,9 @@
13719
13745
  "../../node_modules/.pnpm/http-proxy-middleware@3.0.5/node_modules/http-proxy-middleware/dist/index.js": {
13720
13746
  "bytesInOutput": 1233
13721
13747
  },
13748
+ "src/utils/check-port.ts": {
13749
+ "bytesInOutput": 745
13750
+ },
13722
13751
  "../../node_modules/.pnpm/open@10.1.2/node_modules/open/index.js": {
13723
13752
  "bytesInOutput": 9631
13724
13753
  },
@@ -14092,7 +14121,7 @@
14092
14121
  "bytesInOutput": 3554
14093
14122
  },
14094
14123
  "src/server/index.ts": {
14095
- "bytesInOutput": 8390
14124
+ "bytesInOutput": 8397
14096
14125
  },
14097
14126
  "src/utils/print-info-messages.ts": {
14098
14127
  "bytesInOutput": 1917
@@ -14119,7 +14148,7 @@
14119
14148
  "bytesInOutput": 6791
14120
14149
  },
14121
14150
  "src/server/proxy.ts": {
14122
- "bytesInOutput": 1659
14151
+ "bytesInOutput": 1959
14123
14152
  },
14124
14153
  "src/server/error-page.ts": {
14125
14154
  "bytesInOutput": 1638
@@ -14128,16 +14157,16 @@
14128
14157
  "bytesInOutput": 1582
14129
14158
  },
14130
14159
  "src/utils/banner.ts": {
14131
- "bytesInOutput": 1819
14160
+ "bytesInOutput": 1863
14132
14161
  },
14133
14162
  "src/utils/command-executor.ts": {
14134
14163
  "bytesInOutput": 3729
14135
14164
  },
14136
14165
  "src/index.ts": {
14137
- "bytesInOutput": 7220
14166
+ "bytesInOutput": 7825
14138
14167
  }
14139
14168
  },
14140
- "bytes": 3806761
14169
+ "bytes": 3808490
14141
14170
  }
14142
14171
  }
14143
14172
  }
package/dist/index.cjs CHANGED
@@ -57548,6 +57548,36 @@ var require_dist = __commonJS({
57548
57548
  }
57549
57549
  });
57550
57550
 
57551
+ // src/utils/check-port.ts
57552
+ var check_port_exports = {};
57553
+ __export(check_port_exports, {
57554
+ isPortListening: () => isPortListening
57555
+ });
57556
+ async function isPortListening(port2, host = "localhost", timeout = 1e3) {
57557
+ return new Promise((resolve3) => {
57558
+ const socket = (0, import_node_net.createConnection)({ port: port2, host }, () => {
57559
+ socket.end();
57560
+ resolve3(true);
57561
+ });
57562
+ socket.setTimeout(timeout);
57563
+ socket.on("error", () => {
57564
+ resolve3(false);
57565
+ });
57566
+ socket.on("timeout", () => {
57567
+ socket.destroy();
57568
+ resolve3(false);
57569
+ });
57570
+ });
57571
+ }
57572
+ var import_node_net;
57573
+ var init_check_port = __esm({
57574
+ "src/utils/check-port.ts"() {
57575
+ "use strict";
57576
+ import_node_net = require("node:net");
57577
+ __name(isPortListening, "isPortListening");
57578
+ }
57579
+ });
57580
+
57551
57581
  // ../../node_modules/.pnpm/open@10.1.2/node_modules/open/index.js
57552
57582
  var import_node_process5 = __toESM(require("node:process"), 1);
57553
57583
  var import_node_buffer = require("node:buffer");
@@ -96810,9 +96840,17 @@ var proxy = (0, import_http_proxy_middleware.createProxyMiddleware)({
96810
96840
  // @ts-expect-error
96811
96841
  error: /* @__PURE__ */ __name((err, _req, res) => {
96812
96842
  log.error(`Proxy error: ${err.message}`);
96813
- const config = configResolver.getConfig();
96814
- res.writeHead(503, { "Content-Type": "text/html" });
96815
- res.end(errorPage(config.appPort));
96843
+ if (res && typeof res.writeHead === "function" && !res.headersSent) {
96844
+ try {
96845
+ const config = configResolver.getConfig();
96846
+ res.writeHead(503, { "Content-Type": "text/html" });
96847
+ res.end(errorPage(config.appPort));
96848
+ } catch (writeError) {
96849
+ log.debug(
96850
+ `Failed to send error response: ${writeError instanceof Error ? writeError.message : "Unknown error"}`
96851
+ );
96852
+ }
96853
+ }
96816
96854
  }, "error"),
96817
96855
  proxyRes: /* @__PURE__ */ __name((proxyRes) => {
96818
96856
  applyHeaderRewrites(proxyRes);
@@ -96914,7 +96952,7 @@ var createToolbarHtmlHandler = /* @__PURE__ */ __name((plugins) => async (_req,
96914
96952
  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
96915
96953
  <meta http-equiv="Pragma" content="no-cache">
96916
96954
  <meta http-equiv="Expires" content="0">
96917
- <title>Shadcn IDE Extension</title>
96955
+ <title>Shadcn Studio IDE Extension</title>
96918
96956
  <link rel="preconnect" href="https://rsms.me/">
96919
96957
  <link rel="stylesheet" href="https://rsms.me/inter/inter.css">
96920
96958
  <script type="importmap">${JSON.stringify(importMap)}</script>
@@ -97032,6 +97070,9 @@ var import_node_url5 = require("node:url");
97032
97070
  var __dirname4 = (0, import_node_path10.dirname)((0, import_node_url5.fileURLToPath)(import_meta_url));
97033
97071
  function getVersion() {
97034
97072
  try {
97073
+ if (true) {
97074
+ return "0.1.3";
97075
+ }
97035
97076
  const packageJsonPath = (0, import_node_path10.join)(__dirname4, "../../package.json");
97036
97077
  const packageJson = JSON.parse((0, import_node_fs9.readFileSync)(packageJsonPath, "utf-8"));
97037
97078
  return packageJson.version;
@@ -97340,12 +97381,24 @@ async function main() {
97340
97381
  );
97341
97382
  }
97342
97383
  const { server } = await getServer();
97384
+ if (config.appPort) {
97385
+ const { isPortListening: isPortListening2 } = await Promise.resolve().then(() => (init_check_port(), check_port_exports));
97386
+ const isAppPortAvailable = await isPortListening2(config.appPort);
97387
+ if (!isAppPortAvailable) {
97388
+ log.warn(
97389
+ `\u26A0\uFE0F Warning: App port ${config.appPort} is not responding. Make sure your application is running on port ${config.appPort}.`
97390
+ );
97391
+ log.warn(
97392
+ ` The Shadcn Studio IDE Extension will still start, but proxying will not work until your app is running.`
97393
+ );
97394
+ }
97395
+ }
97343
97396
  server.listen(config.port);
97344
97397
  server.on("listening", async () => {
97345
97398
  const address = server.address();
97346
97399
  const port2 = typeof address === "object" && address ? address.port : config.port;
97347
97400
  const serverUrl = `http://localhost:${port2}`;
97348
- log.info(`\u2713 Shadcn IDE Extension is running on ${serverUrl}`);
97401
+ log.info(`\u2713 Shadcn Studio IDE Extension is running on ${serverUrl}`);
97349
97402
  if (config.appPort) {
97350
97403
  log.info(`\u2713 Proxying app from port ${config.appPort}`);
97351
97404
  }