defuss-ssg 0.7.0 → 0.7.2
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 +49 -15
- package/dist/cli.mjs +29 -29
- package/dist/content.d.cts +1 -1
- package/dist/content.d.mts +1 -1
- package/dist/content.mjs +1 -1
- package/dist/index.cjs +54 -37
- package/dist/index.d.cts +46 -6
- package/dist/index.d.mts +46 -6
- package/dist/index.mjs +3 -3
- package/dist/{path-CjHWUK8o.mjs → path-j0LJZE_u.mjs} +1 -1
- package/dist/runtime.cjs +26 -0
- package/dist/runtime.d.cts +1 -0
- package/dist/runtime.d.mts +1 -0
- package/dist/runtime.mjs +26 -0
- package/dist/{serve-BFMU8uCH.mjs → serve-qxXVqJiL.mjs} +39 -38
- package/dist/{types-CZSWRdQS.d.cts → types-Dh8AcW7C.d.cts} +1 -1
- package/dist/{types-CZSWRdQS.d.mts → types-Dh8AcW7C.d.mts} +1 -1
- package/dist/{vite-BC7XxFTV.cjs → vite-CE8Q5aF_.cjs} +601 -104
- package/dist/{vite-CSOGjlHB.mjs → vite-bKsy4atm.mjs} +587 -106
- package/dist/vite.cjs +1 -1
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -86,6 +86,31 @@ export default config;
|
|
|
86
86
|
|
|
87
87
|
`containerRuntime` forces `docker` or `podman` for `docker-*` commands. `viteConfig` is merged into defuss-ssg's internal Vite config for both `dev` and `build`, so you can add aliases, plugins, server options, and similar Vite settings from `config.ts`.
|
|
88
88
|
|
|
89
|
+
If you need to extend the current defuss-ssg Vite config instead of only passing a patch object, import it from the virtual module and merge from there:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { mergeConfig } from "vite";
|
|
93
|
+
import { viteConfig as currentViteConfig } from "virtual:defuss-ssg/config";
|
|
94
|
+
|
|
95
|
+
const config: SsgConfig = {
|
|
96
|
+
viteConfig: mergeConfig(currentViteConfig, {
|
|
97
|
+
resolve: {
|
|
98
|
+
alias: {
|
|
99
|
+
"@app": new URL("./src", import.meta.url).pathname,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
server: {
|
|
103
|
+
// your custom domain, headers etc.
|
|
104
|
+
allowedHosts: ["example-ssg.demo.defuss.tech"],
|
|
105
|
+
},
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export default config;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The virtual module resolves to the current internal `defuss-ssg` Vite config, so you can also inspect or extend existing plugin arrays and nested Vite settings without re-creating them manually.
|
|
113
|
+
|
|
89
114
|
Example page:
|
|
90
115
|
|
|
91
116
|
```mdx
|
|
@@ -138,14 +163,23 @@ defuss-ssg serve ./my-site
|
|
|
138
163
|
|
|
139
164
|
`serve` expects existing build output in `dist/`, so run `build` first.
|
|
140
165
|
|
|
141
|
-
|
|
166
|
+
For checked-out, unpublished, or locally linked package development use e.g.:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
node ./dist/cli.mjs dev ../../examples/with-dson/ --port 3010
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
## Production Deployment
|
|
174
|
+
|
|
175
|
+
`defuss-ssg` supports `podman` and `docker` for production deployment.
|
|
142
176
|
|
|
143
177
|
The primary container workflow is built into the CLI:
|
|
144
178
|
|
|
145
179
|
```bash
|
|
146
|
-
bunx defuss-ssg
|
|
147
|
-
bunx defuss-ssg
|
|
148
|
-
bunx defuss-ssg
|
|
180
|
+
bunx defuss-ssg container-dev ./my-site
|
|
181
|
+
bunx defuss-ssg container-build ./my-site
|
|
182
|
+
bunx defuss-ssg container-serve ./my-site --multicore
|
|
149
183
|
```
|
|
150
184
|
|
|
151
185
|
When you are working from this monorepo before the next npm publish, use the built local CLI instead of `bunx defuss-ssg`. `bunx defuss-ssg` resolves the last published package, so it will not see unreleased `docker-*` commands from this checkout:
|
|
@@ -153,12 +187,12 @@ When you are working from this monorepo before the next npm publish, use the bui
|
|
|
153
187
|
```bash
|
|
154
188
|
cd packages/ssg
|
|
155
189
|
bun run build
|
|
156
|
-
node ./dist/cli.mjs
|
|
190
|
+
node ./dist/cli.mjs container-dev ../../example-ssg --port 3111 --container-args --network host
|
|
157
191
|
```
|
|
158
192
|
|
|
159
193
|
Each `docker-*` command writes a temporary Dockerfile, builds a local `defuss-ssg` image, mounts your project at `/workspace`, mounts a deterministic container-managed `/workspace/node_modules` volume, and then runs the matching inner `defuss-ssg` command. The mounted project still owns its dependency graph: the container reads that project's `package.json`, uses its declared package manager, installs the project's dependencies, and then starts `dev`, `build`, or `serve`.
|
|
160
194
|
|
|
161
|
-
`
|
|
195
|
+
`container-dev` and `container-serve` automatically bind the inner service to `0.0.0.0` and publish the selected port. One published port is enough even with `--multicore`; `defuss-express` keeps worker ports internal and load-balances behind the public port.
|
|
162
196
|
|
|
163
197
|
Runtime selection:
|
|
164
198
|
|
|
@@ -172,11 +206,11 @@ export default {
|
|
|
172
206
|
};
|
|
173
207
|
```
|
|
174
208
|
|
|
175
|
-
Outer container runtime arguments can be forwarded with `--
|
|
209
|
+
Outer container runtime arguments can be forwarded with `--container-args`. Everything after that marker is appended to the outer `docker run` or `podman run` call, while the arguments before it still go to the inner `defuss-ssg` command:
|
|
176
210
|
|
|
177
211
|
```bash
|
|
178
|
-
bunx defuss-ssg
|
|
179
|
-
bunx defuss-ssg
|
|
212
|
+
bunx defuss-ssg container-dev ./my-site --port 3000 --container-args --network host
|
|
213
|
+
bunx defuss-ssg container-serve ./my-site --multicore --container-args --env NODE_ENV=production
|
|
180
214
|
```
|
|
181
215
|
|
|
182
216
|
Good to know:
|
|
@@ -237,7 +271,7 @@ Notes:
|
|
|
237
271
|
- `cwd` defaults to the current working directory for the direct helper.
|
|
238
272
|
- The virtual module binds `cwd` and `pages` to the active SSG project automatically.
|
|
239
273
|
- `route` is only derived for files inside the configured `pages` directory.
|
|
240
|
-
-
|
|
274
|
+
- Returns metadata records only; it does not eagerly execute every matched MDX module.
|
|
241
275
|
|
|
242
276
|
## Endpoints
|
|
243
277
|
|
|
@@ -387,7 +421,7 @@ Most projects only need the main package export.
|
|
|
387
421
|
## CLI Reference
|
|
388
422
|
|
|
389
423
|
```bash
|
|
390
|
-
defuss-ssg [dev|build|serve|
|
|
424
|
+
defuss-ssg [dev|build|serve|container-dev|container-build|container-serve] [folder] [options]
|
|
391
425
|
|
|
392
426
|
No args -> dev .
|
|
393
427
|
Single path -> dev <path>
|
|
@@ -402,9 +436,9 @@ Commands:
|
|
|
402
436
|
- `dev`: starts the Vite dev server on port `3000` by default
|
|
403
437
|
- `build`: generates the static site into `dist/`
|
|
404
438
|
- `serve`: serves the built output from `dist/`
|
|
405
|
-
- `
|
|
406
|
-
- `
|
|
407
|
-
- `
|
|
439
|
+
- `container-dev`: builds the generated image, mounts the project, and starts `dev` inside Docker or Podman
|
|
440
|
+
- `container-build`: builds the generated image, mounts the project, and runs `build` inside Docker or Podman
|
|
441
|
+
- `container-serve`: builds the generated image, mounts the project, and runs `serve` inside Docker or Podman
|
|
408
442
|
|
|
409
443
|
Flags:
|
|
410
444
|
|
|
@@ -413,7 +447,7 @@ Flags:
|
|
|
413
447
|
- `--host` or `-H <host>`: override the dev or serve bind host
|
|
414
448
|
- `--port` or `-p <port>`: override the dev or serve port
|
|
415
449
|
- `--skip-setup` or `--no-setup`: skip project dependency installation for prepared environments and containers
|
|
416
|
-
- `--
|
|
450
|
+
- `--container-args <args...>`: forward everything after the marker to the outer `docker run` or `podman run` invocation used by `docker-*`
|
|
417
451
|
|
|
418
452
|
## Local Package Development
|
|
419
453
|
|
package/dist/cli.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { B as readConfig, L as validateProjectDir, b as build } from './vite-bKsy4atm.mjs';
|
|
3
3
|
import { spawnSync, spawn } from 'node:child_process';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
5
|
import { mkdtempSync, writeFileSync, rmSync, existsSync, readFileSync } from 'node:fs';
|
|
6
6
|
import { tmpdir } from 'node:os';
|
|
7
7
|
import { resolve, join, basename, dirname } from 'node:path';
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
|
-
import { d as dev, s as serve } from './serve-
|
|
9
|
+
import { d as dev, s as serve } from './serve-qxXVqJiL.mjs';
|
|
10
10
|
import 'fast-glob';
|
|
11
11
|
import 'node:fs/promises';
|
|
12
12
|
import 'defuss/server';
|
|
@@ -23,7 +23,7 @@ import 'remark-gfm';
|
|
|
23
23
|
import 'remark-parse';
|
|
24
24
|
import 'remark-rehype';
|
|
25
25
|
import 'remark-mdx-frontmatter';
|
|
26
|
-
import './path-
|
|
26
|
+
import './path-j0LJZE_u.mjs';
|
|
27
27
|
import 'node:process';
|
|
28
28
|
import 'defuss-express';
|
|
29
29
|
|
|
@@ -133,25 +133,25 @@ const runContainerRuntime = (runtime, args, label, cwd) => {
|
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
|
-
const hasPublishArgs = (
|
|
137
|
-
for (let index = 0; index <
|
|
138
|
-
const arg =
|
|
136
|
+
const hasPublishArgs = (containerArgs) => {
|
|
137
|
+
for (let index = 0; index < containerArgs.length; index += 1) {
|
|
138
|
+
const arg = containerArgs[index];
|
|
139
139
|
if (arg === "-p" || arg === "-P" || arg === "--publish" || arg === "--publish-all" || arg.startsWith("--publish=")) {
|
|
140
140
|
return true;
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
return false;
|
|
144
144
|
};
|
|
145
|
-
const extractHostNetworkArgs = (
|
|
145
|
+
const extractHostNetworkArgs = (containerArgs) => {
|
|
146
146
|
const remainingArgs = [];
|
|
147
147
|
let hostNetworkRequested = false;
|
|
148
|
-
for (let index = 0; index <
|
|
149
|
-
const arg =
|
|
148
|
+
for (let index = 0; index < containerArgs.length; index += 1) {
|
|
149
|
+
const arg = containerArgs[index];
|
|
150
150
|
if (arg === "--net=host" || arg === "--network=host") {
|
|
151
151
|
hostNetworkRequested = true;
|
|
152
152
|
continue;
|
|
153
153
|
}
|
|
154
|
-
if ((arg === "--net" || arg === "--network") &&
|
|
154
|
+
if ((arg === "--net" || arg === "--network") && containerArgs[index + 1] === "host") {
|
|
155
155
|
hostNetworkRequested = true;
|
|
156
156
|
index += 1;
|
|
157
157
|
continue;
|
|
@@ -202,11 +202,11 @@ const runContainerCommand = async ({
|
|
|
202
202
|
port,
|
|
203
203
|
multicore = false,
|
|
204
204
|
skipSetup = false,
|
|
205
|
-
|
|
205
|
+
containerArgs
|
|
206
206
|
}) => {
|
|
207
207
|
const resolvedProjectDir = resolve(projectDir);
|
|
208
208
|
const runtime = await resolveContainerRuntime(resolvedProjectDir, debug);
|
|
209
|
-
const { remainingArgs, hostNetworkRequested } = extractHostNetworkArgs(
|
|
209
|
+
const { remainingArgs, hostNetworkRequested } = extractHostNetworkArgs(containerArgs);
|
|
210
210
|
const useHostNetwork = hostNetworkRequested && process.platform === "linux";
|
|
211
211
|
const tempDir = mkdtempSync(join(tmpdir(), "defuss-ssg-container-"));
|
|
212
212
|
const volumeName = getNodeModulesVolumeName(resolvedProjectDir);
|
|
@@ -412,7 +412,7 @@ const setup = async (projectDir) => {
|
|
|
412
412
|
}
|
|
413
413
|
};
|
|
414
414
|
|
|
415
|
-
const usage = `Usage: defuss-ssg [dev|build|serve|
|
|
415
|
+
const usage = `Usage: defuss-ssg [dev|build|serve|container-dev|container-build|container-serve] [folder] [options]
|
|
416
416
|
No args => dev .
|
|
417
417
|
Single path => dev <path>
|
|
418
418
|
Single command => <command> .
|
|
@@ -423,7 +423,7 @@ const usage = `Usage: defuss-ssg [dev|build|serve|docker-dev|docker-build|docker
|
|
|
423
423
|
--port, -p <number>
|
|
424
424
|
--host, -H <host>
|
|
425
425
|
--skip-setup
|
|
426
|
-
--
|
|
426
|
+
--container-args <args...>`;
|
|
427
427
|
const isTruthy = (value) => {
|
|
428
428
|
if (!value) return false;
|
|
429
429
|
return ["1", "true", "yes", "on"].includes(value.toLowerCase());
|
|
@@ -444,9 +444,9 @@ const parsePort = (value) => {
|
|
|
444
444
|
return port;
|
|
445
445
|
};
|
|
446
446
|
const parseCliArgs = (args) => {
|
|
447
|
-
const
|
|
448
|
-
const cliArgs =
|
|
449
|
-
const
|
|
447
|
+
const containerArgsIndex = args.indexOf("--container-args");
|
|
448
|
+
const cliArgs = containerArgsIndex === -1 ? args : args.slice(0, containerArgsIndex);
|
|
449
|
+
const containerArgs = containerArgsIndex === -1 ? [] : args.slice(containerArgsIndex + 1);
|
|
450
450
|
let debug = false;
|
|
451
451
|
let multicore = false;
|
|
452
452
|
let skipSetup = isTruthy(process.env.DEFUSS_SSG_SKIP_SETUP) || isDefussWorkerProcess();
|
|
@@ -492,7 +492,7 @@ const parseCliArgs = (args) => {
|
|
|
492
492
|
}
|
|
493
493
|
return {
|
|
494
494
|
debug,
|
|
495
|
-
|
|
495
|
+
containerArgs,
|
|
496
496
|
multicore,
|
|
497
497
|
skipSetup,
|
|
498
498
|
port,
|
|
@@ -506,24 +506,24 @@ const parseCliArgs = (args) => {
|
|
|
506
506
|
"dev",
|
|
507
507
|
"build",
|
|
508
508
|
"serve",
|
|
509
|
-
"
|
|
510
|
-
"
|
|
511
|
-
"
|
|
509
|
+
"container-dev",
|
|
510
|
+
"container-build",
|
|
511
|
+
"container-serve"
|
|
512
512
|
]);
|
|
513
513
|
const containerCommands = /* @__PURE__ */ new Set([
|
|
514
|
-
"
|
|
515
|
-
"
|
|
516
|
-
"
|
|
514
|
+
"container-dev",
|
|
515
|
+
"container-build",
|
|
516
|
+
"container-serve"
|
|
517
517
|
]);
|
|
518
518
|
let debug;
|
|
519
|
-
let
|
|
519
|
+
let containerArgs;
|
|
520
520
|
let multicore;
|
|
521
521
|
let skipSetup;
|
|
522
522
|
let port;
|
|
523
523
|
let host;
|
|
524
524
|
let positional;
|
|
525
525
|
try {
|
|
526
|
-
({ debug,
|
|
526
|
+
({ debug, containerArgs, multicore, skipSetup, port, host, positional } = parseCliArgs(args));
|
|
527
527
|
} catch (error) {
|
|
528
528
|
console.error(
|
|
529
529
|
`${error instanceof Error ? error.message : "Invalid CLI arguments"}
|
|
@@ -559,9 +559,9 @@ ${usage}`
|
|
|
559
559
|
const projectDir = resolve(folder);
|
|
560
560
|
const workerProcess = isDefussWorkerProcess();
|
|
561
561
|
const isContainerCommand = containerCommands.has(command);
|
|
562
|
-
if (!isContainerCommand &&
|
|
562
|
+
if (!isContainerCommand && containerArgs.length > 0) {
|
|
563
563
|
console.error(
|
|
564
|
-
`--
|
|
564
|
+
`--container-args can only be used with container-dev, container-build, or container-serve.
|
|
565
565
|
${usage}`
|
|
566
566
|
);
|
|
567
567
|
process.exit(1);
|
|
@@ -575,7 +575,7 @@ ${usage}`
|
|
|
575
575
|
port,
|
|
576
576
|
multicore,
|
|
577
577
|
skipSetup,
|
|
578
|
-
|
|
578
|
+
containerArgs
|
|
579
579
|
});
|
|
580
580
|
return;
|
|
581
581
|
}
|
package/dist/content.d.cts
CHANGED
package/dist/content.d.mts
CHANGED
package/dist/content.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { resolve, relative, extname } from 'node:path';
|
|
|
3
3
|
import glob$1 from 'fast-glob';
|
|
4
4
|
import toml from 'toml';
|
|
5
5
|
import { parse } from 'yaml';
|
|
6
|
-
import { f as filePathToRoute } from './path-
|
|
6
|
+
import { f as filePathToRoute } from './path-j0LJZE_u.mjs';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
|
|
9
9
|
const PAGE_ROUTE_EXTENSIONS = /* @__PURE__ */ new Set([".html", ".md", ".mdx"]);
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var vite = require('./vite-
|
|
3
|
+
var vite = require('./vite-CE8Q5aF_.cjs');
|
|
4
4
|
var content = require('./content.cjs');
|
|
5
5
|
var mdx = require('@mdx-js/rollup');
|
|
6
6
|
var vite$1 = require('vite');
|
|
@@ -38,43 +38,44 @@ const dev = async ({
|
|
|
38
38
|
}) => {
|
|
39
39
|
const projectDirStatus = vite.validateProjectDir(projectDir);
|
|
40
40
|
if (projectDirStatus.code !== "OK") return projectDirStatus;
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"**/.endpoints/**",
|
|
57
|
-
"**/.rpc/**"
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
plugins: [
|
|
62
|
-
defuss({ enableJsxDevMode: true }),
|
|
63
|
-
mdx({
|
|
64
|
-
jsxImportSource: "defuss",
|
|
65
|
-
development: true,
|
|
66
|
-
remarkPlugins: config.remarkPlugins,
|
|
67
|
-
rehypePlugins: config.rehypePlugins
|
|
68
|
-
}),
|
|
69
|
-
...vite.defussSsg({
|
|
70
|
-
projectDir,
|
|
71
|
-
debug,
|
|
72
|
-
writeDevOutput
|
|
73
|
-
})
|
|
41
|
+
const initialConfig = await vite.readConfig(projectDir, debug);
|
|
42
|
+
const currentViteConfig = {
|
|
43
|
+
root: projectDir,
|
|
44
|
+
configFile: false,
|
|
45
|
+
appType: "custom",
|
|
46
|
+
server: {
|
|
47
|
+
host,
|
|
48
|
+
port,
|
|
49
|
+
watch: {
|
|
50
|
+
ignored: [
|
|
51
|
+
"**/node_modules/**",
|
|
52
|
+
"**/dist/**",
|
|
53
|
+
"**/.ssg-temp/**",
|
|
54
|
+
"**/.endpoints/**",
|
|
55
|
+
"**/.rpc/**"
|
|
74
56
|
]
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
plugins: [
|
|
60
|
+
defuss({ enableJsxDevMode: true }),
|
|
61
|
+
mdx({
|
|
62
|
+
jsxImportSource: "defuss",
|
|
63
|
+
development: true,
|
|
64
|
+
remarkPlugins: initialConfig.remarkPlugins,
|
|
65
|
+
rehypePlugins: initialConfig.rehypePlugins
|
|
66
|
+
}),
|
|
67
|
+
...vite.defussSsg({
|
|
68
|
+
projectDir,
|
|
69
|
+
debug,
|
|
70
|
+
writeDevOutput
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
};
|
|
74
|
+
const config = await vite.readConfig(projectDir, debug, {
|
|
75
|
+
currentViteConfig
|
|
76
|
+
});
|
|
77
|
+
const server = await vite$1.createServer(
|
|
78
|
+
vite.mergeUserViteConfig(currentViteConfig, config.viteConfig)
|
|
78
79
|
);
|
|
79
80
|
await server.listen(port);
|
|
80
81
|
server.printUrls();
|
|
@@ -195,11 +196,19 @@ const serve = async ({
|
|
|
195
196
|
};
|
|
196
197
|
|
|
197
198
|
exports.HTTP_METHODS = vite.HTTP_METHODS;
|
|
199
|
+
exports.SSG_CONFIG_MODULE_ID = vite.SSG_CONFIG_MODULE_ID;
|
|
200
|
+
exports.applyConfigDefaults = vite.applyConfigDefaults;
|
|
198
201
|
exports.build = vite.build;
|
|
199
202
|
exports.buildEndpoints = vite.buildEndpoints;
|
|
203
|
+
exports.clearVirtualConfigModuleState = vite.clearVirtualConfigModuleState;
|
|
204
|
+
exports.cloneConfigValue = vite.cloneConfigValue;
|
|
205
|
+
exports.compileConfigModule = vite.compileConfigModule;
|
|
200
206
|
exports.compileEndpoints = vite.compileEndpoints;
|
|
201
207
|
exports.compileRpcModule = vite.compileRpcModule;
|
|
202
208
|
exports.configDefaults = vite.configDefaults;
|
|
209
|
+
exports.createConfigModulePlugin = vite.createConfigModulePlugin;
|
|
210
|
+
exports.createConfigModuleStateKey = vite.createConfigModuleStateKey;
|
|
211
|
+
exports.createTaggedBaseViteConfig = vite.createTaggedBaseViteConfig;
|
|
203
212
|
exports.defussSsg = vite.defussSsg;
|
|
204
213
|
exports.discoverEndpointSourceFiles = vite.discoverEndpointSourceFiles;
|
|
205
214
|
exports.discoverRpcFile = vite.discoverRpcFile;
|
|
@@ -207,12 +216,20 @@ exports.endpointFileToRoute = vite.endpointFileToRoute;
|
|
|
207
216
|
exports.handleEndpointRoute = vite.handleEndpointRoute;
|
|
208
217
|
exports.handleRpcRequest = vite.handleRpcRequest;
|
|
209
218
|
exports.initializeRpc = vite.initializeRpc;
|
|
219
|
+
exports.isBareModuleId = vite.isBareModuleId;
|
|
220
|
+
exports.isPlainObject = vite.isPlainObject;
|
|
221
|
+
exports.isTaggedBaseViteConfig = vite.isTaggedBaseViteConfig;
|
|
222
|
+
exports.loadCompiledConfigModule = vite.loadCompiledConfigModule;
|
|
210
223
|
exports.loadEndpointModule = vite.loadEndpointModule;
|
|
211
224
|
exports.matchRoutePattern = vite.matchRoutePattern;
|
|
225
|
+
exports.mergeUserViteConfig = vite.mergeUserViteConfig;
|
|
212
226
|
exports.readConfig = vite.readConfig;
|
|
213
227
|
exports.registerEndpoints = vite.registerEndpoints;
|
|
228
|
+
exports.resolveConfigPath = vite.resolveConfigPath;
|
|
214
229
|
exports.resolveEndpoints = vite.resolveEndpoints;
|
|
215
230
|
exports.routeToExpressPattern = vite.routeToExpressPattern;
|
|
231
|
+
exports.setVirtualConfigModuleState = vite.setVirtualConfigModuleState;
|
|
232
|
+
exports.stripBaseViteConfigMarker = vite.stripBaseViteConfigMarker;
|
|
216
233
|
exports.glob = content.glob;
|
|
217
234
|
exports.dev = dev;
|
|
218
235
|
exports.serve = serve;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { n as SsgConfig, a as BuildOptions, p as Status, e as DevOptions, S as ServeOptions, E as EndpointRouteContext, g as EndpointRouteRegistrar } from './types-Dh8AcW7C.cjs';
|
|
2
|
+
export { B as BuildMode, C as ContainerRuntime, b as ContentEntry, c as ContentGlobOptions, D as DefussSsgViteOptions, d as DevChangeKind, f 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, o as SsgPlugin, q as StatusCode } from './types-Dh8AcW7C.cjs';
|
|
3
|
+
import { Plugin } from 'rolldown';
|
|
4
|
+
import { InlineConfig } from 'vite';
|
|
3
5
|
export { glob } from './content.cjs';
|
|
4
6
|
export { defussSsg } from './vite.cjs';
|
|
5
7
|
import 'remark-rehype';
|
|
6
8
|
import 'defuss/server';
|
|
7
|
-
import 'vite';
|
|
8
9
|
|
|
10
|
+
declare const SSG_CONFIG_MODULE_ID = "virtual:defuss-ssg/config";
|
|
11
|
+
interface ReadConfigOptions {
|
|
12
|
+
currentViteConfig?: InlineConfig;
|
|
13
|
+
}
|
|
14
|
+
type VirtualConfigModuleState = {
|
|
15
|
+
viteConfig: InlineConfig;
|
|
16
|
+
};
|
|
17
|
+
type CompiledConfigModule = {
|
|
18
|
+
entryFileName: string;
|
|
19
|
+
outputFiles: Array<{
|
|
20
|
+
fileName: string;
|
|
21
|
+
type: "asset" | "chunk";
|
|
22
|
+
content: string | Uint8Array;
|
|
23
|
+
isEntry?: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
stateKey: string;
|
|
26
|
+
};
|
|
27
|
+
declare const resolveConfigPath: (projectDir: string) => string | null;
|
|
28
|
+
declare const applyConfigDefaults: (config: SsgConfig) => SsgConfig;
|
|
29
|
+
declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
30
|
+
declare const cloneConfigValue: <T>(value: T) => T;
|
|
31
|
+
declare const createTaggedBaseViteConfig: (viteConfig?: InlineConfig) => InlineConfig;
|
|
32
|
+
declare const isTaggedBaseViteConfig: (viteConfig: unknown) => viteConfig is InlineConfig & Record<string, unknown>;
|
|
33
|
+
declare const stripBaseViteConfigMarker: (viteConfig: InlineConfig) => InlineConfig;
|
|
34
|
+
declare const setVirtualConfigModuleState: (stateKey: string, state: VirtualConfigModuleState) => void;
|
|
35
|
+
declare const clearVirtualConfigModuleState: (stateKey: string) => void;
|
|
36
|
+
declare const createConfigModuleStateKey: () => string;
|
|
37
|
+
declare const createConfigModulePlugin: (stateKey: string) => Plugin;
|
|
38
|
+
declare const isBareModuleId: (id: string) => boolean;
|
|
39
|
+
declare const compileConfigModule: (configPath: string, projectDir: string) => Promise<CompiledConfigModule>;
|
|
40
|
+
declare const loadCompiledConfigModule: (compiledConfigModule: CompiledConfigModule, configPath: string, projectDir: string, currentViteConfig?: InlineConfig) => Promise<SsgConfig>;
|
|
41
|
+
declare const mergeUserViteConfig: (currentViteConfig: InlineConfig, userViteConfig?: InlineConfig) => InlineConfig;
|
|
9
42
|
/**
|
|
10
43
|
* Reads the SSG configuration from the project directory.
|
|
11
44
|
* @param projectDir The path to the project directory.
|
|
12
45
|
* @param debug Whether to enable debug logging.
|
|
46
|
+
* @param options Optional caller-specific loader options.
|
|
13
47
|
* @returns The SSG configuration.
|
|
14
48
|
*/
|
|
15
|
-
declare const readConfig: (projectDir: string, debug: boolean) => Promise<SsgConfig>;
|
|
49
|
+
declare const readConfig: (projectDir: string, debug: boolean, options?: ReadConfigOptions) => Promise<SsgConfig>;
|
|
16
50
|
declare const configDefaults: SsgConfig;
|
|
17
51
|
|
|
18
52
|
/**
|
|
@@ -228,5 +262,11 @@ declare const handleRpcRequest: (ctx: {
|
|
|
228
262
|
request: Request;
|
|
229
263
|
}) => Promise<Response>;
|
|
230
264
|
|
|
231
|
-
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 };
|
|
232
|
-
export type { APIRoute, EndpointContext, EndpointHandler, EndpointModule, HttpMethod, ResolvedEndpoint };
|
|
265
|
+
export { BuildOptions, DevOptions, EndpointRouteContext, EndpointRouteRegistrar, HTTP_METHODS, SSG_CONFIG_MODULE_ID, ServeOptions, SsgConfig, Status, applyConfigDefaults, build, buildEndpoints, clearVirtualConfigModuleState, cloneConfigValue, compileConfigModule, compileEndpoints, compileRpcModule, configDefaults, createConfigModulePlugin, createConfigModuleStateKey, createTaggedBaseViteConfig, dev, discoverEndpointSourceFiles, discoverRpcFile, endpointFileToRoute, handleEndpointRoute, handleRpcRequest, initializeRpc, isBareModuleId, isPlainObject, isTaggedBaseViteConfig, loadCompiledConfigModule, loadEndpointModule, matchRoutePattern, mergeUserViteConfig, readConfig, registerEndpoints, resolveConfigPath, resolveEndpoints, routeToExpressPattern, serve, setVirtualConfigModuleState, stripBaseViteConfigMarker };
|
|
266
|
+
export type { APIRoute, CompiledConfigModule, EndpointContext, EndpointHandler, EndpointModule, HttpMethod, ReadConfigOptions, ResolvedEndpoint, VirtualConfigModuleState };
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
declare module "virtual:defuss-ssg/config" {
|
|
270
|
+
export const viteConfig: import("vite").InlineConfig;
|
|
271
|
+
export default viteConfig;
|
|
272
|
+
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,18 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { n as SsgConfig, a as BuildOptions, p as Status, e as DevOptions, S as ServeOptions, E as EndpointRouteContext, g as EndpointRouteRegistrar } from './types-Dh8AcW7C.mjs';
|
|
2
|
+
export { B as BuildMode, C as ContainerRuntime, b as ContentEntry, c as ContentGlobOptions, D as DefussSsgViteOptions, d as DevChangeKind, f 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, o as SsgPlugin, q as StatusCode } from './types-Dh8AcW7C.mjs';
|
|
3
|
+
import { Plugin } from 'rolldown';
|
|
4
|
+
import { InlineConfig } from 'vite';
|
|
3
5
|
export { glob } from './content.mjs';
|
|
4
6
|
export { defussSsg } from './vite.mjs';
|
|
5
7
|
import 'remark-rehype';
|
|
6
8
|
import 'defuss/server';
|
|
7
|
-
import 'vite';
|
|
8
9
|
|
|
10
|
+
declare const SSG_CONFIG_MODULE_ID = "virtual:defuss-ssg/config";
|
|
11
|
+
interface ReadConfigOptions {
|
|
12
|
+
currentViteConfig?: InlineConfig;
|
|
13
|
+
}
|
|
14
|
+
type VirtualConfigModuleState = {
|
|
15
|
+
viteConfig: InlineConfig;
|
|
16
|
+
};
|
|
17
|
+
type CompiledConfigModule = {
|
|
18
|
+
entryFileName: string;
|
|
19
|
+
outputFiles: Array<{
|
|
20
|
+
fileName: string;
|
|
21
|
+
type: "asset" | "chunk";
|
|
22
|
+
content: string | Uint8Array;
|
|
23
|
+
isEntry?: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
stateKey: string;
|
|
26
|
+
};
|
|
27
|
+
declare const resolveConfigPath: (projectDir: string) => string | null;
|
|
28
|
+
declare const applyConfigDefaults: (config: SsgConfig) => SsgConfig;
|
|
29
|
+
declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
30
|
+
declare const cloneConfigValue: <T>(value: T) => T;
|
|
31
|
+
declare const createTaggedBaseViteConfig: (viteConfig?: InlineConfig) => InlineConfig;
|
|
32
|
+
declare const isTaggedBaseViteConfig: (viteConfig: unknown) => viteConfig is InlineConfig & Record<string, unknown>;
|
|
33
|
+
declare const stripBaseViteConfigMarker: (viteConfig: InlineConfig) => InlineConfig;
|
|
34
|
+
declare const setVirtualConfigModuleState: (stateKey: string, state: VirtualConfigModuleState) => void;
|
|
35
|
+
declare const clearVirtualConfigModuleState: (stateKey: string) => void;
|
|
36
|
+
declare const createConfigModuleStateKey: () => string;
|
|
37
|
+
declare const createConfigModulePlugin: (stateKey: string) => Plugin;
|
|
38
|
+
declare const isBareModuleId: (id: string) => boolean;
|
|
39
|
+
declare const compileConfigModule: (configPath: string, projectDir: string) => Promise<CompiledConfigModule>;
|
|
40
|
+
declare const loadCompiledConfigModule: (compiledConfigModule: CompiledConfigModule, configPath: string, projectDir: string, currentViteConfig?: InlineConfig) => Promise<SsgConfig>;
|
|
41
|
+
declare const mergeUserViteConfig: (currentViteConfig: InlineConfig, userViteConfig?: InlineConfig) => InlineConfig;
|
|
9
42
|
/**
|
|
10
43
|
* Reads the SSG configuration from the project directory.
|
|
11
44
|
* @param projectDir The path to the project directory.
|
|
12
45
|
* @param debug Whether to enable debug logging.
|
|
46
|
+
* @param options Optional caller-specific loader options.
|
|
13
47
|
* @returns The SSG configuration.
|
|
14
48
|
*/
|
|
15
|
-
declare const readConfig: (projectDir: string, debug: boolean) => Promise<SsgConfig>;
|
|
49
|
+
declare const readConfig: (projectDir: string, debug: boolean, options?: ReadConfigOptions) => Promise<SsgConfig>;
|
|
16
50
|
declare const configDefaults: SsgConfig;
|
|
17
51
|
|
|
18
52
|
/**
|
|
@@ -228,5 +262,11 @@ declare const handleRpcRequest: (ctx: {
|
|
|
228
262
|
request: Request;
|
|
229
263
|
}) => Promise<Response>;
|
|
230
264
|
|
|
231
|
-
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 };
|
|
232
|
-
export type { APIRoute, EndpointContext, EndpointHandler, EndpointModule, HttpMethod, ResolvedEndpoint };
|
|
265
|
+
export { BuildOptions, DevOptions, EndpointRouteContext, EndpointRouteRegistrar, HTTP_METHODS, SSG_CONFIG_MODULE_ID, ServeOptions, SsgConfig, Status, applyConfigDefaults, build, buildEndpoints, clearVirtualConfigModuleState, cloneConfigValue, compileConfigModule, compileEndpoints, compileRpcModule, configDefaults, createConfigModulePlugin, createConfigModuleStateKey, createTaggedBaseViteConfig, dev, discoverEndpointSourceFiles, discoverRpcFile, endpointFileToRoute, handleEndpointRoute, handleRpcRequest, initializeRpc, isBareModuleId, isPlainObject, isTaggedBaseViteConfig, loadCompiledConfigModule, loadEndpointModule, matchRoutePattern, mergeUserViteConfig, readConfig, registerEndpoints, resolveConfigPath, resolveEndpoints, routeToExpressPattern, serve, setVirtualConfigModuleState, stripBaseViteConfigMarker };
|
|
266
|
+
export type { APIRoute, CompiledConfigModule, EndpointContext, EndpointHandler, EndpointModule, HttpMethod, ReadConfigOptions, ResolvedEndpoint, VirtualConfigModuleState };
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
declare module "virtual:defuss-ssg/config" {
|
|
270
|
+
export const viteConfig: import("vite").InlineConfig;
|
|
271
|
+
export default viteConfig;
|
|
272
|
+
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { H as HTTP_METHODS, b as build,
|
|
1
|
+
export { H as HTTP_METHODS, S as SSG_CONFIG_MODULE_ID, a as applyConfigDefaults, b as build, c as buildEndpoints, d as clearVirtualConfigModuleState, e as cloneConfigValue, f as compileConfigModule, g as compileEndpoints, h as compileRpcModule, i as configDefaults, j as createConfigModulePlugin, k as createConfigModuleStateKey, l as createTaggedBaseViteConfig, n as defussSsg, o as discoverEndpointSourceFiles, p as discoverRpcFile, q as endpointFileToRoute, r as handleEndpointRoute, s as handleRpcRequest, t as initializeRpc, u as isBareModuleId, v as isPlainObject, w as isTaggedBaseViteConfig, x as loadCompiledConfigModule, y as loadEndpointModule, z as matchRoutePattern, A as mergeUserViteConfig, B as readConfig, D as registerEndpoints, E as resolveConfigPath, F as resolveEndpoints, G as routeToExpressPattern, J as setVirtualConfigModuleState, K as stripBaseViteConfigMarker } from './vite-bKsy4atm.mjs';
|
|
2
2
|
export { glob } from './content.mjs';
|
|
3
|
-
export { d as dev, s as serve } from './serve-
|
|
3
|
+
export { d as dev, s as serve } from './serve-qxXVqJiL.mjs';
|
|
4
4
|
import 'fast-glob';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:fs/promises';
|
|
@@ -22,7 +22,7 @@ import 'remark-gfm';
|
|
|
22
22
|
import 'remark-parse';
|
|
23
23
|
import 'remark-rehype';
|
|
24
24
|
import 'remark-mdx-frontmatter';
|
|
25
|
-
import './path-
|
|
25
|
+
import './path-j0LJZE_u.mjs';
|
|
26
26
|
import 'toml';
|
|
27
27
|
import 'yaml';
|
|
28
28
|
import 'node:process';
|
|
@@ -168,4 +168,4 @@ const filePathToRoute = (filePath, config, cwd) => {
|
|
|
168
168
|
return routePath;
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
export { resolvePreferredPageSourceForOutputPath as a,
|
|
171
|
+
export { resolvePreferredPageSourceForOutputPath as a, resolveSsgPaths as b, filePathToRoute as f, getPageSourceRootDir as g, pageSourceFileToOutputPath as p, resolvePageSourceFileForPath as r, selectPreferredPageSourceFiles as s };
|