defuss-ssg 0.4.0 → 0.5.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 +32 -0
- package/dist/cli.mjs +5 -6
- package/dist/index.cjs +13 -9
- package/dist/index.d.cts +7 -8
- package/dist/index.d.mts +7 -8
- package/dist/index.mjs +5 -6
- package/dist/runtime.cjs +611 -80
- package/dist/runtime.d.cts +17 -3
- package/dist/runtime.d.mts +17 -3
- package/dist/runtime.mjs +609 -78
- package/dist/{serve-CLC1GbGD.mjs → serve-BJ00mBAJ.mjs} +10 -2
- package/dist/{vite-DyhxNy3G.mjs → vite-B4oPT39d.mjs} +626 -276
- package/dist/{types-5c6EwOyf.d.cts → vite-CMGAfJFW.d.cts} +6 -6
- package/dist/{types-5c6EwOyf.d.mts → vite-CMGAfJFW.d.mts} +6 -6
- package/dist/{vite-CPvbAFU5.cjs → vite-DySvB3OP.cjs} +624 -276
- package/dist/vite.cjs +4 -5
- package/dist/vite.d.cts +2 -6
- package/dist/vite.d.mts +2 -6
- package/dist/vite.mjs +4 -5
- package/package.json +8 -27
- package/dist/components/index.cjs +0 -29
- package/dist/components/index.d.cts +0 -11
- package/dist/components/index.d.mts +0 -11
- package/dist/components/index.mjs +0 -27
- package/dist/plugins/index.cjs +0 -8
- package/dist/plugins/index.d.cts +0 -7
- package/dist/plugins/index.d.mts +0 -7
- package/dist/plugins/index.mjs +0 -2
- package/dist/tailwind-C4AuHybm.cjs +0 -14
- package/dist/tailwind-DV23JSh-.mjs +0 -12
package/README.md
CHANGED
|
@@ -327,6 +327,38 @@ Commands:
|
|
|
327
327
|
serve <folder> Serve with auto-rebuild on changes
|
|
328
328
|
```
|
|
329
329
|
|
|
330
|
+
<h3 align="center">
|
|
331
|
+
Benchmark
|
|
332
|
+
</h3>
|
|
333
|
+
|
|
334
|
+
The following benchmark was performed on the RPC endpoint of the example site, which calls a simple server-side function that adds two numbers. The test was run with 1024 concurrent connections, a pipelining factor of 256, and 8 workers for 30 seconds on a Macbook Air M4, 24 GB RAM under medium load (IDE, browser, docker, Spotify, Mail and terminal running while the benchmark was conducted).
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
$ bun x autocannon -p 256 -w 8 -c 1024 -d 30 -m POST -H 'content-type: application/json' -b '{"className":"mathApi","methodName":"add","args":[1,2]}' http://127.0.0.1:3000/rpc
|
|
338
|
+
Running 30s test @ http://127.0.0.1:3000/rpc
|
|
339
|
+
1024 connections with 256 pipelining factor
|
|
340
|
+
8 workers
|
|
341
|
+
|
|
342
|
+
/
|
|
343
|
+
┌─────────┬────────┬─────────┬─────────┬─────────┬────────────┬────────────┬─────────┐
|
|
344
|
+
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
|
|
345
|
+
├─────────┼────────┼─────────┼─────────┼─────────┼────────────┼────────────┼─────────┤
|
|
346
|
+
│ Latency │ 617 ms │ 4708 ms │ 5629 ms │ 6230 ms │ 4367.37 ms │ 1263.71 ms │ 7115 ms │
|
|
347
|
+
└─────────┴────────┴─────────┴─────────┴─────────┴────────────┴────────────┴─────────┘
|
|
348
|
+
┌───────────┬─────────┬─────────┬─────────┬─────────┬──────────┬─────────┬─────────┐
|
|
349
|
+
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
|
|
350
|
+
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼─────────┼─────────┤
|
|
351
|
+
│ Req/Sec │ 41,215 │ 41,215 │ 54,559 │ 66,751 │ 55,371.2 │ 5,492.3 │ 41,210 │
|
|
352
|
+
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼─────────┼─────────┤
|
|
353
|
+
│ Bytes/Sec │ 8.37 MB │ 8.37 MB │ 11.1 MB │ 13.5 MB │ 11.2 MB │ 1.11 MB │ 8.37 MB │
|
|
354
|
+
└───────────┴─────────┴─────────┴─────────┴─────────┴──────────┴─────────┴─────────┘
|
|
355
|
+
|
|
356
|
+
Req/Bytes counts sampled once per second.
|
|
357
|
+
# of samples: 240
|
|
358
|
+
|
|
359
|
+
1923k requests in 30.08s, 337 MB read
|
|
360
|
+
```
|
|
361
|
+
|
|
330
362
|
<p align="center">
|
|
331
363
|
|
|
332
364
|
<img src="https://raw.githubusercontent.com/kyr0/defuss/refs/heads/main/assets/defuss_comic.png" width="400px" />
|
package/dist/cli.mjs
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { v as validateProjectDir, b as build } from './vite-
|
|
3
|
-
import { d as dev, s as serve } from './serve-
|
|
2
|
+
import { v as validateProjectDir, b as build } from './vite-B4oPT39d.mjs';
|
|
3
|
+
import { d as dev, s as serve } from './serve-BJ00mBAJ.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
7
|
import 'node:fs/promises';
|
|
8
|
+
import 'node:url';
|
|
9
|
+
import 'defuss/server';
|
|
10
|
+
import 'node:crypto';
|
|
8
11
|
import '@mdx-js/rollup';
|
|
9
12
|
import 'fast-glob';
|
|
10
13
|
import 'vite';
|
|
11
14
|
import 'defuss-vite';
|
|
12
|
-
import 'defuss/server';
|
|
13
|
-
import 'node:url';
|
|
14
15
|
import 'node:os';
|
|
15
16
|
import 'esbuild';
|
|
16
17
|
import 'rehype-katex';
|
|
@@ -21,8 +22,6 @@ import 'remark-gfm';
|
|
|
21
22
|
import 'remark-parse';
|
|
22
23
|
import 'remark-rehype';
|
|
23
24
|
import 'remark-mdx-frontmatter';
|
|
24
|
-
import './tailwind-DV23JSh-.mjs';
|
|
25
|
-
import 'node:crypto';
|
|
26
25
|
import 'defuss-express';
|
|
27
26
|
|
|
28
27
|
const canResolve = (dep, dir) => {
|
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var vite = require('./vite-
|
|
3
|
+
var vite = require('./vite-DySvB3OP.cjs');
|
|
4
|
+
var mdx = require('@mdx-js/rollup');
|
|
4
5
|
var vite$1 = require('vite');
|
|
5
6
|
var defuss = require('defuss-vite');
|
|
6
7
|
var node_fs = require('node:fs');
|
|
7
8
|
var node_path = require('node:path');
|
|
8
9
|
var defussExpress = require('defuss-express');
|
|
9
10
|
require('node:fs/promises');
|
|
10
|
-
require('@mdx-js/rollup');
|
|
11
|
-
require('fast-glob');
|
|
12
|
-
require('defuss/server');
|
|
13
11
|
require('node:url');
|
|
12
|
+
require('defuss/server');
|
|
13
|
+
require('node:crypto');
|
|
14
|
+
require('fast-glob');
|
|
14
15
|
require('node:os');
|
|
15
16
|
require('esbuild');
|
|
16
17
|
require('rehype-katex');
|
|
@@ -21,8 +22,6 @@ require('remark-gfm');
|
|
|
21
22
|
require('remark-parse');
|
|
22
23
|
require('remark-rehype');
|
|
23
24
|
require('remark-mdx-frontmatter');
|
|
24
|
-
require('./tailwind-C4AuHybm.cjs');
|
|
25
|
-
require('node:crypto');
|
|
26
25
|
|
|
27
26
|
const dev = async ({
|
|
28
27
|
projectDir,
|
|
@@ -33,6 +32,7 @@ const dev = async ({
|
|
|
33
32
|
}) => {
|
|
34
33
|
const projectDirStatus = vite.validateProjectDir(projectDir);
|
|
35
34
|
if (projectDirStatus.code !== "OK") return projectDirStatus;
|
|
35
|
+
const config = await vite.readConfig(projectDir, debug);
|
|
36
36
|
const server = await vite$1.createServer({
|
|
37
37
|
root: projectDir,
|
|
38
38
|
configFile: false,
|
|
@@ -52,6 +52,12 @@ const dev = async ({
|
|
|
52
52
|
},
|
|
53
53
|
plugins: [
|
|
54
54
|
defuss({ enableJsxDevMode: true }),
|
|
55
|
+
mdx({
|
|
56
|
+
jsxImportSource: "defuss",
|
|
57
|
+
development: true,
|
|
58
|
+
remarkPlugins: config.remarkPlugins,
|
|
59
|
+
rehypePlugins: config.rehypePlugins
|
|
60
|
+
}),
|
|
55
61
|
...vite.defussSsg({
|
|
56
62
|
projectDir,
|
|
57
63
|
debug,
|
|
@@ -59,7 +65,7 @@ const dev = async ({
|
|
|
59
65
|
})
|
|
60
66
|
]
|
|
61
67
|
});
|
|
62
|
-
await server.listen();
|
|
68
|
+
await server.listen(port);
|
|
63
69
|
server.printUrls();
|
|
64
70
|
return {
|
|
65
71
|
code: "OK",
|
|
@@ -185,8 +191,6 @@ exports.loadEndpointModule = vite.loadEndpointModule;
|
|
|
185
191
|
exports.matchRoutePattern = vite.matchRoutePattern;
|
|
186
192
|
exports.readConfig = vite.readConfig;
|
|
187
193
|
exports.registerEndpoints = vite.registerEndpoints;
|
|
188
|
-
exports.rehypePlugins = vite.rehypePlugins;
|
|
189
|
-
exports.remarkPlugins = vite.remarkPlugins;
|
|
190
194
|
exports.resolveEndpoints = vite.resolveEndpoints;
|
|
191
195
|
exports.routeToExpressPattern = vite.routeToExpressPattern;
|
|
192
196
|
exports.dev = dev;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { S as SsgConfig, B as BuildOptions, a as Status, D as DevOptions, b as ServeOptions, E as EndpointRouteContext, c as EndpointRouteRegistrar } from './vite-CMGAfJFW.cjs';
|
|
2
|
+
export { d as BuildMode, e as DefussSsgViteOptions, f as DevChangeKind, g as EndpointRouteMethod, h as EndpointRouteResponder, P as PluginFn, i as PluginFnPageDom, j as PluginFnPageHtml, k as PluginFnPageVdom, l as PluginFnPrePost, R as RehypePlugins, m as RemarkPlugins, n as SsgPlugin, o as StatusCode, p as defussSsg } from './vite-CMGAfJFW.cjs';
|
|
3
|
+
import 'vite';
|
|
4
4
|
import 'remark-rehype';
|
|
5
5
|
import 'defuss/server';
|
|
6
|
-
import 'vite';
|
|
7
|
-
|
|
8
|
-
declare const remarkPlugins: RemarkPlugins;
|
|
9
|
-
declare const rehypePlugins: RehypePlugins;
|
|
10
6
|
|
|
11
7
|
/**
|
|
12
8
|
* Reads the SSG configuration from the project directory.
|
|
@@ -25,6 +21,9 @@ declare const build: ({ projectDir, debug, mode, changedFile, }: BuildOptions) =
|
|
|
25
21
|
|
|
26
22
|
/**
|
|
27
23
|
* Start the Vite-backed development server for defuss-ssg.
|
|
24
|
+
* Uses Vite's transform pipeline for true HMR — MDX files are
|
|
25
|
+
* transformed on-the-fly via ssrLoadModule, no temp servers needed.
|
|
26
|
+
* Soft-reload uses Vite's built-in HMR WebSocket channel.
|
|
28
27
|
*/
|
|
29
28
|
declare const dev: ({ projectDir, debug, host, port, writeDevOutput, }: DevOptions) => Promise<Status>;
|
|
30
29
|
|
|
@@ -227,5 +226,5 @@ declare const handleRpcRequest: (ctx: {
|
|
|
227
226
|
request: Request;
|
|
228
227
|
}) => Promise<Response>;
|
|
229
228
|
|
|
230
|
-
export { BuildOptions, DevOptions, EndpointRouteContext, EndpointRouteRegistrar, HTTP_METHODS,
|
|
229
|
+
export { BuildOptions, DevOptions, EndpointRouteContext, EndpointRouteRegistrar, HTTP_METHODS, ServeOptions, SsgConfig, Status, build, buildEndpoints, compileEndpoints, compileRpcModule, configDefaults, dev, discoverEndpointSourceFiles, discoverRpcFile, endpointFileToRoute, handleEndpointRoute, handleRpcRequest, initializeRpc, loadEndpointModule, matchRoutePattern, readConfig, registerEndpoints, resolveEndpoints, routeToExpressPattern, serve };
|
|
231
230
|
export type { APIRoute, EndpointContext, EndpointHandler, EndpointModule, HttpMethod, ResolvedEndpoint };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { S as SsgConfig, B as BuildOptions, a as Status, D as DevOptions, b as ServeOptions, E as EndpointRouteContext, c as EndpointRouteRegistrar } from './vite-CMGAfJFW.mjs';
|
|
2
|
+
export { d as BuildMode, e as DefussSsgViteOptions, f as DevChangeKind, g as EndpointRouteMethod, h as EndpointRouteResponder, P as PluginFn, i as PluginFnPageDom, j as PluginFnPageHtml, k as PluginFnPageVdom, l as PluginFnPrePost, R as RehypePlugins, m as RemarkPlugins, n as SsgPlugin, o as StatusCode, p as defussSsg } from './vite-CMGAfJFW.mjs';
|
|
3
|
+
import 'vite';
|
|
4
4
|
import 'remark-rehype';
|
|
5
5
|
import 'defuss/server';
|
|
6
|
-
import 'vite';
|
|
7
|
-
|
|
8
|
-
declare const remarkPlugins: RemarkPlugins;
|
|
9
|
-
declare const rehypePlugins: RehypePlugins;
|
|
10
6
|
|
|
11
7
|
/**
|
|
12
8
|
* Reads the SSG configuration from the project directory.
|
|
@@ -25,6 +21,9 @@ declare const build: ({ projectDir, debug, mode, changedFile, }: BuildOptions) =
|
|
|
25
21
|
|
|
26
22
|
/**
|
|
27
23
|
* Start the Vite-backed development server for defuss-ssg.
|
|
24
|
+
* Uses Vite's transform pipeline for true HMR — MDX files are
|
|
25
|
+
* transformed on-the-fly via ssrLoadModule, no temp servers needed.
|
|
26
|
+
* Soft-reload uses Vite's built-in HMR WebSocket channel.
|
|
28
27
|
*/
|
|
29
28
|
declare const dev: ({ projectDir, debug, host, port, writeDevOutput, }: DevOptions) => Promise<Status>;
|
|
30
29
|
|
|
@@ -227,5 +226,5 @@ declare const handleRpcRequest: (ctx: {
|
|
|
227
226
|
request: Request;
|
|
228
227
|
}) => Promise<Response>;
|
|
229
228
|
|
|
230
|
-
export { BuildOptions, DevOptions, EndpointRouteContext, EndpointRouteRegistrar, HTTP_METHODS,
|
|
229
|
+
export { BuildOptions, DevOptions, EndpointRouteContext, EndpointRouteRegistrar, HTTP_METHODS, ServeOptions, SsgConfig, Status, build, buildEndpoints, compileEndpoints, compileRpcModule, configDefaults, dev, discoverEndpointSourceFiles, discoverRpcFile, endpointFileToRoute, handleEndpointRoute, handleRpcRequest, initializeRpc, loadEndpointModule, matchRoutePattern, readConfig, registerEndpoints, resolveEndpoints, routeToExpressPattern, serve };
|
|
231
230
|
export type { APIRoute, EndpointContext, EndpointHandler, EndpointModule, HttpMethod, ResolvedEndpoint };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +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
|
|
2
|
-
export { d as dev, s as serve } from './serve-
|
|
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-B4oPT39d.mjs';
|
|
2
|
+
export { d as dev, s as serve } from './serve-BJ00mBAJ.mjs';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:fs/promises';
|
|
5
5
|
import 'node:path';
|
|
6
|
+
import 'node:url';
|
|
7
|
+
import 'defuss/server';
|
|
8
|
+
import 'node:crypto';
|
|
6
9
|
import '@mdx-js/rollup';
|
|
7
10
|
import 'fast-glob';
|
|
8
11
|
import 'vite';
|
|
9
12
|
import 'defuss-vite';
|
|
10
|
-
import 'defuss/server';
|
|
11
|
-
import 'node:url';
|
|
12
13
|
import 'node:os';
|
|
13
14
|
import 'esbuild';
|
|
14
15
|
import 'rehype-katex';
|
|
@@ -19,6 +20,4 @@ import 'remark-gfm';
|
|
|
19
20
|
import 'remark-parse';
|
|
20
21
|
import 'remark-rehype';
|
|
21
22
|
import 'remark-mdx-frontmatter';
|
|
22
|
-
import './tailwind-DV23JSh-.mjs';
|
|
23
|
-
import 'node:crypto';
|
|
24
23
|
import 'defuss-express';
|