@ubean/cli 0.3.5 → 0.3.7

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/cli.js +13 -13
  2. package/package.json +12 -12
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { A as summarizeBundle, D as compareBundleBaseline, E as createFsOps, O as findClientManifest, S as renderTemplate, a as scaffold, c as scaffoldStarterTemplate, i as recoverScaffold, j as writeBundleBaseline, k as readViteManifest, l as scaffoldUnifyTemplate, n as listScaffoldableFiles, o as scaffoldBlogTemplate, r as pageCommand, s as scaffoldMinimalTemplate, t as deleteScaffold } from "./page-sFQRjxXM.js";
2
2
  import { existsSync, mkdirSync, readFileSync, watch } from "node:fs";
3
3
  import { basename, join, relative, resolve } from "pathe";
4
- import { extname, normalize } from "node:path";
5
- import { getLogger } from "@ubean/shared/logger";
4
+ import { extname, normalize, sep } from "node:path";
5
+ import { getLogger, setDebugLogging } from "@ubean/shared/logger";
6
6
  import { defineCommand, runMain } from "citty";
7
7
  import { BUILTIN_MODULES, isBuiltinDisabled, loadUbeanConfig, resolveModules, resolvePrerenderConfig, resolveSsrConfig } from "@ubean/config";
8
8
  import { readFile, rm, stat } from "node:fs/promises";
@@ -677,6 +677,7 @@ async function createViteDevServer(options) {
677
677
  },
678
678
  optimizeDeps: { exclude: [
679
679
  "ubean",
680
+ "vue-router",
680
681
  "virtual:ubean-pages",
681
682
  "virtual:ubean-app",
682
683
  "virtual:ubean-server",
@@ -1123,17 +1124,14 @@ const devCommand = {
1123
1124
  },
1124
1125
  onListen({ url }) {
1125
1126
  const label = (text) => dim(text);
1126
- const lines = [
1127
- `${green(bold("🚀 ubean dev server ready"))}\n`,
1128
- ` → ${label("Local:")} ${cyan(url)}`,
1129
- ` → ${label("Scalar UI:")} ${cyan(`${url}/_scalar`)}`,
1130
- ` → ${label("OpenAPI:")} ${cyan(`${url}/_openapi.json`)}`
1131
- ];
1127
+ const lines = [`${green(bold("🚀 ubean dev server ready"))}\n`, ` → ${label("Local:")} ${cyan(url)}`];
1128
+ const hasBackend = config.mode !== "ssg" && config.mode !== "spa";
1129
+ if (hasBackend) lines.push(` → ${label("Scalar UI:")} ${cyan(`${url}/_scalar`)}`, ` → ${label("OpenAPI:")} ${cyan(`${url}/_openapi.json`)}`);
1132
1130
  if (config.devtools.enabled) lines.push(` → ${label("DevTools:")} ${cyan(`${url}${config.devtools.route}`)}`);
1133
1131
  lines.push(` → ${dim("Press Ctrl+C to stop")}`);
1134
1132
  logger$6.info(lines.join("\n"));
1135
- generateOpenApiTypesFromServer(url, { outDir: resolve(cwd, ".ubean") }).then((filePath) => {
1136
- logger$6.info(`OpenAPI types generated: ${filePath}`);
1133
+ if (hasBackend) generateOpenApiTypesFromServer(url, { outDir: resolve(cwd, ".ubean") }).then((filePath) => {
1134
+ if (filePath) logger$6.info(`OpenAPI types generated: ${filePath}`);
1137
1135
  }).catch((err) => {
1138
1136
  logger$6.warn(`Failed to generate OpenAPI types: ${err instanceof Error ? err.message : String(err)}`);
1139
1137
  });
@@ -1980,13 +1978,14 @@ function startStaticServer(opts) {
1980
1978
  return createServer(async (req, res) => {
1981
1979
  try {
1982
1980
  const url = new URL(req.url || "/", `http://${host}`);
1983
- let pathname = normalize(decodeURIComponent(url.pathname));
1984
- if (pathname.includes("..")) {
1981
+ const pathname = decodeURIComponent(url.pathname);
1982
+ let filePath = normalize(join(root, pathname));
1983
+ const rootPath = resolve(root);
1984
+ if (filePath !== rootPath && !filePath.startsWith(rootPath + sep)) {
1985
1985
  res.statusCode = 400;
1986
1986
  res.end("Bad Request");
1987
1987
  return;
1988
1988
  }
1989
- let filePath = join(root, pathname);
1990
1989
  let fileExists = existsSync(filePath) && (await stat(filePath)).isFile();
1991
1990
  if (!fileExists && existsSync(filePath) && (await stat(filePath)).isDirectory()) {
1992
1991
  const indexPath = join(filePath, "index.html");
@@ -2419,6 +2418,7 @@ const main = defineCommand({
2419
2418
  analyze: analyzeCommand
2420
2419
  }
2421
2420
  });
2421
+ if (process.argv.includes("--debug")) setDebugLogging(true);
2422
2422
  runMain(main);
2423
2423
  //#endregion
2424
2424
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubean/cli",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "CLI for ubean (ubean-next binary: dev, build, prepare, init, preview, page, env, config, devtools, api/layout/middleware/cron/plugin scaffolds) plus the Vite dev server runner",
5
5
  "bin": {
6
6
  "ubean-next": "./bin/ubean-next.mjs"
@@ -24,15 +24,15 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@ubean/app": "0.3.5",
28
- "@ubean/build": "0.3.5",
29
- "@ubean/client": "0.3.5",
30
- "@ubean/config": "0.3.5",
31
- "@ubean/i18n": "0.3.5",
32
- "@ubean/islands": "0.3.5",
33
- "@ubean/preset": "0.3.5",
34
- "@ubean/scan": "0.3.5",
35
- "@ubean/shared": "0.3.5",
27
+ "@ubean/app": "0.3.7",
28
+ "@ubean/build": "0.3.7",
29
+ "@ubean/client": "0.3.7",
30
+ "@ubean/config": "0.3.7",
31
+ "@ubean/i18n": "0.3.7",
32
+ "@ubean/islands": "0.3.7",
33
+ "@ubean/preset": "0.3.7",
34
+ "@ubean/scan": "0.3.7",
35
+ "@ubean/shared": "0.3.7",
36
36
  "citty": "^0.2.2",
37
37
  "kolorist": "^1.8.0",
38
38
  "pathe": "^2.0.3"
@@ -45,8 +45,8 @@
45
45
  "vite-plus": "0.3.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "@ubean/content": "0.3.5",
49
- "@ubean/devtools": "0.3.5",
48
+ "@ubean/content": "0.3.7",
49
+ "@ubean/devtools": "0.3.7",
50
50
  "@vitejs/plugin-vue": "^6.0.8",
51
51
  "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0"
52
52
  },