@docubook/flame 1.3.6 → 1.3.8

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.
@@ -82,7 +82,7 @@ async function renderDocsPage(
82
82
  rawMdx: string,
83
83
  filePath: string,
84
84
  gitDates?: Map<string, string>,
85
- builder?: BuildPluginBuilder,
85
+ builder?: BuildPluginBuilder | null,
86
86
  nonce?: string
87
87
  ): Promise<string> {
88
88
  let content = rawMdx;
@@ -218,10 +218,10 @@ async function build() {
218
218
  };
219
219
  }
220
220
 
221
- const hasPlugins = !!docuConfig.plugins?.length;
222
- const builder = hasPlugins ? new BuildPluginBuilder(docuConfig) : null;
223
- if (hasPlugins && builder) {
224
- const plugins = await loadPlugins(docuConfig.plugins!);
221
+ const pluginsConfig = docuConfig.plugins ?? [];
222
+ const builder = pluginsConfig.length > 0 ? new BuildPluginBuilder(docuConfig) : null;
223
+ if (builder) {
224
+ const plugins = await loadPlugins(pluginsConfig);
225
225
  for (const plugin of plugins) {
226
226
  await plugin.setup(builder);
227
227
  }
@@ -19,7 +19,9 @@ import { wrapPluginResponse } from "./security";
19
19
 
20
20
  const docuConfig = loadDocuConfig();
21
21
 
22
- const PORT = Number(process.env.PORT ?? 3000);
22
+ const parsedPort = parseInt(process.env.PORT ?? "3000", 10);
23
+ const PORT =
24
+ Number.isInteger(parsedPort) && parsedPort > 0 && parsedPort <= 65535 ? parsedPort : 3000;
23
25
 
24
26
  logger.buildStart();
25
27
 
@@ -40,10 +42,12 @@ logger.indexDone(records, Math.round(performance.now() - t));
40
42
  logger.routes();
41
43
 
42
44
  // Plugin setup — all hooks active (onLoad, remark/rehype, frontmatter, head/body, html transform, handleRequest)
43
- const hasPlugins = !!docuConfig.plugins?.length;
44
- const builder = hasPlugins ? new BuildPluginBuilder(docuConfig) : null;
45
- if (hasPlugins && builder) {
46
- const plugins = await loadPlugins(docuConfig.plugins!);
45
+ const pluginsConfig = docuConfig.plugins ?? [];
46
+ const builder = pluginsConfig.length > 0 ? new BuildPluginBuilder(docuConfig) : null;
47
+
48
+ if (builder) {
49
+ const plugins = await loadPlugins(pluginsConfig);
50
+
47
51
  for (const plugin of plugins) {
48
52
  await plugin.setup(builder);
49
53
  }
@@ -193,4 +197,4 @@ const server = Bun.serve({
193
197
  },
194
198
  });
195
199
 
196
- logger.ready(server.port!, true);
200
+ logger.ready(server.port ?? PORT, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docubook/flame",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "description": "A blazing-fast React + MDX framework powered by Bun, built for modern documentation experiences.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -54,8 +54,8 @@
54
54
  "unified": "^11.0.0",
55
55
  "@docubook/core": "^1.7.2",
56
56
  "@docubook/mdx-content": "^3.2.2",
57
- "@docubook/ui-react": "^0.1.4",
58
- "@docubook/themes-colors": "^0.10.2"
57
+ "@docubook/themes-colors": "^0.10.2",
58
+ "@docubook/ui-react": "^0.1.4"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@sentry/bun": "^10.0.0"