@apex-stack/core 0.7.0 → 0.7.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 CHANGED
@@ -147,7 +147,7 @@ var main = defineCommand2({
147
147
  },
148
148
  subCommands: {
149
149
  new: newCommand,
150
- dev: () => import("./dev-6SH5IYNT.js").then((m) => m.devCommand),
150
+ dev: () => import("./dev-XQN7XBZ4.js").then((m) => m.devCommand),
151
151
  build: () => import("./build-NA6JEP3F.js").then((m) => m.buildCommand),
152
152
  start: () => import("./start-7HSIYO6C.js").then((m) => m.startCommand),
153
153
  make: () => import("./make-VAYO5GWA.js").then((m) => m.makeCommand),
@@ -24,7 +24,7 @@ var devCommand = defineCommand({
24
24
  process.stdout.write(banner());
25
25
  const sp = spinner(`Starting dev server${args.islands ? " (islands mode)" : ""}\u2026`);
26
26
  try {
27
- const { startDevServer } = await import("./server-SSHQHMWY.js");
27
+ const { startDevServer } = await import("./server-2FN6GV3M.js");
28
28
  const { port: actual } = await startDevServer({ root, port, islands: Boolean(args.islands) });
29
29
  sp.succeed("Dev server ready");
30
30
  ready([
@@ -283,6 +283,22 @@ function renderErrorPage(error, opts) {
283
283
  <p class="foot">Click a frame's \u2197 to open it in your editor \xB7 fix &amp; save to auto-reload.</p>`;
284
284
  return page(`${kind} \u2014 Apex JS`, body, OPEN_JS);
285
285
  }
286
+ function renderNoProjectPage(root) {
287
+ let apps = [];
288
+ try {
289
+ apps = readdirSync(root, { withFileTypes: true }).filter((e) => e.isDirectory() && !IGNORE_DIRS.has(e.name) && !e.name.startsWith(".")).filter((e) => existsSync(join(root, e.name, "pages", "index.alpine"))).map((e) => e.name).slice(0, 16);
290
+ } catch {
291
+ }
292
+ const suggest = apps.length ? `<p class="sub">Did you mean to run it inside one of these apps?</p><ul class="routes">${apps.map((a) => `<li>cd ${esc(a)} &amp;&amp; apex dev</li>`).join("")}</ul>` : `<p class="sub">Scaffold a new app:</p><ul class="routes"><li>npm create apexjs@latest my-app</li></ul>`;
293
+ const body = `
294
+ <div class="brand">${MARK} Apex JS <span class="pill nf">No app here</span></div>
295
+ <p class="kind nf">No pages found</p>
296
+ <h1>This folder isn't an Apex app</h1>
297
+ <p class="sub"><code>apex dev</code> looks for <code>pages/*.alpine</code> in <code>${esc(root)}</code>, but found none \u2014 run it from inside your app's folder.</p>
298
+ ${suggest}
299
+ <p class="foot">Every Apex app has a <code>pages/</code> directory with at least <code>pages/index.alpine</code>.</p>`;
300
+ return page("No Apex app \u2014 Apex JS", body);
301
+ }
286
302
  function renderNotFoundPage(url, routes) {
287
303
  const list = routes.length ? routes.map((r) => `<li>${esc(r.pattern)}</li>`).join("") : "<li>no pages yet \u2014 add pages/index.alpine</li>";
288
304
  const body = `
@@ -422,6 +438,11 @@ async function startDevServer(options) {
422
438
  setResponseHeader(event, "Content-Type", "text/html");
423
439
  return await vite.transformIndexHtml(url, renderNotFoundPage(url, routes));
424
440
  }
441
+ if (!existsSync2(join2(options.root, matched.pageId))) {
442
+ setResponseStatus(event, 404);
443
+ setResponseHeader(event, "Content-Type", "text/html");
444
+ return await vite.transformIndexHtml(url, renderNoProjectPage(options.root));
445
+ }
425
446
  const { registry, css: componentCss } = await loadComponents(
426
447
  options.root,
427
448
  (id) => ssrLoad(id)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apex-stack/core",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "The full-stack meta-framework for Alpine.js — CLI and runtime",
5
5
  "type": "module",
6
6
  "license": "MIT",