defuss-ssg 0.7.4 → 0.7.5

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.mjs CHANGED
@@ -6,7 +6,7 @@ import { mkdtempSync, writeFileSync, rmSync, existsSync, readFileSync } from 'no
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-Mjyd3sxP.mjs';
9
+ import { d as dev, s as serve } from './serve-DntKJagW.mjs';
10
10
  import 'fast-glob';
11
11
  import 'node:fs/promises';
12
12
  import 'defuss/server';
package/dist/index.cjs CHANGED
@@ -46,6 +46,7 @@ const dev = async ({
46
46
  server: {
47
47
  host,
48
48
  port,
49
+ strictPort: false,
49
50
  watch: {
50
51
  ignored: [
51
52
  "**/node_modules/**",
@@ -79,6 +80,15 @@ const dev = async ({
79
80
  vite.mergeUserViteConfig(currentViteConfig, config.viteConfig)
80
81
  );
81
82
  await server.listen(port);
83
+ const resolvedPort = server.httpServer?.address();
84
+ const actualPort = typeof resolvedPort === "object" && resolvedPort ? resolvedPort.port : port;
85
+ if (actualPort !== port) {
86
+ console.log(`[defuss-ssg] port ${port} in use, using ${actualPort} instead`);
87
+ try {
88
+ node_fs.writeFileSync(node_path.join(projectDir, ".defuss-port"), String(actualPort));
89
+ } catch {
90
+ }
91
+ }
82
92
  server.printUrls();
83
93
  return {
84
94
  code: "OK",
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
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-7imK29Sk.mjs';
2
2
  export { glob } from './content.mjs';
3
- export { d as dev, s as serve } from './serve-Mjyd3sxP.mjs';
3
+ export { d as dev, s as serve } from './serve-DntKJagW.mjs';
4
4
  import 'fast-glob';
5
5
  import 'node:fs';
6
6
  import 'node:fs/promises';
@@ -1,9 +1,9 @@
1
1
  import mdx from '@mdx-js/rollup';
2
2
  import { createServer } from 'vite';
3
3
  import defuss from 'defuss-vite';
4
- import { L as validateProjectDir, B as readConfig, n as defussSsg, A as mergeUserViteConfig, D as registerEndpoints, t as initializeRpc, C as readIncomingBody, m as createWebRequest, s as handleRpcRequest, I as sendWebResponse } from './vite-7imK29Sk.mjs';
5
- import { existsSync } from 'node:fs';
4
+ import { writeFileSync, existsSync } from 'node:fs';
6
5
  import { join } from 'node:path';
6
+ import { L as validateProjectDir, B as readConfig, n as defussSsg, A as mergeUserViteConfig, D as registerEndpoints, t as initializeRpc, C as readIncomingBody, m as createWebRequest, s as handleRpcRequest, I as sendWebResponse } from './vite-7imK29Sk.mjs';
7
7
  import process from 'node:process';
8
8
  import { express, startServer } from 'defuss-express';
9
9
 
@@ -24,6 +24,7 @@ const dev = async ({
24
24
  server: {
25
25
  host,
26
26
  port,
27
+ strictPort: false,
27
28
  watch: {
28
29
  ignored: [
29
30
  "**/node_modules/**",
@@ -57,6 +58,15 @@ const dev = async ({
57
58
  mergeUserViteConfig(currentViteConfig, config.viteConfig)
58
59
  );
59
60
  await server.listen(port);
61
+ const resolvedPort = server.httpServer?.address();
62
+ const actualPort = typeof resolvedPort === "object" && resolvedPort ? resolvedPort.port : port;
63
+ if (actualPort !== port) {
64
+ console.log(`[defuss-ssg] port ${port} in use, using ${actualPort} instead`);
65
+ try {
66
+ writeFileSync(join(projectDir, ".defuss-port"), String(actualPort));
67
+ } catch {
68
+ }
69
+ }
60
70
  server.printUrls();
61
71
  return {
62
72
  code: "OK",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "defuss-ssg",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -136,4 +136,4 @@
136
136
  "typescript": "^5.9.3",
137
137
  "vitest": "^4.0.17"
138
138
  }
139
- }
139
+ }