defuss-ssg 0.5.2 → 0.6.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/README.md CHANGED
@@ -12,14 +12,16 @@ Use Bun for package management. The published package targets Node `^20.19.0 ||
12
12
 
13
13
  ## What It Supports
14
14
 
15
- - Markdown and MDX pages from `pages/`
15
+ - Markdown and MDX pages from `pages/` or `src/pages/`
16
16
  - YAML or TOML frontmatter exposed as `meta`
17
17
  - GitHub Flavored Markdown via `remark-gfm`
18
18
  - KaTeX math via `$...$` and `$$...$$`
19
19
  - defuss components imported into MDX and HTML-like pages
20
- - Automatic hydration boundaries for components rendered from `components/`
21
- - Static assets copied from `assets/`
20
+ - Automatic hydration boundaries for components rendered from `components/`, `src/components/`, `csr/`, or `src/csr/`
21
+ - Static assets copied from `assets/` or `src/assets/`
22
+ - Vite-style `public/` assets copied to the output root and served at `/<file>`
22
23
  - File-based API routes from `pages/**/*.ts` and `pages/**/*.js`
24
+ - Root `index.mdx`, `index.md`, or `index.html` fallback when no pages directory exists
23
25
  - Pre-rendered endpoints via `prerender = true` and `getStaticPaths()`
24
26
  - RPC auto-discovery from `rpc.ts` or `rpc.js` when `defuss-rpc` is installed
25
27
  - Plugin hooks for `pre`, `page-vdom`, `page-dom`, `page-html`, and `post`
@@ -275,12 +277,14 @@ Most projects only need the main package export.
275
277
  ```bash
276
278
  defuss-ssg [dev|build|serve] [folder] [--debug] [--multicore]
277
279
 
278
- No args -> serve .
279
- Single path -> serve <path>
280
+ No args -> dev .
281
+ Single path -> dev <path>
280
282
  Single command -> <command> .
281
283
  Command + folder -> <command> <folder>
282
284
  ```
283
285
 
286
+ When `pages`, `components`, or `assets` are not configured explicitly, `defuss-ssg` prefers `src/pages`, `src/components`, `src/csr`, and `src/assets` before falling back to their project-root equivalents. If no pages directory exists, it falls back to root `index.mdx`, then `index.md`, then `index.html`. A project-root `public/` directory is treated like Vite/Astro `public`: its files are available at the site root.
287
+
284
288
  Commands:
285
289
 
286
290
  - `dev`: starts the Vite dev server on port `3000` by default
package/dist/cli.mjs CHANGED
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import { v as validateProjectDir, b as build } from './vite-DcjFCDSl.mjs';
3
- import { d as dev, s as serve } from './serve-CSH82zKY.mjs';
2
+ import { v as validateProjectDir, b as build } from './vite-DLXcqaZX.mjs';
3
+ import { d as dev, s as serve } from './serve-DIW2gbz_.mjs';
4
4
  import { join, dirname, resolve } from 'node:path';
5
5
  import { existsSync, readFileSync } from 'node:fs';
6
6
  import { spawn } from 'node:child_process';
7
+ import 'fast-glob';
7
8
  import 'node:fs/promises';
8
- import 'node:url';
9
9
  import 'defuss/server';
10
10
  import 'node:crypto';
11
11
  import '@mdx-js/rollup';
12
- import 'fast-glob';
13
12
  import 'vite';
14
13
  import 'defuss-vite';
14
+ import 'node:url';
15
15
  import 'node:os';
16
16
  import 'esbuild';
17
17
  import 'rehype-katex';
@@ -173,27 +173,32 @@ Continuing anyway - dependencies may already be available.`
173
173
  const debug = args.includes("--debug") || args.includes("-d");
174
174
  const multicore = args.includes("--multicore");
175
175
  const positional = args.filter((a) => !a.startsWith("-"));
176
- const usage = "Usage: defuss-ssg [dev|build|serve] [folder]\n No args => serve .\n Single path => serve <path>\n Single command => <command> .\n Command + folder => <command> <folder>\n Flags: [--debug] [--multicore]";
176
+ const commands = /* @__PURE__ */ new Set(["dev", "build", "serve"]);
177
+ const usage = "Usage: defuss-ssg [dev|build|serve] [folder]\n No args => dev .\n Single path => dev <path>\n Single command => <command> .\n Command + folder => <command> <folder>\n Flags: [--debug] [--multicore]";
177
178
  let command;
178
179
  let folder;
