reroute-js 1.0.0-alpha.44 → 1.0.0-alpha.45
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 +2 -2
- package/_/blog/src/client/routes/markdown.tsx +10 -2
- package/cli/bin.d.ts +1 -1
- package/cli/bin.js +7 -7
- package/cli/bin.js.map +2 -2
- package/cli/index.d.ts +1 -1
- package/cli/index.js +5 -5
- package/cli/index.js.map +2 -2
- package/cli/src/cli.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts +1 -1
- package/cli/src/commands/build.d.ts +1 -1
- package/cli/src/commands/dev.d.ts +1 -1
- package/cli/src/commands/gen.d.ts +1 -1
- package/cli/src/commands/index.d.ts +1 -1
- package/cli/src/commands/init.d.ts +1 -1
- package/cli/src/commands/lib/assets.d.ts +1 -1
- package/cli/src/commands/lib/bundler.d.ts +1 -1
- package/cli/src/commands/lib/command.d.ts +1 -1
- package/cli/src/commands/lib/env.d.ts +1 -1
- package/cli/src/commands/lib/images.d.ts +1 -1
- package/cli/src/commands/lib/index.d.ts +1 -1
- package/cli/src/commands/lib/log.d.ts +1 -1
- package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
- package/cli/src/commands/lib/markdown/index.d.ts +1 -1
- package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
- package/cli/src/commands/lib/prerender.d.ts +1 -1
- package/cli/src/commands/lib/production.d.ts +1 -1
- package/cli/src/commands/lib/routes.d.ts +1 -1
- package/cli/src/commands/lib/server.d.ts +1 -1
- package/cli/src/commands/lib/ssr-strip.d.ts +1 -1
- package/cli/src/commands/lib/static.d.ts +1 -1
- package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
- package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
- package/cli/src/commands/lib/supervise.d.ts +1 -1
- package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
- package/cli/src/commands/lib/theme.d.ts +1 -1
- package/cli/src/commands/lib/version.d.ts +1 -1
- package/cli/src/commands/lib/watch.d.ts +1 -1
- package/cli/src/commands/og.d.ts +1 -1
- package/cli/src/commands/start.d.ts +1 -1
- package/cli/src/commands/static-render.d.ts +1 -1
- package/cli/src/index.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +2 -2
- package/core/index.js.map +1 -1
- package/core/src/app-paths.d.ts +1 -1
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +1 -1
- package/core/src/content/discovery.d.ts +1 -1
- package/core/src/content/index.d.ts +1 -1
- package/core/src/content/metadata.d.ts +1 -1
- package/core/src/i18n/catalog.d.ts +1 -1
- package/core/src/i18n/discover.d.ts +1 -1
- package/core/src/i18n/index.d.ts +1 -1
- package/core/src/i18n/messages.d.ts +1 -1
- package/core/src/i18n/negotiate.d.ts +1 -1
- package/core/src/i18n/pathname.d.ts +1 -1
- package/core/src/i18n/resolve.d.ts +1 -1
- package/core/src/i18n/types.d.ts +1 -1
- package/core/src/image.d.ts +1 -1
- package/core/src/index.d.ts +1 -1
- package/core/src/llms/discovery.d.ts +1 -1
- package/core/src/llms/extractor.d.ts +1 -1
- package/core/src/llms/formatter.d.ts +1 -1
- package/core/src/llms/full-generator.d.ts +1 -1
- package/core/src/llms/index-generator.d.ts +1 -1
- package/core/src/llms/index.d.ts +1 -1
- package/core/src/og/discovery.d.ts +1 -1
- package/core/src/og/index.d.ts +1 -1
- package/core/src/og/meta.d.ts +1 -1
- package/core/src/og/render.d.ts +1 -1
- package/core/src/og/types.d.ts +1 -1
- package/core/src/robots/discovery.d.ts +1 -1
- package/core/src/robots/generator.d.ts +1 -1
- package/core/src/robots/index.d.ts +1 -1
- package/core/src/robots/policies.d.ts +1 -1
- package/core/src/rss/discovery.d.ts +1 -1
- package/core/src/rss/generator.d.ts +1 -1
- package/core/src/rss/index.d.ts +1 -1
- package/core/src/sitemap/discovery.d.ts +1 -1
- package/core/src/sitemap/generator.d.ts +1 -1
- package/core/src/sitemap/index.d.ts +1 -1
- package/core/src/ssr/index.d.ts +1 -1
- package/core/src/ssr/lib/cache.d.ts +1 -1
- package/core/src/ssr/lib/cleanup.d.ts +1 -1
- package/core/src/ssr/lib/collections.d.ts +1 -1
- package/core/src/ssr/lib/compression.d.ts +1 -1
- package/core/src/ssr/lib/compute/content.d.ts +1 -1
- package/core/src/ssr/lib/compute/index.d.ts +1 -1
- package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
- package/core/src/ssr/lib/compute/routes.d.ts +1 -1
- package/core/src/ssr/lib/content-path.d.ts +1 -1
- package/core/src/ssr/lib/data.d.ts +1 -1
- package/core/src/ssr/lib/html.d.ts +1 -1
- package/core/src/ssr/lib/imports.d.ts +1 -1
- package/core/src/ssr/lib/index.d.ts +1 -1
- package/core/src/ssr/lib/layouts.d.ts +1 -1
- package/core/src/ssr/lib/metadata.d.ts +1 -1
- package/core/src/ssr/lib/mime.d.ts +1 -1
- package/core/src/ssr/lib/modules.d.ts +1 -1
- package/core/src/ssr/lib/path.d.ts +1 -1
- package/core/src/ssr/lib/preload.d.ts +1 -1
- package/core/src/ssr/lib/route-match.d.ts +1 -1
- package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
- package/core/src/ssr/lib/scripts/data.d.ts +1 -1
- package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
- package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
- package/core/src/ssr/lib/scripts/index.d.ts +1 -1
- package/core/src/ssr/lib/seed.d.ts +1 -1
- package/core/src/ssr/lib/serialize.d.ts +1 -1
- package/core/src/ssr/lib/setup.d.ts +1 -1
- package/core/src/ssr/lib/styles.d.ts +1 -1
- package/core/src/ssr/lib/template.d.ts +1 -1
- package/core/src/ssr/lib/types.d.ts +1 -1
- package/core/src/ssr/render.d.ts +1 -1
- package/core/src/ssr/stream.d.ts +1 -1
- package/elysia/index.d.ts +1 -1
- package/elysia/index.js +2 -2
- package/elysia/index.js.map +1 -1
- package/elysia/src/index.d.ts +1 -1
- package/elysia/src/libs/assets.d.ts +1 -1
- package/elysia/src/libs/cache.d.ts +1 -1
- package/elysia/src/libs/caching.d.ts +1 -1
- package/elysia/src/libs/devReload.d.ts +1 -1
- package/elysia/src/libs/http.d.ts +1 -1
- package/elysia/src/libs/i18n.d.ts +1 -1
- package/elysia/src/libs/image.d.ts +1 -1
- package/elysia/src/libs/index.d.ts +1 -1
- package/elysia/src/libs/lazyData.d.ts +1 -1
- package/elysia/src/libs/llms.d.ts +1 -1
- package/elysia/src/libs/response.d.ts +1 -1
- package/elysia/src/libs/serving.d.ts +1 -1
- package/elysia/src/plugin.d.ts +1 -1
- package/elysia/src/routes/artifacts.d.ts +1 -1
- package/elysia/src/routes/content.d.ts +1 -1
- package/elysia/src/routes/image.d.ts +1 -1
- package/elysia/src/routes/index.d.ts +1 -1
- package/elysia/src/routes/internal.d.ts +1 -1
- package/elysia/src/routes/liveReloadClient.d.ts +1 -1
- package/elysia/src/routes/llms.d.ts +1 -1
- package/elysia/src/routes/og.d.ts +1 -1
- package/elysia/src/routes/redirects.d.ts +1 -1
- package/elysia/src/routes/robots.d.ts +1 -1
- package/elysia/src/routes/rss.d.ts +1 -1
- package/elysia/src/routes/search.d.ts +1 -1
- package/elysia/src/routes/sitemap.d.ts +1 -1
- package/elysia/src/routes/ssr.d.ts +1 -1
- package/elysia/src/routes/static.d.ts +1 -1
- package/elysia/src/routes/themeCssRefresh.d.ts +1 -1
- package/elysia/src/types.d.ts +1 -1
- package/package.json +5 -1
- package/react/index.d.ts +1 -1
- package/react/index.js +4 -37
- package/react/index.js.map +3 -4
- package/react/markdown.d.ts +11 -0
- package/react/markdown.d.ts.map +1 -0
- package/react/markdown.js +47 -0
- package/react/markdown.js.map +10 -0
- package/react/src/components/ClientOnly.d.ts +1 -1
- package/react/src/components/ContentRoute.d.ts +1 -1
- package/react/src/components/Image.d.ts +1 -1
- package/react/src/components/LazyRoute.d.ts +1 -1
- package/react/src/components/Link.d.ts +1 -1
- package/react/src/components/Markdown.d.ts +2 -2
- package/react/src/components/Outlet.d.ts +1 -1
- package/react/src/components/index.d.ts +1 -2
- package/react/src/components/index.d.ts.map +1 -1
- package/react/src/hooks/index.d.ts +1 -1
- package/react/src/hooks/useContent.d.ts +1 -1
- package/react/src/hooks/useData.d.ts +1 -1
- package/react/src/hooks/useFeed.d.ts +1 -1
- package/react/src/hooks/useLayoutData.d.ts +1 -1
- package/react/src/hooks/useLlms.d.ts +1 -1
- package/react/src/hooks/useNavigate.d.ts +1 -1
- package/react/src/hooks/useParams.d.ts +1 -1
- package/react/src/hooks/useRouter.d.ts +1 -1
- package/react/src/hooks/useSearch.d.ts +1 -1
- package/react/src/hooks/useSearchParams.d.ts +1 -1
- package/react/src/hooks/useToc.d.ts +1 -1
- package/react/src/i18n/LocaleProvider.d.ts +1 -1
- package/react/src/i18n/helpers.d.ts +1 -1
- package/react/src/i18n/index.d.ts +1 -1
- package/react/src/index.d.ts +1 -1
- package/react/src/lib/bundle.d.ts +1 -1
- package/react/src/lib/collection.d.ts +1 -1
- package/react/src/lib/content.d.ts +1 -1
- package/react/src/lib/head.d.ts +1 -1
- package/react/src/lib/index.d.ts +1 -1
- package/react/src/lib/layouts.d.ts +1 -1
- package/react/src/lib/lazy-route.d.ts +1 -1
- package/react/src/lib/route-loader.d.ts +1 -1
- package/react/src/lib/static-data.d.ts +1 -1
- package/react/src/providers/ContentProvider.d.ts +1 -1
- package/react/src/providers/RerouteProvider.d.ts +1 -1
- package/react/src/providers/RouterProvider.d.ts +1 -1
- package/react/src/providers/index.d.ts +1 -1
- package/react/src/types/any.d.ts +1 -1
- package/react/src/types/index.d.ts +1 -1
- package/react/src/types/router.d.ts +1 -1
- package/telemetry/react.d.ts +1 -1
- package/telemetry/react.js +2 -2
- package/telemetry/react.js.map +1 -1
- package/telemetry/server.d.ts +1 -1
- package/telemetry/server.js +2 -2
- package/telemetry/server.js.map +1 -1
- package/telemetry/src/react/api.d.ts +1 -1
- package/telemetry/src/react/context.d.ts +1 -1
- package/telemetry/src/react/index.d.ts +1 -1
- package/telemetry/src/react/telemetry.d.ts +1 -1
- package/telemetry/src/server/context.d.ts +1 -1
- package/telemetry/src/server/headers/extractor.d.ts +1 -1
- package/telemetry/src/server/headers/index.d.ts +1 -1
- package/telemetry/src/server/headers/presets.d.ts +1 -1
- package/telemetry/src/server/index.d.ts +1 -1
- package/telemetry/src/server/instrumentation.d.ts +1 -1
- package/telemetry/src/server/plugin.d.ts +1 -1
- package/telemetry/src/server/sourcemap.d.ts +1 -1
package/cli/index.d.ts
CHANGED
package/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v1.0.0-alpha.
|
|
2
|
+
* reroute-js v1.0.0-alpha.45
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -1024,7 +1024,7 @@ export const ssr = {
|
|
|
1024
1024
|
const pluginsPropsStr = [remarkPluginsStr, rehypePluginsStr, componentsStr].filter(Boolean).join(`
|
|
1025
1025
|
`);
|
|
1026
1026
|
return `// Generated from markdown file
|
|
1027
|
-
import { Markdown } from 'reroute-js/react';
|
|
1027
|
+
import { Markdown } from 'reroute-js/react/markdown';
|
|
1028
1028
|
${pluginImportsStr}
|
|
1029
1029
|
const meta = ${JSON.stringify(frontmatter, null, 2)};
|
|
1030
1030
|
|
|
@@ -1295,7 +1295,7 @@ async function getVersionString() {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
async function getVersion() {
|
|
1297
1297
|
if (true) {
|
|
1298
|
-
return "1.0.0-alpha.
|
|
1298
|
+
return "1.0.0-alpha.45";
|
|
1299
1299
|
}
|
|
1300
1300
|
const possiblePaths = [
|
|
1301
1301
|
path2.join(import.meta.dir, "../../../../package.json"),
|
|
@@ -1313,7 +1313,7 @@ async function getVersion() {
|
|
|
1313
1313
|
}
|
|
1314
1314
|
async function getCommit() {
|
|
1315
1315
|
if (true) {
|
|
1316
|
-
return "
|
|
1316
|
+
return "fa2aceb";
|
|
1317
1317
|
}
|
|
1318
1318
|
return "dev";
|
|
1319
1319
|
}
|
|
@@ -1345,4 +1345,4 @@ export {
|
|
|
1345
1345
|
waitForServerReady
|
|
1346
1346
|
};
|
|
1347
1347
|
|
|
1348
|
-
//# debugId=
|
|
1348
|
+
//# debugId=71A8AD78AD69FA4D64756E2164756E21
|
package/cli/index.js.map
CHANGED
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * Get the reroute command to execute\n * Handles both development mode (running from source) and installed mode\n */\nexport function getRerouteCommand(): string {\n\t// Check if we're running from source (development mode)\n\t// Look for bin.ts in the expected location relative to this file\n\tconst binPath = join(import.meta.dir, '..', '..', 'bin.ts');\n\tconst isBunDev = existsSync(binPath);\n\n\tif (isBunDev) {\n\t\t// Running via bun during development from source\n\t\treturn `bun ${binPath}`;\n\t}\n\n\t// Check for reroute binary in node_modules/.bin, checking up to 3 levels up\n\tconst cwd = process.cwd();\n\tconst nodeModulesPaths = [\n\t\tjoin(cwd, 'node_modules', '.bin', 'reroute'),\n\t\tjoin(cwd, '..', 'node_modules', '.bin', 'reroute'),\n\t\tjoin(cwd, '..', '..', 'node_modules', '.bin', 'reroute'),\n\t\tjoin(cwd, '..', '..', '..', 'node_modules', '.bin', 'reroute'),\n\t];\n\n\tfor (const binPath of nodeModulesPaths) {\n\t\tif (existsSync(binPath)) {\n\t\t\treturn binPath;\n\t\t}\n\t}\n\n\t// Fallback: assume reroute is installed globally and available in PATH\n\treturn 'reroute';\n}\n",
|
|
56
56
|
"/**\n * Log colorization utilities\n *\n * Provides colorization for log prefixes in both blessed (TUI) and ANSI (console) formats.\n * Consumers can use [api] and [app] prefixes to differentiate their application logs.\n */\n\n/**\n * Map of prefix patterns to blessed color tags\n * Each prefix has a unique color for easy visual distinction\n */\nconst PREFIX_COLORS: Record<string, string> = {\n\t'[reroute]': '{cyan-fg}', // Base reroute logs - cyan\n\t'[reroute/gen]': '{bright-blue-fg}', // Generator - bright blue\n\t'[reroute/content]': '{magenta-fg}', // Content - magenta\n\t'[reroute/markdown]': '{yellow-fg}', // Markdown - yellow\n\t'[reroute/theme]': '{red-fg}', // Theme CSS - red\n\t'[reroute/mdx]': '{bright-red-fg}', // MDX - bright red\n\t'[reroute/dev]': '{green-fg}', // Dev command - green\n\t'[reroute/start]': '{bright-cyan-fg}', // Start command - bright cyan\n\t'[reroute/build]': '{bright-magenta-fg}', // Build command - bright magenta\n\t'[reroute/analyze]': '{bright-green-fg}', // Analyze command - bright green\n\t'[api]': '{blue-fg}', // API logs - blue\n\t'[app]': '{bright-green-fg}', // App logs - bright green\n};\n\n/**\n * Colorize log prefixes using blessed color tags (for TUI output)\n *\n * @param text - The log text to colorize\n * @returns Text with colorized prefixes using blessed tags\n */\nexport function colorizeLogPrefix(text: string): string {\n\tlet colored = text;\n\t// Sort prefixes by length (longest first) to match more specific prefixes before general ones\n\t// e.g., [reroute/markdown] should match before [reroute]\n\tconst sortedPrefixes = Object.entries(PREFIX_COLORS).sort(\n\t\t([a], [b]) => b.length - a.length,\n\t);\n\n\tfor (const [prefix, colorTag] of sortedPrefixes) {\n\t\t// Replace prefix with colored version\n\t\tcolored = colored.replace(\n\t\t\tnew RegExp(`(${prefix.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')})`, 'g'),\n\t\t\t`${colorTag}$1{/}`,\n\t\t);\n\t}\n\n\treturn colored;\n}\n\n/**\n * Convert blessed color tags to ANSI escape codes (for console output)\n *\n * @param text - Text with blessed color tags\n * @returns Text with ANSI escape codes\n */\nexport function blessedToAnsi(text: string): string {\n\treturn (\n\t\ttext\n\t\t\t// Standard colors\n\t\t\t.replace(/\\{cyan-fg\\}/g, '\\x1b[36m')\n\t\t\t.replace(/\\{blue-fg\\}/g, '\\x1b[34m')\n\t\t\t.replace(/\\{magenta-fg\\}/g, '\\x1b[35m')\n\t\t\t.replace(/\\{yellow-fg\\}/g, '\\x1b[33m')\n\t\t\t.replace(/\\{green-fg\\}/g, '\\x1b[32m')\n\t\t\t.replace(/\\{red-fg\\}/g, '\\x1b[31m')\n\t\t\t// Bright colors\n\t\t\t.replace(/\\{bright-cyan-fg\\}/g, '\\x1b[96m')\n\t\t\t.replace(/\\{bright-blue-fg\\}/g, '\\x1b[94m')\n\t\t\t.replace(/\\{bright-magenta-fg\\}/g, '\\x1b[95m')\n\t\t\t.replace(/\\{bright-yellow-fg\\}/g, '\\x1b[93m')\n\t\t\t.replace(/\\{bright-green-fg\\}/g, '\\x1b[92m')\n\t\t\t.replace(/\\{bright-red-fg\\}/g, '\\x1b[91m')\n\t\t\t.replace(/\\{\\/\\}/g, '\\x1b[0m')\n\t);\n}\n\n/**\n * Colorize log prefixes and convert to ANSI codes (for console output)\n *\n * @param text - The log text to colorize\n * @returns Text with colorized prefixes using ANSI escape codes\n */\nexport function colorizeLogPrefixAnsi(text: string): string {\n\treturn blessedToAnsi(colorizeLogPrefix(text));\n}\n\n/**\n * Create a handler function for server output that colorizes logs\n *\n * @param buffer - Reference to a buffer string for incomplete lines\n * @returns Handler function for Buffer data\n */\nexport function createServerOutputHandler(buffer: { current: string }) {\n\treturn (data: Buffer) => {\n\t\tconst text = buffer.current + data.toString();\n\t\tconst lines = text.split('\\n');\n\t\tbuffer.current = lines.pop() || ''; // Keep last incomplete line\n\n\t\tfor (const line of lines) {\n\t\t\t// Skip empty lines\n\t\t\tconst trimmedLine = line.trim();\n\t\t\tif (!trimmedLine) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Colorize the line (preserves existing prefixes or leaves unprefixed lines as-is)\n\t\t\tconst ansiColored = colorizeLogPrefixAnsi(line);\n\t\t\tconsole.log(ansiColored);\n\t\t}\n\t};\n}\n",
|
|
57
57
|
"/**\n * Markdown integration utility\n *\n * Manages markdown and syntax highlighting packages for the Reroute framework\n */\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\n\n/**\n * Check if a package is available in package.json, searching up to 5 parent directories\n */\nfunction isPackageAvailable(cwd: string, packageName: string): boolean {\n\tlet currentDir = cwd;\n\n\t// Check up to 5 levels up\n\tfor (let i = 0; i < 5; i++) {\n\t\tconst packageJsonPath = join(currentDir, 'package.json');\n\n\t\tif (existsSync(packageJsonPath)) {\n\t\t\ttry {\n\t\t\t\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n\t\t\t\tconst deps = {\n\t\t\t\t\t...packageJson.dependencies,\n\t\t\t\t\t...packageJson.devDependencies,\n\t\t\t\t\t...packageJson.peerDependencies,\n\t\t\t\t};\n\n\t\t\t\tif (packageName in deps) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Continue to parent directory\n\t\t\t}\n\t\t}\n\n\t\tconst parentDir = dirname(currentDir);\n\t\t// Stop if we've reached the root\n\t\tif (parentDir === currentDir) {\n\t\t\tbreak;\n\t\t}\n\t\tcurrentDir = parentDir;\n\t}\n\n\treturn false;\n}\n\n/**\n * Check if streamdown is available in the project\n */\nfunction isStreamdownAvailable(cwd: string): boolean {\n\treturn isPackageAvailable(cwd, 'streamdown');\n}\n\n/**\n * Check if Shiki is available in the project (deprecated: now built into streamdown)\n */\nfunction isShikiAvailable(cwd: string): boolean {\n\treturn isPackageAvailable(cwd, '@shikijs/rehype');\n}\n\n/**\n * @deprecated Streamdown includes GFM support built-in\n * Check if remark-gfm (GitHub Flavored Markdown) is available\n */\nfunction isRemarkGfmAvailable(cwd: string): boolean {\n\treturn isPackageAvailable(cwd, 'remark-gfm');\n}\n\n/**\n * Check if @mdx-js/mdx is available in the project\n */\nfunction isMdxAvailable(cwd: string): boolean {\n\treturn isPackageAvailable(cwd, '@mdx-js/mdx');\n}\n\n/**\n * Get markdown configuration status for the project\n */\nexport function getMarkdownConfig(cwd: string) {\n\tconst hasStreamdown = isStreamdownAvailable(cwd);\n\tconst hasShiki = isShikiAvailable(cwd);\n\tconst hasRemarkGfm = isRemarkGfmAvailable(cwd);\n\tconst hasMdx = isMdxAvailable(cwd);\n\n\treturn {\n\t\thasStreamdown,\n\t\thasShiki,\n\t\thasRemarkGfm,\n\t\thasMdx,\n\t\tisConfigured: hasStreamdown,\n\t};\n}\n\n/**\n * Log markdown configuration status\n */\nexport function logMarkdownStatus(cwd: string): void {\n\tconst config = getMarkdownConfig(cwd);\n\n\tif (config.isConfigured) {\n\t\tconsole.log(\n\t\t\t'[reroute/markdown] Streamdown available (GFM, syntax highlighting, math, mermaid built-in)',\n\t\t);\n\t\tif (config.hasMdx) {\n\t\t\tconsole.log('[reroute/markdown] MDX compiler enabled (JSX in markdown)');\n\t\t}\n\t}\n}\n\n/**\n * Check if markdown packages are configured and log status\n */\nexport function checkMarkdownIfConfigured(cwd: string): boolean {\n\ttry {\n\t\tconst config = getMarkdownConfig(cwd);\n\t\tif (config.isConfigured) {\n\t\t\tlogMarkdownStatus(cwd);\n\t\t}\n\t\treturn config.isConfigured;\n\t} catch (e) {\n\t\tconsole.warn('[reroute/markdown] check failed:', e);\n\t\treturn false;\n\t}\n}\n",
|
|
58
|
-
"/**\n * Markdown/MDX processor for route files\n *\n * Processes .md and .mdx files with frontmatter support for use in the routing system\n */\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { basename, dirname, extname, join, relative, resolve } from 'node:path';\nimport matter from 'gray-matter';\n\n// biome-ignore lint/suspicious/noExplicitAny: yes\ntype Any = any;\n\n/**\n * HTML attribute to JSX prop mapping\n */\nconst htmlToJsxAttributes: Record<string, string> = {\n\tclass: 'className',\n\tfor: 'htmlFor',\n\t'accept-charset': 'acceptCharset',\n\t'http-equiv': 'httpEquiv',\n\taccesskey: 'accessKey',\n\tcontenteditable: 'contentEditable',\n\tcrossorigin: 'crossOrigin',\n\ttabindex: 'tabIndex',\n\t// SVG attributes\n\t'stroke-width': 'strokeWidth',\n\t'stroke-linecap': 'strokeLinecap',\n\t'stroke-linejoin': 'strokeLinejoin',\n\t'stroke-miterlimit': 'strokeMiterlimit',\n\t'stroke-dasharray': 'strokeDasharray',\n\t'stroke-dashoffset': 'strokeDashoffset',\n\t'stroke-opacity': 'strokeOpacity',\n\t'fill-opacity': 'fillOpacity',\n\t'fill-rule': 'fillRule',\n\t'clip-path': 'clipPath',\n\t'clip-rule': 'clipRule',\n\t'font-family': 'fontFamily',\n\t'font-size': 'fontSize',\n\t'font-weight': 'fontWeight',\n\t'text-anchor': 'textAnchor',\n\t'text-decoration': 'textDecoration',\n\t'vector-effect': 'vectorEffect',\n};\n\nfunction convertPropertiesToJsx(\n\tproperties: Record<string, Any>,\n): Record<string, Any> {\n\tconst newProperties: Record<string, Any> = {};\n\tfor (const [key, value] of Object.entries(properties)) {\n\t\tconst jsxKey = htmlToJsxAttributes[key] || key;\n\t\tnewProperties[jsxKey] = value;\n\t}\n\treturn newProperties;\n}\n\nfunction visitNode(node: Any): void {\n\tif (node.type === 'element' && node.properties) {\n\t\tnode.properties = convertPropertiesToJsx(node.properties);\n\t}\n\tif (node.children) {\n\t\tfor (const child of node.children) {\n\t\t\tvisitNode(child);\n\t\t}\n\t}\n}\n\n/**\n * Rehype plugin to convert HTML attributes to React JSX props\n */\nfunction rehypeHtmlToJsx() {\n\treturn (tree: Any) => {\n\t\tvisitNode(tree);\n\t\treturn tree;\n\t};\n}\n\nexport interface MarkdownFrontmatter {\n\ttitle?: string;\n\tdescription?: string;\n\tdate?: string;\n\tslug?: string;\n\texcerpt?: string;\n\tdraft?: boolean;\n\t[key: string]: Any;\n}\n\nexport interface ProcessedMarkdown {\n\tfrontmatter: MarkdownFrontmatter;\n\tcontent: string;\n\trawContent: string;\n\thasJSX: boolean;\n}\n\nexport interface HeadingNode {\n\tlevel: number;\n\ttext: string;\n\tslug: string;\n}\n\n/**\n * Frontmatter parser using gray-matter\n * Extracts metadata from markdown files between --- delimiters\n * Supports YAML data types: strings, numbers, booleans, arrays, objects, null\n */\nfunction parseFrontmatter(content: string): {\n\tdata: MarkdownFrontmatter;\n\tcontent: string;\n} {\n\ttry {\n\t\tconst { data, content: markdownContent } = matter(content);\n\t\treturn { data, content: markdownContent };\n\t} catch (error) {\n\t\tconsole.warn('[reroute/frontmatter] Failed to parse frontmatter:', error);\n\t\treturn { data: {}, content };\n\t}\n}\n\n/**\n * Check if markdown content contains JSX syntax\n */\nfunction hasJSXSyntax(content: string): boolean {\n\t// Simple heuristic: look for JSX-like patterns\n\tconst jsxPatterns = [\n\t\t/<[A-Z][a-zA-Z0-9]*/, // Component tags like <Component>\n\t\t/import\\s+{[^}]+}\\s+from/, // ES6 imports\n\t\t/import\\s+\\w+\\s+from/, // Default imports\n\t\t/export\\s+(default|const|function)/, // Exports\n\t\t/<\\w+\\s+\\w+={/, // Props with curly braces\n\t];\n\n\treturn jsxPatterns.some((pattern) => pattern.test(content));\n}\n\n/**\n * Process a markdown/MDX file and return structured data\n */\nexport function processMarkdownFile(filePath: string): ProcessedMarkdown {\n\tconst rawContent = readFileSync(filePath, 'utf-8');\n\tconst { data, content } = parseFrontmatter(rawContent);\n\tconst hasJSX = hasJSXSyntax(content);\n\n\treturn {\n\t\tfrontmatter: data,\n\t\tcontent,\n\t\trawContent,\n\t\thasJSX,\n\t};\n}\n\n/**\n * Check if @mdx-js/mdx is available in the project\n */\nfunction isMdxAvailable(cwd: string): boolean {\n\tlet currentDir = cwd;\n\n\t// Check up to 5 levels up\n\tfor (let i = 0; i < 5; i++) {\n\t\tconst packageJsonPath = join(currentDir, 'package.json');\n\n\t\tif (existsSync(packageJsonPath)) {\n\t\t\ttry {\n\t\t\t\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n\t\t\t\tconst deps = {\n\t\t\t\t\t...packageJson.dependencies,\n\t\t\t\t\t...packageJson.devDependencies,\n\t\t\t\t\t...packageJson.peerDependencies,\n\t\t\t\t};\n\n\t\t\t\tif ('@mdx-js/mdx' in deps) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Continue to parent directory\n\t\t\t}\n\t\t}\n\n\t\tconst parentDir = dirname(currentDir);\n\t\t// Stop if we've reached the root\n\t\tif (parentDir === currentDir) {\n\t\t\tbreak;\n\t\t}\n\t\tcurrentDir = parentDir;\n\t}\n\n\treturn false;\n}\n\nfunction tryLoadModule(cwd: string, moduleName: string): Any {\n\tconst pathsToTry = [\n\t\tjoin(cwd, `node_modules/${moduleName}`),\n\t\tjoin(cwd, `../node_modules/${moduleName}`),\n\t\tjoin(cwd, `../../node_modules/${moduleName}`),\n\t\tjoin(cwd, `../../../node_modules/${moduleName}`),\n\t];\n\n\tfor (const modulePath of pathsToTry) {\n\t\ttry {\n\t\t\treturn require(modulePath);\n\t\t} catch {\n\t\t\t// Try next path\n\t\t}\n\t}\n\treturn null;\n}\n\nfunction loadMdxCompiler(cwd: string): Any {\n\tconst mdxModule = tryLoadModule(cwd, '@mdx-js/mdx');\n\tif (!mdxModule) {\n\t\tconsole.error('[reroute/mdx] Could not load @mdx-js/mdx from any path');\n\t\treturn null;\n\t}\n\treturn mdxModule.compile;\n}\n\nfunction setupRemarkPlugins(cwd: string, enableGfm: boolean): Any[] {\n\tconst remarkPlugins = [] as Any[];\n\n\tif (!enableGfm) return remarkPlugins;\n\n\tconst remarkGfm = tryLoadModule(cwd, 'remark-gfm');\n\tif (remarkGfm) {\n\t\tremarkPlugins.push(remarkGfm.default || remarkGfm);\n\t} else {\n\t\tconsole.warn(\n\t\t\t'[reroute/mdx] remark-gfm not available for MDX compilation (Streamdown includes GFM for .md files)',\n\t\t);\n\t}\n\n\treturn remarkPlugins;\n}\n\nexport type ShikiRehypeOptions =\n\t| { theme: string }\n\t| { themes: { light: string; dark: string } };\n\n/** Pair GitHub themes so fenced code can follow prefers-color-scheme. */\nexport function shikiRehypeOptions(theme: string): ShikiRehypeOptions {\n\tif (theme === 'github-light' || theme === 'github-dark') {\n\t\treturn { themes: { light: 'github-light', dark: 'github-dark' } };\n\t}\n\treturn { theme };\n}\n\nfunction setupRehypePlugins(cwd: string, theme: string): Any[] {\n\tconst rehypePlugins = [] as Any[];\n\n\tconst rehypeRaw = tryLoadModule(cwd, 'rehype-raw');\n\tif (rehypeRaw) {\n\t\trehypePlugins.push([\n\t\t\trehypeRaw.default || rehypeRaw,\n\t\t\t{\n\t\t\t\tpassThrough: [\n\t\t\t\t\t'mdxFlowExpression',\n\t\t\t\t\t'mdxJsxFlowElement',\n\t\t\t\t\t'mdxJsxTextElement',\n\t\t\t\t\t'mdxTextExpression',\n\t\t\t\t\t'mdxjsEsm',\n\t\t\t\t],\n\t\t\t},\n\t\t]);\n\t\trehypePlugins.push(rehypeHtmlToJsx);\n\t}\n\n\tconst rehypeShiki = tryLoadModule(cwd, '@shikijs/rehype');\n\tif (rehypeShiki) {\n\t\trehypePlugins.push([\n\t\t\trehypeShiki.default || rehypeShiki,\n\t\t\tshikiRehypeOptions(theme),\n\t\t]);\n\t} else {\n\t\tconsole.warn(\n\t\t\t'[reroute/mdx] @shikijs/rehype not available, skipping highlighting',\n\t\t);\n\t}\n\n\treturn rehypePlugins;\n}\n\nfunction formatMdxError(error: unknown, options: { filename?: string }): void {\n\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\tconst errorLocation =\n\t\terror &&\n\t\ttypeof error === 'object' &&\n\t\t'place' in error &&\n\t\terror.place &&\n\t\ttypeof error.place === 'object'\n\t\t\t? `at line ${(error.place as Any).line || '?'}, column ${(error.place as Any).column || '?'}`\n\t\t\t: '';\n\tconst fileInfo = options.filename ? ` in ${options.filename}` : '';\n\n\tconsole.warn(\n\t\t`[reroute/mdx] Compilation failed${fileInfo}${errorLocation ? ` ${errorLocation}` : ''}: ${errorMessage}`,\n\t);\n\tconsole.warn(\n\t\t'[reroute/mdx] MDX compilation failed (Streamdown will handle .md files)',\n\t);\n}\n\n/**\n * Compile MDX content to JSX using @mdx-js/mdx\n */\nasync function compileMdx(\n\tcontent: string,\n\tcwd: string,\n\toptions: {\n\t\tenableGfm?: boolean;\n\t\ttheme?: string;\n\t\tfilename?: string;\n\t} = {},\n): Promise<string | null> {\n\tif (!isMdxAvailable(cwd)) {\n\t\tconsole.warn(\n\t\t\t'[reroute/mdx] @mdx-js/mdx not installed. Install with: bun add @mdx-js/mdx',\n\t\t);\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst compile = loadMdxCompiler(cwd);\n\t\tif (!compile) return null;\n\n\t\tconst { enableGfm = true, theme = 'github-dark' } = options;\n\n\t\tconst remarkPlugins = setupRemarkPlugins(cwd, enableGfm);\n\t\tconst rehypePlugins = setupRehypePlugins(cwd, theme);\n\n\t\tconst result = await compile(content, {\n\t\t\tremarkPlugins,\n\t\t\trehypePlugins,\n\t\t\toutputFormat: 'program',\n\t\t\tdevelopment: false,\n\t\t});\n\n\t\treturn String(result);\n\t} catch (error) {\n\t\tformatMdxError(error, options);\n\t\treturn null;\n\t}\n}\n\n/**\n * Rewrite relative imports in compiled MDX to be correct from the target location\n */\nfunction rewriteImportPaths(\n\tcode: string,\n\tsourcePath: string,\n\ttargetPath: string,\n): string {\n\t// Find all import statements with relative paths\n\tconst importRegex =\n\t\t/import\\s+(?:{[^}]+}|[\\w\\s,]+)\\s+from\\s+['\"](\\.[^'\"]+)['\"]/g;\n\n\treturn code.replace(importRegex, (match, importPath) => {\n\t\t// Resolve the import path relative to the source file\n\t\tconst sourceDir = dirname(sourcePath);\n\t\tconst absoluteImportPath = resolve(sourceDir, importPath);\n\n\t\t// Calculate the new relative path from the target file\n\t\tconst targetDir = dirname(targetPath);\n\t\tlet newRelativePath = relative(targetDir, absoluteImportPath);\n\n\t\t// Ensure the path starts with ./ or ../\n\t\tif (!newRelativePath.startsWith('.')) {\n\t\t\tnewRelativePath = `./${newRelativePath}`;\n\t\t}\n\n\t\t// Replace backslashes with forward slashes for consistency\n\t\tnewRelativePath = newRelativePath.replace(/\\\\/g, '/');\n\n\t\t// Replace the import path in the original match\n\t\treturn match.replace(importPath, newRelativePath);\n\t});\n}\n\n/**\n * Generate a React component wrapper for markdown content\n * This creates a TypeScript module that can be imported as a route\n */\nexport async function generateMarkdownModule(\n\tprocessed: ProcessedMarkdown,\n\tcwd: string,\n\toptions: {\n\t\tenableGfm?: boolean;\n\t\ttheme?: string;\n\t\tisMdx?: boolean;\n\t\tfilename?: string;\n\t\tsourcePath?: string;\n\t\ttargetPath?: string;\n\t\tcomponentsPath?: string;\n\t} = {},\n): Promise<string> {\n\tconst { frontmatter, content } = processed;\n\tconst {\n\t\tenableGfm = true,\n\t\ttheme = 'github-dark',\n\t\tisMdx = false,\n\t\tfilename,\n\t\tsourcePath,\n\t\ttargetPath,\n\t\tcomponentsPath,\n\t} = options;\n\n\t// Prefer MDX engine for both .mdx and .md when available to ensure\n\t// identical SSR/CSR output. MD is a subset of MDX, so compile it too.\n\tlet compiledMdx = await compileMdx(content, cwd, {\n\t\tenableGfm,\n\t\ttheme,\n\t\tfilename,\n\t});\n\tif (compiledMdx) {\n\t\t// Rewrite import paths if source and target paths are provided\n\t\tif (sourcePath && targetPath) {\n\t\t\tcompiledMdx = rewriteImportPaths(compiledMdx, sourcePath, targetPath);\n\t\t}\n\t\t// Add TypeScript type definitions for MDX props\n\t\t// Using proper JSX types to avoid ElementType errors\n\t\tconst typeDefinitions = `// TypeScript types for MDX components\ntype MDXProps = {\n components?: Record<string, React.ComponentType<any>>;\n [key: string]: any;\n};\n\n// Suppress JSX element type checking for MDX-generated code\n// @ts-nocheck enables this for the entire generated file\n`;\n\n\t\t// Fix type annotations in the compiled MDX by adding types to function parameters\n\t\t// Also remove 'export default' from MDXContent if we're adding custom components wrapper\n\t\tconst typedMdx = compiledMdx\n\t\t\t.replace(\n\t\t\t\t/function\\s+_createMdxContent\\s*\\(\\s*props\\s*\\)/g,\n\t\t\t\t'function _createMdxContent(props: MDXProps)',\n\t\t\t)\n\t\t\t.replace(\n\t\t\t\t/function\\s+MDXContent\\s*\\(\\s*props\\s*\\)/g,\n\t\t\t\t'function MDXContent(props: MDXProps)',\n\t\t\t);\n\n\t\t// MDX already supports passing components as props at runtime\n\t\t// No need to import them at build time - this avoids bundling issues\n\n\t\t// Already a complete program that exports a default component\n\t\treturn `// @ts-nocheck\n// Generated from ${isMdx ? 'MDX' : 'Markdown'} file with @mdx-js/mdx\n// TypeScript checking is disabled for MDX-generated code\n\n${typeDefinitions}\n\n// MDX compiled content with imports and component\n${typedMdx}\n\n// Frontmatter exports\nexport const meta = ${JSON.stringify(frontmatter, null, 2)};\n\n// Table of Contents\nexport const toc = ${JSON.stringify(extractHeadings(content), null, 2)};\n\nexport const ssr = {\n head: [\n '<meta property=\"og:type\" content=\"article\" />',\n '<meta name=\"twitter:card\" content=\"summary_large_image\" />',\n ],\n};\n`;\n\t}\n\n\t// Regular markdown - wrap with Markdown component\n\tconst escapedContent = content\n\t\t.replace(/\\\\/g, '\\\\\\\\')\n\t\t.replace(/`/g, '\\\\`')\n\t\t.replace(/\\$/g, '\\\\$');\n\n\t// Build plugin imports\n\tconst pluginImports: string[] = [];\n\tconst remarkPluginsList: string[] = [];\n\tconst rehypePluginsList: string[] = [];\n\n\t// Add custom components import if provided\n\tif (componentsPath) {\n\t\tpluginImports.push(`import markdownComponents from '${componentsPath}';`);\n\t}\n\n\t// Note: GFM is built into Streamdown, no need to import remark-gfm for .md files\n\t// This is only used for MDX files\n\tif (enableGfm) {\n\t\tpluginImports.push(\"import remarkGfm from 'remark-gfm';\");\n\t\tremarkPluginsList.push('remarkGfm');\n\t}\n\n\t// Note: Shiki is async and breaks SSR - skip it\n\n\tconst pluginImportsStr =\n\t\tpluginImports.length > 0 ? `${pluginImports.join('\\n')}\\n` : '';\n\tconst remarkPluginsStr =\n\t\tremarkPluginsList.length > 0\n\t\t\t? `remarkPlugins={[${remarkPluginsList.join(', ')}]}`\n\t\t\t: '';\n\tconst rehypePluginsStr =\n\t\trehypePluginsList.length > 0\n\t\t\t? `rehypePlugins={[${rehypePluginsList.join(', ')}]}`\n\t\t\t: '';\n\tconst componentsStr = componentsPath ? 'components={markdownComponents}' : '';\n\tconst pluginsPropsStr = [remarkPluginsStr, rehypePluginsStr, componentsStr]\n\t\t.filter(Boolean)\n\t\t.join('\\n ');\n\n\treturn `// Generated from markdown file\nimport { Markdown } from 'reroute-js/react';\n${pluginImportsStr}\nconst meta = ${JSON.stringify(frontmatter, null, 2)};\n\nconst ssr = {\n head: [\n '<meta property=\"og:type\" content=\"article\" />',\n '<meta name=\"twitter:card\" content=\"summary_large_image\" />',\n ],\n};\n\nconst markdownContent = \\`${escapedContent}\\`;\n\nfunction MarkdownRoute() {\n return (\n <div>\n <Markdown\n ${pluginsPropsStr}\n >\n {markdownContent}\n </Markdown>\n </div>\n );\n}\n\n// Table of Contents\nexport const toc = ${JSON.stringify(extractHeadings(content), null, 2)};\n\nexport { meta, ssr, toc };\nexport default MarkdownRoute;\n`;\n}\n\n/**\n * Generate a plain fallback TSX module when markdown tooling\n * is not configured. Renders raw markdown content in a <pre> block\n * so routes still work without extra deps.\n */\nexport function generatePlainMarkdownModule(\n\tprocessed: ProcessedMarkdown,\n): string {\n\tconst { frontmatter, content } = processed;\n\tconst escapedContent = content\n\t\t.replace(/\\\\/g, '\\\\\\\\')\n\t\t.split(String.fromCharCode(96))\n\t\t.join(`\\\\${String.fromCharCode(96)}`)\n\t\t.split('$')\n\t\t.join('\\\\$');\n\n\treturn `// Generated from markdown file (plain fallback)\n// No markdown renderer detected; showing raw content.\nexport const meta = ${JSON.stringify(frontmatter, null, 2)};\n\n// Table of Contents (empty for fallback)\nexport const toc = [];\n\nexport const ssr = {\n head: [\n '<meta property=\"og:type\" content=\"article\" />',\n '<meta name=\"twitter:card\" content=\"summary_large_image\" />',\n ],\n};\n\nconst markdownContent = \\`${escapedContent}\\`;\n\nexport default function MarkdownFallback() {\n return (\n <div style={{ padding: '1rem' }}>\n {meta?.title && (\n <h1 style={{ fontSize: '1.5rem', fontWeight: 600 }}>{meta.title}</h1>\n )}\n <div style={{\n margin: '0.75rem 0',\n padding: '0.75rem',\n borderLeft: '4px solid #eab308',\n background: '#fefce8',\n color: '#713f12'\n }}>\n <strong>Markdown rendering not configured.</strong>\n <div style={{ marginTop: '0.25rem' }}>\n Install: streamdown (required - includes GFM, syntax highlighting, math, and mermaid), @mdx-js/mdx (optional for JSX in markdown).\n </div>\n </div>\n <pre style={{ whiteSpace: 'pre-wrap', lineHeight: 1.6 }}>{markdownContent}</pre>\n </div>\n );\n}\n`;\n}\n\n/**\n * Check if a file is a markdown file\n */\nexport function isMarkdownFile(filePath: string): boolean {\n\tconst ext = extname(filePath).toLowerCase();\n\treturn ext === '.md' || ext === '.mdx';\n}\n\n/**\n * Get the route name from a markdown filename\n * Converts kebab-case to the route path\n */\nexport function getMarkdownRouteName(filePath: string): string {\n\tconst name = basename(filePath, extname(filePath));\n\treturn name;\n}\n\n/**\n * Extract headings from markdown content\n * Parses markdown headers (# ## ### etc) and returns structured data\n */\nexport function extractHeadings(\n\tcontent: string,\n\toptions: { minLevel?: number; maxLevel?: number } = {},\n): HeadingNode[] {\n\tconst { minLevel = 1, maxLevel = 6 } = options;\n\tconst headings: HeadingNode[] = [];\n\n\t// Match markdown headings: # Title, ## Title, etc.\n\tconst headingRegex = /^(#{1,6})\\s+(.+)$/gm;\n\tlet match: RegExpExecArray | null = headingRegex.exec(content);\n\n\twhile (match !== null) {\n\t\tconst level = match[1].length;\n\n\t\t// Only include headings within the specified level range\n\t\tif (level >= minLevel && level <= maxLevel) {\n\t\t\tconst text = match[2].trim();\n\t\t\t// Generate slug from heading text (lowercase, replace spaces with hyphens)\n\t\t\tconst slug = text\n\t\t\t\t.toLowerCase()\n\t\t\t\t.replace(/[^\\w\\s-]/g, '')\n\t\t\t\t.replace(/\\s+/g, '-')\n\t\t\t\t.replace(/-+/g, '-')\n\t\t\t\t.trim();\n\n\t\t\theadings.push({ level, text, slug });\n\t\t}\n\n\t\tmatch = headingRegex.exec(content);\n\t}\n\n\treturn headings;\n}\n\n/**\n * Strip markdown syntax and return plain text\n * Useful for creating search-friendly content\n */\nexport function stripMarkdown(content: string): string {\n\tlet text = content;\n\n\t// Keep code block content but remove fences (code is often searchable!)\n\ttext = text.replace(/```(?:\\w+)?\\n?([\\s\\S]*?)```/g, '$1');\n\t// Keep inline code content but remove backticks\n\ttext = text.replace(/`([^`]+)`/g, '$1');\n\n\t// Remove HTML tags\n\ttext = text.replace(/<[^>]+>/g, '');\n\n\t// Remove images\n\ttext = text.replace(/!\\[([^\\]]*)\\]\\([^)]+\\)/g, '$1');\n\n\t// Remove links but keep text\n\ttext = text.replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1');\n\n\t// Remove headings markers\n\ttext = text.replace(/^#{1,6}\\s+/gm, '');\n\n\t// Remove bold/italic\n\ttext = text.replace(/[*_]{1,3}([^*_]+)[*_]{1,3}/g, '$1');\n\n\t// Remove blockquotes\n\ttext = text.replace(/^>\\s+/gm, '');\n\n\t// Remove horizontal rules\n\ttext = text.replace(/^[-*_]{3,}$/gm, '');\n\n\t// Remove list markers\n\ttext = text.replace(/^[-*+]\\s+/gm, '');\n\ttext = text.replace(/^\\d+\\.\\s+/gm, '');\n\n\t// Normalize whitespace\n\ttext = text.replace(/\\n{3,}/g, '\\n\\n');\n\ttext = text.trim();\n\n\treturn text;\n}\n",
|
|
58
|
+
"/**\n * Markdown/MDX processor for route files\n *\n * Processes .md and .mdx files with frontmatter support for use in the routing system\n */\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { basename, dirname, extname, join, relative, resolve } from 'node:path';\nimport matter from 'gray-matter';\n\n// biome-ignore lint/suspicious/noExplicitAny: yes\ntype Any = any;\n\n/**\n * HTML attribute to JSX prop mapping\n */\nconst htmlToJsxAttributes: Record<string, string> = {\n\tclass: 'className',\n\tfor: 'htmlFor',\n\t'accept-charset': 'acceptCharset',\n\t'http-equiv': 'httpEquiv',\n\taccesskey: 'accessKey',\n\tcontenteditable: 'contentEditable',\n\tcrossorigin: 'crossOrigin',\n\ttabindex: 'tabIndex',\n\t// SVG attributes\n\t'stroke-width': 'strokeWidth',\n\t'stroke-linecap': 'strokeLinecap',\n\t'stroke-linejoin': 'strokeLinejoin',\n\t'stroke-miterlimit': 'strokeMiterlimit',\n\t'stroke-dasharray': 'strokeDasharray',\n\t'stroke-dashoffset': 'strokeDashoffset',\n\t'stroke-opacity': 'strokeOpacity',\n\t'fill-opacity': 'fillOpacity',\n\t'fill-rule': 'fillRule',\n\t'clip-path': 'clipPath',\n\t'clip-rule': 'clipRule',\n\t'font-family': 'fontFamily',\n\t'font-size': 'fontSize',\n\t'font-weight': 'fontWeight',\n\t'text-anchor': 'textAnchor',\n\t'text-decoration': 'textDecoration',\n\t'vector-effect': 'vectorEffect',\n};\n\nfunction convertPropertiesToJsx(\n\tproperties: Record<string, Any>,\n): Record<string, Any> {\n\tconst newProperties: Record<string, Any> = {};\n\tfor (const [key, value] of Object.entries(properties)) {\n\t\tconst jsxKey = htmlToJsxAttributes[key] || key;\n\t\tnewProperties[jsxKey] = value;\n\t}\n\treturn newProperties;\n}\n\nfunction visitNode(node: Any): void {\n\tif (node.type === 'element' && node.properties) {\n\t\tnode.properties = convertPropertiesToJsx(node.properties);\n\t}\n\tif (node.children) {\n\t\tfor (const child of node.children) {\n\t\t\tvisitNode(child);\n\t\t}\n\t}\n}\n\n/**\n * Rehype plugin to convert HTML attributes to React JSX props\n */\nfunction rehypeHtmlToJsx() {\n\treturn (tree: Any) => {\n\t\tvisitNode(tree);\n\t\treturn tree;\n\t};\n}\n\nexport interface MarkdownFrontmatter {\n\ttitle?: string;\n\tdescription?: string;\n\tdate?: string;\n\tslug?: string;\n\texcerpt?: string;\n\tdraft?: boolean;\n\t[key: string]: Any;\n}\n\nexport interface ProcessedMarkdown {\n\tfrontmatter: MarkdownFrontmatter;\n\tcontent: string;\n\trawContent: string;\n\thasJSX: boolean;\n}\n\nexport interface HeadingNode {\n\tlevel: number;\n\ttext: string;\n\tslug: string;\n}\n\n/**\n * Frontmatter parser using gray-matter\n * Extracts metadata from markdown files between --- delimiters\n * Supports YAML data types: strings, numbers, booleans, arrays, objects, null\n */\nfunction parseFrontmatter(content: string): {\n\tdata: MarkdownFrontmatter;\n\tcontent: string;\n} {\n\ttry {\n\t\tconst { data, content: markdownContent } = matter(content);\n\t\treturn { data, content: markdownContent };\n\t} catch (error) {\n\t\tconsole.warn('[reroute/frontmatter] Failed to parse frontmatter:', error);\n\t\treturn { data: {}, content };\n\t}\n}\n\n/**\n * Check if markdown content contains JSX syntax\n */\nfunction hasJSXSyntax(content: string): boolean {\n\t// Simple heuristic: look for JSX-like patterns\n\tconst jsxPatterns = [\n\t\t/<[A-Z][a-zA-Z0-9]*/, // Component tags like <Component>\n\t\t/import\\s+{[^}]+}\\s+from/, // ES6 imports\n\t\t/import\\s+\\w+\\s+from/, // Default imports\n\t\t/export\\s+(default|const|function)/, // Exports\n\t\t/<\\w+\\s+\\w+={/, // Props with curly braces\n\t];\n\n\treturn jsxPatterns.some((pattern) => pattern.test(content));\n}\n\n/**\n * Process a markdown/MDX file and return structured data\n */\nexport function processMarkdownFile(filePath: string): ProcessedMarkdown {\n\tconst rawContent = readFileSync(filePath, 'utf-8');\n\tconst { data, content } = parseFrontmatter(rawContent);\n\tconst hasJSX = hasJSXSyntax(content);\n\n\treturn {\n\t\tfrontmatter: data,\n\t\tcontent,\n\t\trawContent,\n\t\thasJSX,\n\t};\n}\n\n/**\n * Check if @mdx-js/mdx is available in the project\n */\nfunction isMdxAvailable(cwd: string): boolean {\n\tlet currentDir = cwd;\n\n\t// Check up to 5 levels up\n\tfor (let i = 0; i < 5; i++) {\n\t\tconst packageJsonPath = join(currentDir, 'package.json');\n\n\t\tif (existsSync(packageJsonPath)) {\n\t\t\ttry {\n\t\t\t\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n\t\t\t\tconst deps = {\n\t\t\t\t\t...packageJson.dependencies,\n\t\t\t\t\t...packageJson.devDependencies,\n\t\t\t\t\t...packageJson.peerDependencies,\n\t\t\t\t};\n\n\t\t\t\tif ('@mdx-js/mdx' in deps) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Continue to parent directory\n\t\t\t}\n\t\t}\n\n\t\tconst parentDir = dirname(currentDir);\n\t\t// Stop if we've reached the root\n\t\tif (parentDir === currentDir) {\n\t\t\tbreak;\n\t\t}\n\t\tcurrentDir = parentDir;\n\t}\n\n\treturn false;\n}\n\nfunction tryLoadModule(cwd: string, moduleName: string): Any {\n\tconst pathsToTry = [\n\t\tjoin(cwd, `node_modules/${moduleName}`),\n\t\tjoin(cwd, `../node_modules/${moduleName}`),\n\t\tjoin(cwd, `../../node_modules/${moduleName}`),\n\t\tjoin(cwd, `../../../node_modules/${moduleName}`),\n\t];\n\n\tfor (const modulePath of pathsToTry) {\n\t\ttry {\n\t\t\treturn require(modulePath);\n\t\t} catch {\n\t\t\t// Try next path\n\t\t}\n\t}\n\treturn null;\n}\n\nfunction loadMdxCompiler(cwd: string): Any {\n\tconst mdxModule = tryLoadModule(cwd, '@mdx-js/mdx');\n\tif (!mdxModule) {\n\t\tconsole.error('[reroute/mdx] Could not load @mdx-js/mdx from any path');\n\t\treturn null;\n\t}\n\treturn mdxModule.compile;\n}\n\nfunction setupRemarkPlugins(cwd: string, enableGfm: boolean): Any[] {\n\tconst remarkPlugins = [] as Any[];\n\n\tif (!enableGfm) return remarkPlugins;\n\n\tconst remarkGfm = tryLoadModule(cwd, 'remark-gfm');\n\tif (remarkGfm) {\n\t\tremarkPlugins.push(remarkGfm.default || remarkGfm);\n\t} else {\n\t\tconsole.warn(\n\t\t\t'[reroute/mdx] remark-gfm not available for MDX compilation (Streamdown includes GFM for .md files)',\n\t\t);\n\t}\n\n\treturn remarkPlugins;\n}\n\nexport type ShikiRehypeOptions =\n\t| { theme: string }\n\t| { themes: { light: string; dark: string } };\n\n/** Pair GitHub themes so fenced code can follow prefers-color-scheme. */\nexport function shikiRehypeOptions(theme: string): ShikiRehypeOptions {\n\tif (theme === 'github-light' || theme === 'github-dark') {\n\t\treturn { themes: { light: 'github-light', dark: 'github-dark' } };\n\t}\n\treturn { theme };\n}\n\nfunction setupRehypePlugins(cwd: string, theme: string): Any[] {\n\tconst rehypePlugins = [] as Any[];\n\n\tconst rehypeRaw = tryLoadModule(cwd, 'rehype-raw');\n\tif (rehypeRaw) {\n\t\trehypePlugins.push([\n\t\t\trehypeRaw.default || rehypeRaw,\n\t\t\t{\n\t\t\t\tpassThrough: [\n\t\t\t\t\t'mdxFlowExpression',\n\t\t\t\t\t'mdxJsxFlowElement',\n\t\t\t\t\t'mdxJsxTextElement',\n\t\t\t\t\t'mdxTextExpression',\n\t\t\t\t\t'mdxjsEsm',\n\t\t\t\t],\n\t\t\t},\n\t\t]);\n\t\trehypePlugins.push(rehypeHtmlToJsx);\n\t}\n\n\tconst rehypeShiki = tryLoadModule(cwd, '@shikijs/rehype');\n\tif (rehypeShiki) {\n\t\trehypePlugins.push([\n\t\t\trehypeShiki.default || rehypeShiki,\n\t\t\tshikiRehypeOptions(theme),\n\t\t]);\n\t} else {\n\t\tconsole.warn(\n\t\t\t'[reroute/mdx] @shikijs/rehype not available, skipping highlighting',\n\t\t);\n\t}\n\n\treturn rehypePlugins;\n}\n\nfunction formatMdxError(error: unknown, options: { filename?: string }): void {\n\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\tconst errorLocation =\n\t\terror &&\n\t\ttypeof error === 'object' &&\n\t\t'place' in error &&\n\t\terror.place &&\n\t\ttypeof error.place === 'object'\n\t\t\t? `at line ${(error.place as Any).line || '?'}, column ${(error.place as Any).column || '?'}`\n\t\t\t: '';\n\tconst fileInfo = options.filename ? ` in ${options.filename}` : '';\n\n\tconsole.warn(\n\t\t`[reroute/mdx] Compilation failed${fileInfo}${errorLocation ? ` ${errorLocation}` : ''}: ${errorMessage}`,\n\t);\n\tconsole.warn(\n\t\t'[reroute/mdx] MDX compilation failed (Streamdown will handle .md files)',\n\t);\n}\n\n/**\n * Compile MDX content to JSX using @mdx-js/mdx\n */\nasync function compileMdx(\n\tcontent: string,\n\tcwd: string,\n\toptions: {\n\t\tenableGfm?: boolean;\n\t\ttheme?: string;\n\t\tfilename?: string;\n\t} = {},\n): Promise<string | null> {\n\tif (!isMdxAvailable(cwd)) {\n\t\tconsole.warn(\n\t\t\t'[reroute/mdx] @mdx-js/mdx not installed. Install with: bun add @mdx-js/mdx',\n\t\t);\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst compile = loadMdxCompiler(cwd);\n\t\tif (!compile) return null;\n\n\t\tconst { enableGfm = true, theme = 'github-dark' } = options;\n\n\t\tconst remarkPlugins = setupRemarkPlugins(cwd, enableGfm);\n\t\tconst rehypePlugins = setupRehypePlugins(cwd, theme);\n\n\t\tconst result = await compile(content, {\n\t\t\tremarkPlugins,\n\t\t\trehypePlugins,\n\t\t\toutputFormat: 'program',\n\t\t\tdevelopment: false,\n\t\t});\n\n\t\treturn String(result);\n\t} catch (error) {\n\t\tformatMdxError(error, options);\n\t\treturn null;\n\t}\n}\n\n/**\n * Rewrite relative imports in compiled MDX to be correct from the target location\n */\nfunction rewriteImportPaths(\n\tcode: string,\n\tsourcePath: string,\n\ttargetPath: string,\n): string {\n\t// Find all import statements with relative paths\n\tconst importRegex =\n\t\t/import\\s+(?:{[^}]+}|[\\w\\s,]+)\\s+from\\s+['\"](\\.[^'\"]+)['\"]/g;\n\n\treturn code.replace(importRegex, (match, importPath) => {\n\t\t// Resolve the import path relative to the source file\n\t\tconst sourceDir = dirname(sourcePath);\n\t\tconst absoluteImportPath = resolve(sourceDir, importPath);\n\n\t\t// Calculate the new relative path from the target file\n\t\tconst targetDir = dirname(targetPath);\n\t\tlet newRelativePath = relative(targetDir, absoluteImportPath);\n\n\t\t// Ensure the path starts with ./ or ../\n\t\tif (!newRelativePath.startsWith('.')) {\n\t\t\tnewRelativePath = `./${newRelativePath}`;\n\t\t}\n\n\t\t// Replace backslashes with forward slashes for consistency\n\t\tnewRelativePath = newRelativePath.replace(/\\\\/g, '/');\n\n\t\t// Replace the import path in the original match\n\t\treturn match.replace(importPath, newRelativePath);\n\t});\n}\n\n/**\n * Generate a React component wrapper for markdown content\n * This creates a TypeScript module that can be imported as a route\n */\nexport async function generateMarkdownModule(\n\tprocessed: ProcessedMarkdown,\n\tcwd: string,\n\toptions: {\n\t\tenableGfm?: boolean;\n\t\ttheme?: string;\n\t\tisMdx?: boolean;\n\t\tfilename?: string;\n\t\tsourcePath?: string;\n\t\ttargetPath?: string;\n\t\tcomponentsPath?: string;\n\t} = {},\n): Promise<string> {\n\tconst { frontmatter, content } = processed;\n\tconst {\n\t\tenableGfm = true,\n\t\ttheme = 'github-dark',\n\t\tisMdx = false,\n\t\tfilename,\n\t\tsourcePath,\n\t\ttargetPath,\n\t\tcomponentsPath,\n\t} = options;\n\n\t// Prefer MDX engine for both .mdx and .md when available to ensure\n\t// identical SSR/CSR output. MD is a subset of MDX, so compile it too.\n\tlet compiledMdx = await compileMdx(content, cwd, {\n\t\tenableGfm,\n\t\ttheme,\n\t\tfilename,\n\t});\n\tif (compiledMdx) {\n\t\t// Rewrite import paths if source and target paths are provided\n\t\tif (sourcePath && targetPath) {\n\t\t\tcompiledMdx = rewriteImportPaths(compiledMdx, sourcePath, targetPath);\n\t\t}\n\t\t// Add TypeScript type definitions for MDX props\n\t\t// Using proper JSX types to avoid ElementType errors\n\t\tconst typeDefinitions = `// TypeScript types for MDX components\ntype MDXProps = {\n components?: Record<string, React.ComponentType<any>>;\n [key: string]: any;\n};\n\n// Suppress JSX element type checking for MDX-generated code\n// @ts-nocheck enables this for the entire generated file\n`;\n\n\t\t// Fix type annotations in the compiled MDX by adding types to function parameters\n\t\t// Also remove 'export default' from MDXContent if we're adding custom components wrapper\n\t\tconst typedMdx = compiledMdx\n\t\t\t.replace(\n\t\t\t\t/function\\s+_createMdxContent\\s*\\(\\s*props\\s*\\)/g,\n\t\t\t\t'function _createMdxContent(props: MDXProps)',\n\t\t\t)\n\t\t\t.replace(\n\t\t\t\t/function\\s+MDXContent\\s*\\(\\s*props\\s*\\)/g,\n\t\t\t\t'function MDXContent(props: MDXProps)',\n\t\t\t);\n\n\t\t// MDX already supports passing components as props at runtime\n\t\t// No need to import them at build time - this avoids bundling issues\n\n\t\t// Already a complete program that exports a default component\n\t\treturn `// @ts-nocheck\n// Generated from ${isMdx ? 'MDX' : 'Markdown'} file with @mdx-js/mdx\n// TypeScript checking is disabled for MDX-generated code\n\n${typeDefinitions}\n\n// MDX compiled content with imports and component\n${typedMdx}\n\n// Frontmatter exports\nexport const meta = ${JSON.stringify(frontmatter, null, 2)};\n\n// Table of Contents\nexport const toc = ${JSON.stringify(extractHeadings(content), null, 2)};\n\nexport const ssr = {\n head: [\n '<meta property=\"og:type\" content=\"article\" />',\n '<meta name=\"twitter:card\" content=\"summary_large_image\" />',\n ],\n};\n`;\n\t}\n\n\t// Regular markdown - wrap with Markdown component\n\tconst escapedContent = content\n\t\t.replace(/\\\\/g, '\\\\\\\\')\n\t\t.replace(/`/g, '\\\\`')\n\t\t.replace(/\\$/g, '\\\\$');\n\n\t// Build plugin imports\n\tconst pluginImports: string[] = [];\n\tconst remarkPluginsList: string[] = [];\n\tconst rehypePluginsList: string[] = [];\n\n\t// Add custom components import if provided\n\tif (componentsPath) {\n\t\tpluginImports.push(`import markdownComponents from '${componentsPath}';`);\n\t}\n\n\t// Note: GFM is built into Streamdown, no need to import remark-gfm for .md files\n\t// This is only used for MDX files\n\tif (enableGfm) {\n\t\tpluginImports.push(\"import remarkGfm from 'remark-gfm';\");\n\t\tremarkPluginsList.push('remarkGfm');\n\t}\n\n\t// Note: Shiki is async and breaks SSR - skip it\n\n\tconst pluginImportsStr =\n\t\tpluginImports.length > 0 ? `${pluginImports.join('\\n')}\\n` : '';\n\tconst remarkPluginsStr =\n\t\tremarkPluginsList.length > 0\n\t\t\t? `remarkPlugins={[${remarkPluginsList.join(', ')}]}`\n\t\t\t: '';\n\tconst rehypePluginsStr =\n\t\trehypePluginsList.length > 0\n\t\t\t? `rehypePlugins={[${rehypePluginsList.join(', ')}]}`\n\t\t\t: '';\n\tconst componentsStr = componentsPath ? 'components={markdownComponents}' : '';\n\tconst pluginsPropsStr = [remarkPluginsStr, rehypePluginsStr, componentsStr]\n\t\t.filter(Boolean)\n\t\t.join('\\n ');\n\n\treturn `// Generated from markdown file\nimport { Markdown } from 'reroute-js/react/markdown';\n${pluginImportsStr}\nconst meta = ${JSON.stringify(frontmatter, null, 2)};\n\nconst ssr = {\n head: [\n '<meta property=\"og:type\" content=\"article\" />',\n '<meta name=\"twitter:card\" content=\"summary_large_image\" />',\n ],\n};\n\nconst markdownContent = \\`${escapedContent}\\`;\n\nfunction MarkdownRoute() {\n return (\n <div>\n <Markdown\n ${pluginsPropsStr}\n >\n {markdownContent}\n </Markdown>\n </div>\n );\n}\n\n// Table of Contents\nexport const toc = ${JSON.stringify(extractHeadings(content), null, 2)};\n\nexport { meta, ssr, toc };\nexport default MarkdownRoute;\n`;\n}\n\n/**\n * Generate a plain fallback TSX module when markdown tooling\n * is not configured. Renders raw markdown content in a <pre> block\n * so routes still work without extra deps.\n */\nexport function generatePlainMarkdownModule(\n\tprocessed: ProcessedMarkdown,\n): string {\n\tconst { frontmatter, content } = processed;\n\tconst escapedContent = content\n\t\t.replace(/\\\\/g, '\\\\\\\\')\n\t\t.split(String.fromCharCode(96))\n\t\t.join(`\\\\${String.fromCharCode(96)}`)\n\t\t.split('$')\n\t\t.join('\\\\$');\n\n\treturn `// Generated from markdown file (plain fallback)\n// No markdown renderer detected; showing raw content.\nexport const meta = ${JSON.stringify(frontmatter, null, 2)};\n\n// Table of Contents (empty for fallback)\nexport const toc = [];\n\nexport const ssr = {\n head: [\n '<meta property=\"og:type\" content=\"article\" />',\n '<meta name=\"twitter:card\" content=\"summary_large_image\" />',\n ],\n};\n\nconst markdownContent = \\`${escapedContent}\\`;\n\nexport default function MarkdownFallback() {\n return (\n <div style={{ padding: '1rem' }}>\n {meta?.title && (\n <h1 style={{ fontSize: '1.5rem', fontWeight: 600 }}>{meta.title}</h1>\n )}\n <div style={{\n margin: '0.75rem 0',\n padding: '0.75rem',\n borderLeft: '4px solid #eab308',\n background: '#fefce8',\n color: '#713f12'\n }}>\n <strong>Markdown rendering not configured.</strong>\n <div style={{ marginTop: '0.25rem' }}>\n Install: streamdown (required - includes GFM, syntax highlighting, math, and mermaid), @mdx-js/mdx (optional for JSX in markdown).\n </div>\n </div>\n <pre style={{ whiteSpace: 'pre-wrap', lineHeight: 1.6 }}>{markdownContent}</pre>\n </div>\n );\n}\n`;\n}\n\n/**\n * Check if a file is a markdown file\n */\nexport function isMarkdownFile(filePath: string): boolean {\n\tconst ext = extname(filePath).toLowerCase();\n\treturn ext === '.md' || ext === '.mdx';\n}\n\n/**\n * Get the route name from a markdown filename\n * Converts kebab-case to the route path\n */\nexport function getMarkdownRouteName(filePath: string): string {\n\tconst name = basename(filePath, extname(filePath));\n\treturn name;\n}\n\n/**\n * Extract headings from markdown content\n * Parses markdown headers (# ## ### etc) and returns structured data\n */\nexport function extractHeadings(\n\tcontent: string,\n\toptions: { minLevel?: number; maxLevel?: number } = {},\n): HeadingNode[] {\n\tconst { minLevel = 1, maxLevel = 6 } = options;\n\tconst headings: HeadingNode[] = [];\n\n\t// Match markdown headings: # Title, ## Title, etc.\n\tconst headingRegex = /^(#{1,6})\\s+(.+)$/gm;\n\tlet match: RegExpExecArray | null = headingRegex.exec(content);\n\n\twhile (match !== null) {\n\t\tconst level = match[1].length;\n\n\t\t// Only include headings within the specified level range\n\t\tif (level >= minLevel && level <= maxLevel) {\n\t\t\tconst text = match[2].trim();\n\t\t\t// Generate slug from heading text (lowercase, replace spaces with hyphens)\n\t\t\tconst slug = text\n\t\t\t\t.toLowerCase()\n\t\t\t\t.replace(/[^\\w\\s-]/g, '')\n\t\t\t\t.replace(/\\s+/g, '-')\n\t\t\t\t.replace(/-+/g, '-')\n\t\t\t\t.trim();\n\n\t\t\theadings.push({ level, text, slug });\n\t\t}\n\n\t\tmatch = headingRegex.exec(content);\n\t}\n\n\treturn headings;\n}\n\n/**\n * Strip markdown syntax and return plain text\n * Useful for creating search-friendly content\n */\nexport function stripMarkdown(content: string): string {\n\tlet text = content;\n\n\t// Keep code block content but remove fences (code is often searchable!)\n\ttext = text.replace(/```(?:\\w+)?\\n?([\\s\\S]*?)```/g, '$1');\n\t// Keep inline code content but remove backticks\n\ttext = text.replace(/`([^`]+)`/g, '$1');\n\n\t// Remove HTML tags\n\ttext = text.replace(/<[^>]+>/g, '');\n\n\t// Remove images\n\ttext = text.replace(/!\\[([^\\]]*)\\]\\([^)]+\\)/g, '$1');\n\n\t// Remove links but keep text\n\ttext = text.replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1');\n\n\t// Remove headings markers\n\ttext = text.replace(/^#{1,6}\\s+/gm, '');\n\n\t// Remove bold/italic\n\ttext = text.replace(/[*_]{1,3}([^*_]+)[*_]{1,3}/g, '$1');\n\n\t// Remove blockquotes\n\ttext = text.replace(/^>\\s+/gm, '');\n\n\t// Remove horizontal rules\n\ttext = text.replace(/^[-*_]{3,}$/gm, '');\n\n\t// Remove list markers\n\ttext = text.replace(/^[-*+]\\s+/gm, '');\n\ttext = text.replace(/^\\d+\\.\\s+/gm, '');\n\n\t// Normalize whitespace\n\ttext = text.replace(/\\n{3,}/g, '\\n\\n');\n\ttext = text.trim();\n\n\treturn text;\n}\n",
|
|
59
59
|
"/**\n * Production mode utility\n *\n * Provides utilities to check if the CLI is running in production mode.\n * Production mode can be enabled either via NODE_ENV=production or --prod flag.\n */\n\nfunction hasProdFlag(args: string[] = []): boolean {\n\treturn args.includes('--prod') || args.includes('--production');\n}\n\n/**\n * Check if production mode is enabled\n * @param args Command line arguments to check for --prod / --production\n * @returns true if a production flag is present\n */\nexport function isProductionMode(args: string[] = []): boolean {\n\treturn hasProdFlag(args);\n}\n\n/**\n * Set NODE_ENV to production if --prod flag is present\n * This ensures child processes inherit the production setting\n * @param args Command line arguments to check for --prod flag\n */\nexport function ensureProductionEnv(args: string[] = []): void {\n\tif (hasProdFlag(args)) {\n\t\tprocess.env.NODE_ENV = 'production';\n\t\tBun.env.NODE_ENV = 'production';\n\t}\n}\n\n/**\n * Filter out --prod flag from arguments since it's handled globally\n * @param args Command line arguments\n * @returns Filtered arguments without --prod\n */\nexport function filterProdFlag(args: string[]): string[] {\n\treturn args.filter((arg) => arg !== '--prod' && arg !== '--production');\n}\n",
|
|
60
60
|
"/**\n * Server utilities for waiting and polling\n */\n\nexport async function isServerRunning(\n\tport: number,\n\ttimeout = 1000,\n): Promise<boolean> {\n\ttry {\n\t\tconst response = await fetch(`http://localhost:${port}/`, {\n\t\t\tmethod: 'GET',\n\t\t\tsignal: AbortSignal.timeout(timeout),\n\t\t});\n\t\treturn response.status < 500;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Wait for server to be ready by checking if it responds to HTTP requests\n * Uses exponential backoff for efficient polling without artificial delays\n * This ensures the server is fully initialized before declaring it ready\n */\nexport async function waitForServerReady(\n\tport = 3000,\n\ttimeout = 30000, // 30 seconds, more reasonable for large projects\n): Promise<void> {\n\tconst startTime = Date.now();\n\tlet checkInterval = 50; // Start with 50ms\n\tconst maxInterval = 1000; // Max 1 second between checks\n\n\twhile (Date.now() - startTime < timeout) {\n\t\ttry {\n\t\t\tconst response = await fetch(`http://localhost:${port}/`, {\n\t\t\t\tmethod: 'GET',\n\t\t\t\tsignal: AbortSignal.timeout(2000), // 2 second timeout per request\n\t\t\t});\n\t\t\t// Accept both success and 404 (means server is responding)\n\t\t\tif (response.status < 500) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Server not ready yet, continue with exponential backoff\n\t\t}\n\n\t\tawait new Promise((resolve) => setTimeout(resolve, checkInterval));\n\n\t\t// Exponential backoff: increase interval but cap at maxInterval\n\t\tcheckInterval = Math.min(checkInterval * 1.5, maxInterval);\n\t}\n\n\tthrow new Error(\n\t\t`Timeout waiting for server to respond after ${timeout}ms. ` +\n\t\t\t`Make sure your server is starting correctly on port ${port}.`,\n\t);\n}\n",
|
|
61
61
|
"/**\n * Client CSS sync utility\n *\n * Bundles the client CSS entry (resolving @import) into\n * .reroute/bundles/index.css and .reroute/bundles/index.<hash>.css\n * for serving at /bundles/… alongside the JS.\n *\n * Default entry is src/client/index.css (parent of app.src).\n *\n * DX pattern — keep the design system modular and import from the entry:\n *\n * src/client/index.css → @import './theme/index.css';\n * src/client/theme/index.css → tokens, fonts, base, components…\n *\n * Absolute public URLs (e.g. url('/assets/fonts/…')) and remote @imports\n * are left untouched. Relative url() assets are not rewritten.\n */\n\nimport { createHash } from 'node:crypto';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { mkdir, readdir, unlink, writeFile } from 'node:fs/promises';\nimport { dirname, isAbsolute, join, resolve } from 'node:path';\nimport { loadConfig, resolveAppPaths } from 'reroute-js/core';\n\nconst HASHED_THEME_RE = /^index\\.[a-z0-9]{8,}\\.css$/i;\n\nasync function getCssPaths(cwd: string) {\n\tconst paths = resolveAppPaths(await loadConfig(cwd));\n\tconst input = join(cwd, paths.cssEntry);\n\tconst bundlesDir = join(cwd, '.reroute/bundles');\n\n\treturn { input, bundlesDir };\n}\n\nfunction themeCssFileName(css: string): string {\n\tconst hash = createHash('sha1').update(css).digest('hex').slice(0, 8);\n\treturn `index.${hash}.css`;\n}\n\n/**\n * Match @import with optional url(), quoted/unquoted path, and trailing condition.\n * Examples:\n * @import url('./theme/index.css');\n * @import './theme/index.css';\n * @import url('./print.css') print;\n */\nconst IMPORT_RE =\n\t/@import\\s+(?:url\\(\\s*)?(?:'([^']+)'|\"([^\"]+)\"|([^'\")\\s]+))\\s*\\)?\\s*([^;]*);/g;\n\nfunction isFileImport(specifier: string): boolean {\n\tif (\n\t\tspecifier.startsWith('http://') ||\n\t\tspecifier.startsWith('https://') ||\n\t\tspecifier.startsWith('data:') ||\n\t\tspecifier.startsWith('/')\n\t) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/**\n * Resolve relative @import into a single CSS string. Non-file imports\n * (absolute `/…`, http(s), data, or @import with media conditions) stay as-is.\n */\nexport function bundleCssEntrypoint(entryPath: string): string {\n\treturn walkCssEntrypoint(entryPath).css;\n}\n\n/** Every local file the entry pulls in through @import, entry included. */\nexport function cssEntrypointFiles(entryPath: string): string[] {\n\treturn walkCssEntrypoint(entryPath).files;\n}\n\nfunction walkCssEntrypoint(entryPath: string): {\n\tcss: string;\n\tfiles: string[];\n} {\n\tconst absEntry = resolve(entryPath);\n\tconst stack = new Set<string>();\n\tconst completed = new Set<string>();\n\n\tfunction bundleFile(filePath: string): string {\n\t\tconst absPath = resolve(filePath);\n\n\t\t// Already inlined earlier in this graph — skip duplicates.\n\t\tif (completed.has(absPath)) {\n\t\t\treturn '';\n\t\t}\n\t\tif (stack.has(absPath)) {\n\t\t\tthrow new Error(`[reroute/theme] Circular @import detected: ${absPath}`);\n\t\t}\n\t\tif (!existsSync(absPath)) {\n\t\t\tthrow new Error(`[reroute/theme] Missing CSS import: ${absPath}`);\n\t\t}\n\n\t\tstack.add(absPath);\n\t\tconst source = readFileSync(absPath, 'utf-8');\n\t\tconst baseDir = dirname(absPath);\n\n\t\tconst bundled = source.replace(\n\t\t\tIMPORT_RE,\n\t\t\t(full, single: string, double: string, bare: string, rest: string) => {\n\t\t\t\tconst specifier = single || double || bare;\n\t\t\t\tconst condition = (rest ?? '').trim();\n\n\t\t\t\t// Keep conditional / non-file imports for the browser to resolve.\n\t\t\t\tif (condition || !isFileImport(specifier)) {\n\t\t\t\t\treturn full;\n\t\t\t\t}\n\n\t\t\t\tconst importedPath = isAbsolute(specifier)\n\t\t\t\t\t? specifier\n\t\t\t\t\t: resolve(baseDir, specifier);\n\n\t\t\t\treturn `/* ${specifier} */\\n${bundleFile(importedPath)}\\n`;\n\t\t\t},\n\t\t);\n\n\t\tstack.delete(absPath);\n\t\tcompleted.add(absPath);\n\t\treturn bundled;\n\t}\n\n\tconst css = bundleFile(absEntry);\n\treturn { css, files: [...completed] };\n}\n\nasync function pruneStaleThemeCss(\n\tbundlesDir: string,\n\tkeep: string,\n): Promise<void> {\n\tconst files = await readdir(bundlesDir);\n\tfor (const file of files) {\n\t\tif (HASHED_THEME_RE.test(file) && file !== keep) {\n\t\t\tawait unlink(join(bundlesDir, file));\n\t\t}\n\t}\n}\n\n/**\n * Bundle index.css (with @import resolution) into .reroute/bundles.\n * Returns true if a sync was performed, false if skipped.\n */\nexport async function syncThemeCss(cwd: string): Promise<boolean> {\n\tconst { input, bundlesDir } = await getCssPaths(cwd);\n\n\tif (!existsSync(input)) {\n\t\treturn false;\n\t}\n\n\tawait mkdir(bundlesDir, { recursive: true });\n\n\ttry {\n\t\tconst css = bundleCssEntrypoint(input);\n\t\tconst hashedName = themeCssFileName(css);\n\t\tawait writeFile(join(bundlesDir, 'index.css'), css, 'utf-8');\n\t\tawait writeFile(join(bundlesDir, hashedName), css, 'utf-8');\n\t\tawait pruneStaleThemeCss(bundlesDir, hashedName);\n\t} catch (err) {\n\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\tif (message.startsWith('[reroute/theme]')) {\n\t\t\tthrow err;\n\t\t}\n\t\tthrow new Error(`[reroute/theme] Failed to bundle index.css:\\n${message}`);\n\t}\n\n\tconsole.log('[reroute/theme] synced /bundles/index.css');\n\treturn true;\n}\n",
|
|
62
62
|
"import path from 'node:path';\n\n// Version and commit injected at build time\ndeclare const __REROUTE_VERSION__: string;\ndeclare const __REROUTE_COMMIT__: string;\n\nexport async function getVersionString(): Promise<string> {\n\tconst version = await getVersion();\n\tconst commit = await getCommit();\n\treturn `Reroute v${version} ${commit}`;\n}\n\nasync function getVersion(): Promise<string> {\n\t// Use version injected at build time\n\tif (typeof __REROUTE_VERSION__ !== 'undefined') {\n\t\treturn __REROUTE_VERSION__;\n\t}\n\n\t// Fallback for development: try to find package.json\n\tconst possiblePaths = [\n\t\tpath.join(import.meta.dir, '../../../../package.json'),\n\t\tpath.join(import.meta.dir, '../../../package.json'),\n\t\tpath.join(import.meta.dir, '../../package.json'),\n\t\tpath.join(import.meta.dir, '../package.json'),\n\t];\n\n\tfor (const pkgPath of possiblePaths) {\n\t\ttry {\n\t\t\tconst pkg = await Bun.file(pkgPath).json();\n\t\t\treturn pkg.version;\n\t\t} catch {}\n\t}\n\n\treturn 'unknown';\n}\n\nasync function getCommit(): Promise<string> {\n\t// Use commit injected at build time\n\tif (typeof __REROUTE_COMMIT__ !== 'undefined') {\n\t\treturn __REROUTE_COMMIT__;\n\t}\n\n\t// Fallback for development\n\treturn 'dev';\n}\n"
|
|
63
63
|
],
|
|
64
64
|
"mappings": ";;;;;;;;;;;;;;AAAA;AAkBA,SAAS,OAAO,CAAC,GAAmB;AAAA,EACnC,OAAO,EAAE,QAAQ,OAAO,GAAG;AAAA;AAO5B,SAAS,eAAe,CAAC,SAAwB,CAAC,GAAa;AAAA,EAC9D,MAAM,MAAM,OAAO,KAAK,OAAO;AAAA,EAC/B,MAAM,SAAS,OAAO,KAAK,UAAU;AAAA,EACrC,MAAM,YAAY,QAAQ,MAAM,QAAQ,GAAG,CAAC;AAAA,EAE5C,OAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA,WAAW,QAAQ,MAAM,KAAK,WAAW,QAAQ,CAAC;AAAA,IAClD,UAAU,QAAQ,MAAM,KAAK,WAAW,WAAW,CAAC;AAAA,IACpD,WAAW,QAAQ,MAAM,KAAK,WAAW,QAAQ,CAAC;AAAA,IAClD;AAAA,EACD;AAAA;AAAA,IAnCK,kBAAkB,oBAClB,qBAAqB;AAAA;;;;;ACJ3B;AAulCA,eAAe,UAAU,CAAC,KAAqC;AAAA,EAE9D,MAAM,gBAAiB,WACrB;AAAA,EACF,IAAI,eAAe;AAAA,IAClB,OAAO;AAAA,EACR;AAAA,EAGA,MAAM,aAAa,GAAG;AAAA,EACtB,MAAM,aAAa,IAAI,KAAK,UAAU;AAAA,EAEtC,IAAI,CAAE,MAAM,WAAW,OAAO,GAAI;AAAA,IACjC,OAAO,CAAC;AAAA,EACT;AAAA,EAEA,IAAI;AAAA,IACH,MAAM,MAAM,MACX,UAAG,cAAc,UA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
|
-
"debugId": "
|
|
65
|
+
"debugId": "71A8AD78AD69FA4D64756E2164756E21",
|
|
66
66
|
"names": []
|
|
67
67
|
}
|
package/cli/src/cli.d.ts
CHANGED
package/cli/src/commands/og.d.ts
CHANGED
package/cli/src/index.d.ts
CHANGED
package/core/index.d.ts
CHANGED
package/core/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v1.0.0-alpha.
|
|
2
|
+
* reroute-js v1.0.0-alpha.45
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -7084,4 +7084,4 @@ export {
|
|
|
7084
7084
|
toPromise
|
|
7085
7085
|
};
|
|
7086
7086
|
|
|
7087
|
-
//# debugId=
|
|
7087
|
+
//# debugId=888B0459411D793D64756E2164756E21
|