179
180
  if (positional.length === 0) {
180
- command = "serve";
181
+ command = "dev";
181
182
  folder = ".";
182
183
  } else if (positional.length === 1) {
183
184
  const arg = positional[0];
184
- if (arg === "dev" || arg === "build" || arg === "serve") {
185
+ if (commands.has(arg)) {
185
186
  command = arg;
186
187
  folder = ".";
187
- } else if (arg.startsWith(".") || arg.startsWith("/")) {
188
- command = "serve";
189
- folder = arg;
190
188
  } else {
189
+ command = "dev";
190
+ folder = arg;
191
+ }
192
+ } else if (positional.length === 2) {
193
+ if (!commands.has(positional[0])) {
191
194
  console.error(usage);
192
195
  process.exit(1);
193
196
  }
194
- } else {
195
197
  command = positional[0];
196
198
  folder = positional[1];
199
+ } else {
200
+ console.error(usage);
201
+ process.exit(1);
197
202
  }
198
203
  const projectDir = resolve(folder);
199
204
  await setup(projectDir);
package/dist/index.cjs CHANGED
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var vite = require('./vite-CQJBNUfy.cjs');
3
+ var vite = require('./vite-DlnPNJYO.cjs');
4
4
  var mdx = require('@mdx-js/rollup');
5
5
  var vite$1 = require('vite');
6
6
  var defuss = require('defuss-vite');
7
7
  var node_fs = require('node:fs');
8
8
  var node_path = require('node:path');
9
9
  var defussExpress = require('defuss-express');
10
+ require('fast-glob');
10
11
  require('node:fs/promises');
11
- require('node:url');
12
12
  require('defuss/server');
13
13
  require('node:crypto');
14
- require('fast-glob');
14
+ require('node:url');
15
15
  require('node:os');
16
16
  require('esbuild');
17
17
  require('rehype-katex');
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
- export { H as HTTP_METHODS, b as build, a as buildEndpoints, c as compileEndpoints, d as compileRpcModule, e as configDefaults, f as defussSsg, g as discoverEndpointSourceFiles, h as discoverRpcFile, i as endpointFileToRoute, j as handleEndpointRoute, k as handleRpcRequest, l as initializeRpc, m as loadEndpointModule, n as matchRoutePattern, r as readConfig, o as registerEndpoints, p as resolveEndpoints, q as routeToExpressPattern } from './vite-DcjFCDSl.mjs';
2
- export { d as dev, s as serve } from './serve-CSH82zKY.mjs';
1
+ export { H as HTTP_METHODS, b as build, a as buildEndpoints, c as compileEndpoints, d as compileRpcModule, e as configDefaults, f as defussSsg, g as discoverEndpointSourceFiles, h as discoverRpcFile, i as endpointFileToRoute, j as handleEndpointRoute, k as handleRpcRequest, l as initializeRpc, m as loadEndpointModule, n as matchRoutePattern, r as readConfig, o as registerEndpoints, p as resolveEndpoints, q as routeToExpressPattern } from './vite-DLXcqaZX.mjs';
2
+ export { d as dev, s as serve } from './serve-DIW2gbz_.mjs';
3
+ import 'fast-glob';
3
4
  import 'node:fs';
4
5
  import 'node:fs/promises';
5
6
  import 'node:path';
6
- import 'node:url';
7
7
  import 'defuss/server';
8
8
  import 'node:crypto';
9
9
  import '@mdx-js/rollup';
10
- import 'fast-glob';
11
10
  import 'vite';
12
11
  import 'defuss-vite';
12
+ import 'node:url';
13
13
  import 'node:os';
14
14
  import 'esbuild';
15
15
  import 'rehype-katex';
@@ -1,7 +1,7 @@
1
1
  import mdx from '@mdx-js/rollup';
2
2
  import { createServer } from 'vite';
3
3
  import defuss from 'defuss-vite';
4
- import { v as validateProjectDir, r as readConfig, f as defussSsg, o as registerEndpoints, l as initializeRpc, s as readIncomingBody, t as createWebRequest, k as handleRpcRequest, u as sendWebResponse } from './vite-DcjFCDSl.mjs';
4
+ import { v as validateProjectDir, r as readConfig, f as defussSsg, o as registerEndpoints, l as initializeRpc, s as readIncomingBody, t as createWebRequest, k as handleRpcRequest, u as sendWebResponse } from './vite-DLXcqaZX.mjs';
5
5
  import { existsSync } from 'node:fs';
6
6
  import { join } from 'node:path';
7
7
  import { express, startServer } from 'defuss-express';