heliumts 0.9.7 → 0.10.0
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 +37 -12
- package/dist/bin/helium.js +15 -10
- package/dist/bin/helium.js.map +1 -1
- package/dist/client/Router.d.ts.map +1 -1
- package/dist/client/Router.js +2 -4
- package/dist/client/Router.js.map +1 -1
- package/dist/client/callMethod.d.ts +2 -7
- package/dist/client/callMethod.d.ts.map +1 -1
- package/dist/client/callMethod.js +4 -5
- package/dist/client/callMethod.js.map +1 -1
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/rpcClient.d.ts +7 -41
- package/dist/client/rpcClient.d.ts.map +1 -1
- package/dist/client/rpcClient.js +118 -752
- package/dist/client/rpcClient.js.map +1 -1
- package/dist/client/rpcStreaming.d.ts +10 -0
- package/dist/client/rpcStreaming.d.ts.map +1 -0
- package/dist/client/rpcStreaming.js +125 -0
- package/dist/client/rpcStreaming.js.map +1 -0
- package/dist/client/useStreaming.d.ts +26 -0
- package/dist/client/useStreaming.d.ts.map +1 -0
- package/dist/client/useStreaming.js +126 -0
- package/dist/client/useStreaming.js.map +1 -0
- package/dist/runtime/protocol.d.ts +14 -0
- package/dist/runtime/protocol.d.ts.map +1 -1
- package/dist/runtime/protocol.js +3 -1
- package/dist/runtime/protocol.js.map +1 -1
- package/dist/server/config.d.ts +16 -101
- package/dist/server/config.d.ts.map +1 -1
- package/dist/server/config.js +5 -27
- package/dist/server/config.js.map +1 -1
- package/dist/server/context.d.ts +8 -6
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/context.js.map +1 -1
- package/dist/server/defineWorker.d.ts +1 -1
- package/dist/server/defineWorker.d.ts.map +1 -1
- package/dist/server/defineWorker.js +2 -1
- package/dist/server/defineWorker.js.map +1 -1
- package/dist/server/devServer.d.ts +1 -1
- package/dist/server/devServer.d.ts.map +1 -1
- package/dist/server/devServer.js +13 -235
- package/dist/server/devServer.js.map +1 -1
- package/dist/server/httpRouter.d.ts.map +1 -1
- package/dist/server/httpRouter.js +5 -2
- package/dist/server/httpRouter.js.map +1 -1
- package/dist/server/httpRpc.d.ts +10 -0
- package/dist/server/httpRpc.d.ts.map +1 -0
- package/dist/server/httpRpc.js +186 -0
- package/dist/server/httpRpc.js.map +1 -0
- package/dist/server/prodServer.d.ts +3 -1
- package/dist/server/prodServer.d.ts.map +1 -1
- package/dist/server/prodServer.js +36 -214
- package/dist/server/prodServer.js.map +1 -1
- package/dist/server/rateLimiter.d.ts +6 -36
- package/dist/server/rateLimiter.d.ts.map +1 -1
- package/dist/server/rateLimiter.js +18 -125
- package/dist/server/rateLimiter.js.map +1 -1
- package/dist/server/requestSignal.d.ts +10 -0
- package/dist/server/requestSignal.d.ts.map +1 -0
- package/dist/server/requestSignal.js +79 -0
- package/dist/server/requestSignal.js.map +1 -0
- package/dist/server/rpcRegistry.d.ts +10 -22
- package/dist/server/rpcRegistry.d.ts.map +1 -1
- package/dist/server/rpcRegistry.js +181 -274
- package/dist/server/rpcRegistry.js.map +1 -1
- package/dist/vite/heliumPlugin.d.ts.map +1 -1
- package/dist/vite/heliumPlugin.js +73 -43
- package/dist/vite/heliumPlugin.js.map +1 -1
- package/dist/vite/ssg.d.ts.map +1 -1
- package/dist/vite/ssg.js +16 -1
- package/dist/vite/ssg.js.map +1 -1
- package/package.json +2 -4
package/dist/vite/ssg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssg.js","sourceRoot":"","sources":["../../src/vite/ssg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,gBAAg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C,CAAC;YAChB,GAAG,CAAC,MAAM,EAAE,sBAAsB,YAAY,oBAAoB,YAAY,cAAc,CAAC,CAAC;QAClG,CAAC;IACL,CAAC;YAAS,CAAC;QACP,yDAAyD;QACzD,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;AACL,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nimport { replaceHtmlRootContents } from \"../utils/html.js\";\nimport { log } from \"../utils/logger.js\";\nimport { hasPageDirective, isPageFile, scanAppShell, scanServerExports } from \"./scanner.js\";\nimport { generateClientModule } from \"./virtualServerModule.js\";\n\n/**\n * SSG (Static Site Generation) implementation for Helium\n *\n * Scans pages directory for files with \"use ssg\"; directive and generates\n * static HTML for them at build time.\n */\n\ninterface SSGPage {\n filePath: string;\n urlPath: string;\n relativePath: string;\n warnings: string[];\n}\n\ninterface SSGValidation {\n hasHooks: boolean;\n hasClientImports: boolean;\n hasServerImports: boolean;\n warnings: string[];\n}\n\n/**\n * Remove string literals from content to avoid false positives when checking for patterns\n * This removes template literals, single-quoted strings, and double-quoted strings\n * @internal Exported for testing\n */\nexport function stripStringLiterals(content: string): string {\n // Remove template literals (backtick strings) - handle nested expressions\n let result = content;\n\n // Remove template literals with their content (simplified - doesn't handle all edge cases but good enough)\n result = result.replace(/`(?:[^`\\\\]|\\\\.)*`/g, '\"\"');\n\n // Remove double-quoted strings\n result = result.replace(/\"(?:[^\"\\\\]|\\\\.)*\"/g, '\"\"');\n\n // Remove single-quoted strings\n result = result.replace(/'(?:[^'\\\\]|\\\\.)*'/g, \"''\");\n\n // Also remove JSX text content between tags (but not the tags themselves)\n // This helps with cases like <code>useState</code>\n result = result.replace(/>([^<]+)</g, \"><\");\n\n return result;\n}\n\n/**\n * Validate if a page file can be truly statically generated\n * Checks for React hooks and helium imports that would prevent static generation\n * @internal Exported for testing\n */\nexport function validateSSGPage(filePath: string): SSGValidation {\n const rawContent = fs.readFileSync(filePath, \"utf-8\");\n const warnings: string[] = [];\n\n // Strip string literals and JSX text to avoid false positives\n const content = stripStringLiterals(rawContent);\n\n // Check for React hooks (common ones)\n const hookPatterns = [\n /\\buse(State|Effect|Context|Reducer|Callback|Memo|Ref|ImperativeHandle|LayoutEffect|DebugValue)\\s*\\(/,\n /\\buse[A-Z]\\w+\\s*\\(/, // Custom hooks (useXxx) - must be followed by ( to be a call\n ];\n\n const hasHooks = hookPatterns.some((pattern) => pattern.test(content));\n if (hasHooks) {\n warnings.push(\"Page uses React hooks which may cause hydration issues\");\n }\n\n // Check for heliumts/client imports - use raw content since imports should be at top level\n const hasClientImports = /^import\\s+.*from\\s+['\"]heliumts\\/client['\"]/m.test(rawContent);\n if (hasClientImports) {\n warnings.push(\"Page imports from 'heliumts/client' which requires client-side execution\");\n }\n\n // Check for heliumts/server imports - use raw content since imports should be at top level\n const hasServerImports = /^import\\s+.*from\\s+['\"]heliumts\\/server['\"]/m.test(rawContent);\n if (hasServerImports) {\n warnings.push(\"Page imports from 'heliumts/server' which may cause runtime issues\");\n }\n\n return {\n hasHooks,\n hasClientImports,\n hasServerImports,\n warnings,\n };\n}\n\n/**\n * Scan pages directory and find all pages with \"use ssg\" directive\n */\nexport function scanSSGPages(root: string): SSGPage[] {\n const pagesDir = path.join(root, \"src\", \"pages\");\n\n if (!fs.existsSync(pagesDir)) {\n return [];\n }\n\n const ssgPages: SSGPage[] = [];\n\n function walkDirectory(dir: string) {\n const items = fs.readdirSync(dir);\n\n for (const item of items) {\n const fullPath = path.join(dir, item);\n const stat = fs.statSync(fullPath);\n\n if (stat.isDirectory()) {\n walkDirectory(fullPath);\n } else if (isPageFile(item)) {\n const content = fs.readFileSync(fullPath, \"utf-8\");\n\n // Check for \"use ssg\"; directive at the top of the file\n if (hasPageDirective(content, \"use ssg\")) {\n const relativePath = path.relative(path.join(root, \"src\"), fullPath);\n const urlPath = filePathToUrlPath(relativePath);\n\n // Validate the page for SSG compatibility\n const validation = validateSSGPage(fullPath);\n const warnings = [...validation.warnings];\n\n // Also check all layouts for this page\n const layoutPaths = findLayoutPathsForPage(fullPath, root);\n for (const layoutPath of layoutPaths) {\n const layoutValidation = validateSSGPage(layoutPath);\n if (layoutValidation.warnings.length > 0) {\n const layoutRelative = path.relative(path.join(root, \"src\"), layoutPath);\n warnings.push(`Layout ${layoutRelative} has issues:`);\n for (const warning of layoutValidation.warnings) {\n warnings.push(` └─ ${warning}`);\n }\n }\n }\n\n ssgPages.push({\n filePath: fullPath,\n urlPath,\n relativePath,\n warnings,\n });\n }\n }\n }\n }\n\n walkDirectory(pagesDir);\n return ssgPages;\n}\n\n/**\n * Convert file path to URL path\n * pages/index.tsx -> /\n * pages/about.tsx -> /about\n * pages/blog/post.tsx -> /blog/post\n * pages/(website)/contact.tsx -> /contact\n * pages/(portal)/dashboard.tsx -> /dashboard\n * @internal Exported for testing\n */\nexport function filePathToUrlPath(relativePath: string): string {\n // Remove 'pages/' prefix and file extension\n let urlPath = relativePath\n .replace(/\\\\/g, \"/\")\n .replace(/^pages\\//, \"\")\n .replace(/\\.(tsx|jsx|ts|js)$/, \"\");\n\n // Remove route groups (folders in parentheses)\n // E.g., (website)/contact -> /contact\n urlPath = urlPath.replace(/\\([^)]+\\)\\//g, \"\");\n\n // Handle index files\n if (urlPath.endsWith(\"/index\") || urlPath === \"index\") {\n urlPath = urlPath.replace(/\\/index$/, \"\").replace(/^index$/, \"\");\n }\n\n // Ensure leading slash\n if (!urlPath.startsWith(\"/\")) {\n urlPath = \"/\" + urlPath;\n }\n\n // Root path\n if (urlPath === \"/\") {\n return \"/\";\n }\n\n return urlPath;\n}\n\n/**\n * Convert URL path to output file path\n * / -> __index.html (special case - renamed later to prevent conflicts)\n * /about -> about.html\n * /blog/post -> blog/post.html\n * @internal Exported for testing\n */\nexport function urlPathToOutputPath(urlPath: string): string {\n if (urlPath === \"/\") {\n return \"__index.html\";\n }\n\n // Remove leading slash and add .html extension\n const cleanPath = urlPath.replace(/^\\//, \"\");\n return `${cleanPath}.html`;\n}\n\n/**\n * Find all layout file paths for a given page path (from root to leaf)\n * @internal Exported for testing\n */\nexport function findLayoutPathsForPage(pagePath: string, root: string): string[] {\n const pagesDir = path.join(root, \"src\", \"pages\");\n const relativePath = path.relative(pagesDir, pagePath);\n const pathParts = path\n .dirname(relativePath)\n .split(path.sep)\n .filter((p) => p !== \".\");\n\n const layoutPaths: string[] = [];\n\n const layoutNames = [\"_layout.tsx\", \"_layout.jsx\", \"_layout.ts\", \"_layout.js\"];\n for (let i = 0; i <= pathParts.length; i++) {\n const dirPath = path.join(pagesDir, ...pathParts.slice(0, i));\n const layoutPath = layoutNames.map((name) => path.join(dirPath, name)).find((candidate) => fs.existsSync(candidate));\n if (layoutPath) {\n layoutPaths.push(layoutPath);\n }\n }\n\n return layoutPaths;\n}\n\n/**\n * Find all layout components for a given page path (from root to leaf)\n * Note: Layouts cannot use routing features during SSG since they're pre-rendered\n */\nasync function findLayoutsForPage(pagePath: string, root: string, viteServer: any): Promise<any[]> {\n const layoutPaths = findLayoutPathsForPage(pagePath, root);\n const layouts = [];\n\n for (const layoutPath of layoutPaths) {\n try {\n const layoutModule = await viteServer.ssrLoadModule(layoutPath);\n if (layoutModule.default) {\n layouts.push(layoutModule.default);\n }\n } catch (error) {\n log(\"warn\", `Could not load layout at ${layoutPath}: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n return layouts;\n}\n\n/**\n * Render a page component to static HTML using Vite SSR with timeout\n */\nexport async function renderPageToHTML(page: SSGPage, root: string, htmlTemplate: string, viteServer: any, timeout: number = 10000): Promise<string> {\n // Create timeout promise\n let timeoutId: ReturnType<typeof setTimeout>;\n const timeoutPromise = new Promise<string>((_, reject) => {\n timeoutId = setTimeout(() => {\n reject(new Error(`Rendering timeout after ${timeout}ms - page may contain hooks or async operations`));\n }, timeout);\n });\n\n // Create render promise\n const renderPromise = (async () => {\n try {\n // Dynamically import React and ReactDOMServer\n const React = (await import(\"react\")).default;\n const ReactDOMServer = await import(\"react-dom/server\");\n\n // Use Vite's SSR loader to load the page component\n const pageModule = await viteServer.ssrLoadModule(page.filePath);\n const PageComponent = pageModule.default;\n\n if (!PageComponent) {\n throw new Error(`No default export found in ${page.relativePath}`);\n }\n\n // Find all layouts (from root to leaf)\n const layouts = await findLayoutsForPage(page.filePath, root, viteServer);\n\n // Build the component tree: layouts wrap the page, innermost to outermost\n const pageProps = { params: {}, searchParams: new URLSearchParams() };\n const WrappedPage = () => {\n let content: any = React.createElement(PageComponent, pageProps);\n for (let i = layouts.length - 1; i >= 0; i--) {\n content = React.createElement(layouts[i], { children: content });\n }\n return content;\n };\n const appShellPath = scanAppShell(root);\n const appShellModule = appShellPath ? await viteServer.ssrLoadModule(appShellPath) : null;\n const AppShell = appShellModule ? (appShellModule.default ?? appShellModule.App ?? appShellModule.app) : null;\n let element: any = AppShell\n ? React.createElement(AppShell, { Component: WrappedPage, pageProps, children: React.createElement(WrappedPage) })\n : React.createElement(WrappedPage);\n\n // Load RouterContext from our stub\n const heliumClient = await viteServer.ssrLoadModule(\"heliumts/client\");\n const RouterContext = heliumClient.RouterContext;\n\n // Mock Router Context with the page's URL\n const routerValue = {\n path: page.urlPath,\n params: {},\n searchParams: new URLSearchParams(),\n push: () => {},\n replace: () => {},\n on: () => () => {},\n status: 200,\n };\n\n // Wrap with RouterContext\n if (RouterContext) {\n element = React.createElement(RouterContext.Provider, { value: routerValue }, element);\n }\n\n // Render to static HTML\n const markup = ReactDOMServer.renderToString(element);\n\n // Inject the markup into the HTML template with the SSG marker\n const finalHtml = replaceHtmlRootContents(htmlTemplate, markup, { \"data-ssg-page\": page.urlPath, \"data-ssg-failed\": null });\n\n return finalHtml;\n } catch (error) {\n log(\"error\", `Failed to render ${page.relativePath}:`, error);\n throw error; // Don't fallback, let the caller handle the error\n }\n })();\n\n // Race between timeout and render\n try {\n return await Promise.race([renderPromise, timeoutPromise]);\n } finally {\n clearTimeout(timeoutId!);\n }\n}\n\n/**\n * Generate static HTML files for all SSG pages\n */\nexport async function generateStaticPages(context: any, root: string, htmlTemplate: string, distDir: string) {\n // Scan for SSG pages\n const ssgPages = scanSSGPages(root);\n\n if (ssgPages.length === 0) {\n return;\n }\n\n log(\"info\", `Generating ${ssgPages.length} static page(s) for SSG...`);\n\n // Check for dynamic routes (not supported yet)\n const dynamicPages = ssgPages.filter((p) => p.relativePath.includes(\"[\"));\n if (dynamicPages.length > 0) {\n log(\"warn\", `Skipping ${dynamicPages.length} dynamic route(s) - not yet supported:\\n` + dynamicPages.map((p) => ` - ${p.relativePath}`).join(\"\\n\"));\n }\n\n // Filter out dynamic routes\n const staticPages = ssgPages.filter((p) => !p.relativePath.includes(\"[\"));\n\n // Precompute RPC client stubs for SSG (mirrors helium Vite plugin)\n const { methods } = scanServerExports(root);\n const serverStubCode = `// Auto-generated SSG RPC stub\\n${generateClientModule(methods)}\\n`;\n\n // Create a stub for heliumts/client that provides mock Router and hooks\n const clientStubCode = `\n// Auto-generated SSG client stub\nimport React from 'react';\n\n// Mock RouterContext\nexport const RouterContext = React.createContext({\n path: '/',\n params: {},\n searchParams: new URLSearchParams(),\n push: () => {},\n replace: () => {},\n on: () => () => {},\n status: 200,\n isNavigating: false,\n isPending: false,\n});\n\n// Mock useRouter hook\nexport function useRouter() {\n const ctx = React.useContext(RouterContext);\n if (!ctx) {\n console.warn('useRouter called outside RouterContext during SSG');\n return {\n path: '/',\n params: {},\n searchParams: new URLSearchParams(),\n push: () => {},\n replace: () => {},\n on: () => () => {},\n status: 200,\n isNavigating: false,\n isPending: false,\n };\n }\n return ctx;\n}\n\n// Mock AppRouter component (alias for Router)\nexport function AppRouter({ children }) {\n return React.createElement(React.Fragment, null, children);\n}\n\n// Mock Router component\nexport function Router({ children }) {\n return React.createElement(React.Fragment, null, children);\n}\n\n// Mock Link component\nexport function Link({ href, children, prefetch, ...props }) {\n return React.createElement('a', { href, ...props }, children);\n}\n\n// Mock Redirect component\nexport function Redirect({ to, replace }) {\n return null;\n}\n\n// Mock useCall hook\nexport async function callMethod() {\n throw new Error('callMethod is only available in the browser. Load server data with getServerSideProps instead.');\n}\n\nexport function useCall(serverFn) {\n return { call: async () => null, isCalling: false, error: null };\n}\n\n// Mock useFetch hook\nexport function useFetch(serverFn, ...args) {\n console.warn('useFetch called during SSG - returning null');\n return { data: null, isLoading: false, error: null, refetch: async () => {} };\n}\n\nexport function isSSR() { return true; }\nexport function getPublicEnv() {\n return Object.fromEntries(Object.entries(process.env).filter(([key, value]) => key.startsWith('HELIUM_PUBLIC_') && typeof value === 'string'));\n}\nexport function getPublicEnvValue(key) { return getPublicEnv()[key]; }\nexport function isDevEnvironment() { return false; }\nexport class RpcError extends Error {}\n\n// Re-export cache (mock)\nexport const cache = {\n get: () => null,\n set: () => {},\n delete: () => {},\n clear: () => {},\n};\n\n// Mock PageTransition and useDeferredNavigation (also available from heliumts/client/transitions)\nexport function useDeferredNavigation() {\n const { path } = useRouter();\n return {\n path,\n deferredPath: path,\n isStale: false,\n isPending: false,\n isTransitioning: false,\n };\n}\n\nexport function PageTransition({ children, fallback = null }) {\n return React.createElement('div', { style: { opacity: 1, transition: 'opacity 150ms ease' } },\n React.createElement(React.Suspense, { fallback }, children));\n}\n`;\n\n // Create a stub for heliumts/client/transitions\n const transitionsStubCode = `\n// Auto-generated SSG transitions stub\nimport React from 'react';\nimport { useRouter } from 'heliumts/client';\n\n// Mock useDeferredNavigation hook - returns static values for SSG\nexport function useDeferredNavigation() {\n const { path } = useRouter();\n return {\n path,\n deferredPath: path,\n isStale: false,\n isPending: false,\n isTransitioning: false,\n };\n}\n\n// Mock PageTransition component - renders children without transition logic\nexport function PageTransition({ children, fallback = null }) {\n return React.createElement('div', { style: { opacity: 1, transition: 'opacity 150ms ease' } },\n React.createElement(React.Suspense, { fallback }, children));\n}\n\nexport default {\n useDeferredNavigation,\n PageTransition,\n};\n`;\n\n // Create a stub for heliumts/client/prefetch\n const prefetchStubCode = `\n// Auto-generated SSG prefetch stub\nexport function prefetchRoute() {\n // No-op during SSG\n}\n\nexport function clearPrefetchCache() {\n // No-op during SSG\n}\n`;\n\n // Write stub files to node_modules/.heliumts\n const heliumInternalDir = path.join(root, \"node_modules\", \".heliumts\");\n if (!fs.existsSync(heliumInternalDir)) {\n fs.mkdirSync(heliumInternalDir, { recursive: true });\n }\n const ssgServerStubPath = path.join(heliumInternalDir, \"ssg-server-stub.mjs\");\n const ssgClientStubPath = path.join(heliumInternalDir, \"ssg-client-stub.mjs\");\n const ssgTransitionsStubPath = path.join(heliumInternalDir, \"ssg-transitions-stub.mjs\");\n const ssgPrefetchStubPath = path.join(heliumInternalDir, \"ssg-prefetch-stub.mjs\");\n fs.writeFileSync(ssgServerStubPath, serverStubCode, \"utf-8\");\n fs.writeFileSync(ssgClientStubPath, clientStubCode, \"utf-8\");\n fs.writeFileSync(ssgTransitionsStubPath, transitionsStubCode, \"utf-8\");\n fs.writeFileSync(ssgPrefetchStubPath, prefetchStubCode, \"utf-8\");\n\n // Create a temporary Vite server for SSR rendering\n const { createServer } = await import(\"vite\");\n const heliumPlugin = (await import(\"./heliumPlugin.js\")).default;\n\n const viteServer = await createServer({\n root,\n mode: \"production\",\n server: { middlewareMode: true },\n appType: \"custom\",\n logLevel: \"error\",\n plugins: [heliumPlugin()],\n resolve: {\n alias: [\n // Most specific aliases first - heliumts/client/transitions and heliumts/client/prefetch\n { find: /^heliumts\\/client\\/transitions$/, replacement: ssgTransitionsStubPath },\n { find: /^heliumts\\/client\\/prefetch$/, replacement: ssgPrefetchStubPath },\n // Then heliumts/client and heliumts/server\n { find: /^heliumts\\/client$/, replacement: ssgClientStubPath },\n { find: /^heliumts\\/server$/, replacement: ssgServerStubPath },\n ],\n },\n ssr: {\n external: [\"react\", \"react-dom\"],\n // Don't externalize heliumts packages - we want to use our stubs\n noExternal: [\"heliumts\"],\n },\n });\n\n try {\n // Generate HTML for each static page\n const zlib = await import(\"zlib\");\n let successCount = 0;\n let failureCount = 0;\n let hasIndexSSG = false;\n\n // Calculate max path length for proper alignment (min 35, max 80)\n const maxPathLength = Math.min(80, Math.max(35, ...staticPages.map((p) => urlPathToOutputPath(p.urlPath).length)));\n\n for (const page of staticPages) {\n try {\n // Render the page component to static HTML using Vite SSR with 10s timeout\n const html = await renderPageToHTML(page, root, htmlTemplate, viteServer, 10000);\n const outputPath = urlPathToOutputPath(page.urlPath);\n const fullOutputPath = path.join(distDir, outputPath);\n\n // Track if the root page (/) has SSG\n if (page.urlPath === \"/\") {\n hasIndexSSG = true;\n }\n\n // Ensure directory exists\n const outputDir = path.dirname(fullOutputPath);\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n\n // Write the HTML file\n fs.writeFileSync(fullOutputPath, html, \"utf-8\");\n\n // Calculate file size and gzipped size\n const size = Buffer.byteLength(html, \"utf-8\");\n const sizeKB = (size / 1024).toFixed(2);\n\n // Calculate gzipped size\n const gzipped = zlib.gzipSync(html);\n const gzipSizeKB = (gzipped.length / 1024).toFixed(2);\n\n log(\"info\", ` ${outputPath.padEnd(maxPathLength)} ${sizeKB.padStart(8)} kB │ gzip: ${gzipSizeKB.padStart(7)} kB`);\n successCount++;\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : String(error);\n if (errorMsg.includes(\"timeout\")) {\n log(\"error\", ` ✗ ${page.relativePath} - ${errorMsg}`);\n } else {\n log(\"error\", ` ✗ ${page.relativePath} - Failed to generate:`, error);\n }\n\n // Write a fallback HTML file with empty root div (client will hydrate)\n const outputPath = urlPathToOutputPath(page.urlPath);\n const fullOutputPath = path.join(distDir, outputPath);\n const outputDir = path.dirname(fullOutputPath);\n\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n\n const fallbackHtml = replaceHtmlRootContents(htmlTemplate, \"\", { \"data-ssg-page\": null, \"data-ssg-failed\": page.urlPath });\n fs.writeFileSync(fullOutputPath, fallbackHtml, \"utf-8\");\n\n failureCount++;\n }\n }\n\n // If index page has SSG, we need to handle it specially:\n // 1. Rename __index.html to index.ssg.html (the SSG version)\n // 2. Create a clean blank index.html as fallback for non-root routes\n if (hasIndexSSG) {\n const tempIndexPath = path.join(distDir, \"__index.html\");\n const ssgIndexPath = path.join(distDir, \"index.ssg.html\");\n const indexPath = path.join(distDir, \"index.html\");\n\n // Move __index.html to index.ssg.html\n if (fs.existsSync(tempIndexPath)) {\n fs.renameSync(tempIndexPath, ssgIndexPath);\n }\n\n // Create a blank index.html as the SPA fallback\n const blankIndexHtml = replaceHtmlRootContents(htmlTemplate, \"\", { \"data-ssg-page\": null, \"data-ssg-failed\": null });\n fs.writeFileSync(indexPath, blankIndexHtml, \"utf-8\");\n\n log(\"info\", ` ${\"index.ssg.html\".padEnd(maxPathLength)} (SSG root page)`);\n log(\"info\", ` ${\"index.html\".padEnd(maxPathLength)} (blank SPA fallback)`);\n }\n\n // Summary\n if (failureCount > 0) {\n log(\"warn\", \"\");\n log(\"warn\", `SSG completed with ${successCount} success(es) and ${failureCount} failure(s).`);\n }\n } finally {\n // Always close the Vite server, even if generation fails\n await viteServer.close();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ssg.js","sourceRoot":"","sources":["../../src/vite/ssg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAuBhE;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe;IAC/C,0EAA0E;IAC1E,IAAI,MAAM,GAAG,OAAO,CAAC;IAErB,2GAA2G;IAC3G,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;IAE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;QACrE,IAAI,WAAW,EAAE,CAAC;YACd,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;YACzD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;YAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YAEnD,sCAAsC;YACtC,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;gBAC/B,EAAE,CAAC,UAAU,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;YAC/C,CAAC;YAED,gDAAgD;YAChD,MAAM,cAAc,GAAG,uBAAuB,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;YACrH,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;YAErD,GAAG,CAAC,MAAM,EAAE,KAAK,gBAAgB,CAAC,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;YAC3E,GAAG,CAAC,MAAM,EAAE,KAAK,YAAY,CAAC,MAAM,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC;QAChF,CAAC;QAED,UAAU;QACV,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACnB,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAChB,GAAG,CAAC,MAAM,EAAE,sBAAsB,YAAY,oBAAoB,YAAY,cAAc,CAAC,CAAC;QAClG,CAAC;IACL,CAAC;YAAS,CAAC;QACP,yDAAyD;QACzD,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;AACL,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nimport { replaceHtmlRootContents } from \"../utils/html.js\";\nimport { log } from \"../utils/logger.js\";\nimport { hasPageDirective, isPageFile, scanAppShell, scanServerExports } from \"./scanner.js\";\nimport { generateClientModule } from \"./virtualServerModule.js\";\n\n/**\n * SSG (Static Site Generation) implementation for Helium\n *\n * Scans pages directory for files with \"use ssg\"; directive and generates\n * static HTML for them at build time.\n */\n\ninterface SSGPage {\n filePath: string;\n urlPath: string;\n relativePath: string;\n warnings: string[];\n}\n\ninterface SSGValidation {\n hasHooks: boolean;\n hasClientImports: boolean;\n hasServerImports: boolean;\n warnings: string[];\n}\n\n/**\n * Remove string literals from content to avoid false positives when checking for patterns\n * This removes template literals, single-quoted strings, and double-quoted strings\n * @internal Exported for testing\n */\nexport function stripStringLiterals(content: string): string {\n // Remove template literals (backtick strings) - handle nested expressions\n let result = content;\n\n // Remove template literals with their content (simplified - doesn't handle all edge cases but good enough)\n result = result.replace(/`(?:[^`\\\\]|\\\\.)*`/g, '\"\"');\n\n // Remove double-quoted strings\n result = result.replace(/\"(?:[^\"\\\\]|\\\\.)*\"/g, '\"\"');\n\n // Remove single-quoted strings\n result = result.replace(/'(?:[^'\\\\]|\\\\.)*'/g, \"''\");\n\n // Also remove JSX text content between tags (but not the tags themselves)\n // This helps with cases like <code>useState</code>\n result = result.replace(/>([^<]+)</g, \"><\");\n\n return result;\n}\n\n/**\n * Validate if a page file can be truly statically generated\n * Checks for React hooks and helium imports that would prevent static generation\n * @internal Exported for testing\n */\nexport function validateSSGPage(filePath: string): SSGValidation {\n const rawContent = fs.readFileSync(filePath, \"utf-8\");\n const warnings: string[] = [];\n\n // Strip string literals and JSX text to avoid false positives\n const content = stripStringLiterals(rawContent);\n\n // Check for React hooks (common ones)\n const hookPatterns = [\n /\\buse(State|Effect|Context|Reducer|Callback|Memo|Ref|ImperativeHandle|LayoutEffect|DebugValue)\\s*\\(/,\n /\\buse[A-Z]\\w+\\s*\\(/, // Custom hooks (useXxx) - must be followed by ( to be a call\n ];\n\n const hasHooks = hookPatterns.some((pattern) => pattern.test(content));\n if (hasHooks) {\n warnings.push(\"Page uses React hooks which may cause hydration issues\");\n }\n\n // Check for heliumts/client imports - use raw content since imports should be at top level\n const hasClientImports = /^import\\s+.*from\\s+['\"]heliumts\\/client['\"]/m.test(rawContent);\n if (hasClientImports) {\n warnings.push(\"Page imports from 'heliumts/client' which requires client-side execution\");\n }\n\n // Check for heliumts/server imports - use raw content since imports should be at top level\n const hasServerImports = /^import\\s+.*from\\s+['\"]heliumts\\/server['\"]/m.test(rawContent);\n if (hasServerImports) {\n warnings.push(\"Page imports from 'heliumts/server' which may cause runtime issues\");\n }\n\n return {\n hasHooks,\n hasClientImports,\n hasServerImports,\n warnings,\n };\n}\n\n/**\n * Scan pages directory and find all pages with \"use ssg\" directive\n */\nexport function scanSSGPages(root: string): SSGPage[] {\n const pagesDir = path.join(root, \"src\", \"pages\");\n\n if (!fs.existsSync(pagesDir)) {\n return [];\n }\n\n const ssgPages: SSGPage[] = [];\n\n function walkDirectory(dir: string) {\n const items = fs.readdirSync(dir);\n\n for (const item of items) {\n const fullPath = path.join(dir, item);\n const stat = fs.statSync(fullPath);\n\n if (stat.isDirectory()) {\n walkDirectory(fullPath);\n } else if (isPageFile(item)) {\n const content = fs.readFileSync(fullPath, \"utf-8\");\n\n // Check for \"use ssg\"; directive at the top of the file\n if (hasPageDirective(content, \"use ssg\")) {\n const relativePath = path.relative(path.join(root, \"src\"), fullPath);\n const urlPath = filePathToUrlPath(relativePath);\n\n // Validate the page for SSG compatibility\n const validation = validateSSGPage(fullPath);\n const warnings = [...validation.warnings];\n\n // Also check all layouts for this page\n const layoutPaths = findLayoutPathsForPage(fullPath, root);\n for (const layoutPath of layoutPaths) {\n const layoutValidation = validateSSGPage(layoutPath);\n if (layoutValidation.warnings.length > 0) {\n const layoutRelative = path.relative(path.join(root, \"src\"), layoutPath);\n warnings.push(`Layout ${layoutRelative} has issues:`);\n for (const warning of layoutValidation.warnings) {\n warnings.push(` └─ ${warning}`);\n }\n }\n }\n\n ssgPages.push({\n filePath: fullPath,\n urlPath,\n relativePath,\n warnings,\n });\n }\n }\n }\n }\n\n walkDirectory(pagesDir);\n return ssgPages;\n}\n\n/**\n * Convert file path to URL path\n * pages/index.tsx -> /\n * pages/about.tsx -> /about\n * pages/blog/post.tsx -> /blog/post\n * pages/(website)/contact.tsx -> /contact\n * pages/(portal)/dashboard.tsx -> /dashboard\n * @internal Exported for testing\n */\nexport function filePathToUrlPath(relativePath: string): string {\n // Remove 'pages/' prefix and file extension\n let urlPath = relativePath\n .replace(/\\\\/g, \"/\")\n .replace(/^pages\\//, \"\")\n .replace(/\\.(tsx|jsx|ts|js)$/, \"\");\n\n // Remove route groups (folders in parentheses)\n // E.g., (website)/contact -> /contact\n urlPath = urlPath.replace(/\\([^)]+\\)\\//g, \"\");\n\n // Handle index files\n if (urlPath.endsWith(\"/index\") || urlPath === \"index\") {\n urlPath = urlPath.replace(/\\/index$/, \"\").replace(/^index$/, \"\");\n }\n\n // Ensure leading slash\n if (!urlPath.startsWith(\"/\")) {\n urlPath = \"/\" + urlPath;\n }\n\n // Root path\n if (urlPath === \"/\") {\n return \"/\";\n }\n\n return urlPath;\n}\n\n/**\n * Convert URL path to output file path\n * / -> __index.html (special case - renamed later to prevent conflicts)\n * /about -> about.html\n * /blog/post -> blog/post.html\n * @internal Exported for testing\n */\nexport function urlPathToOutputPath(urlPath: string): string {\n if (urlPath === \"/\") {\n return \"__index.html\";\n }\n\n // Remove leading slash and add .html extension\n const cleanPath = urlPath.replace(/^\\//, \"\");\n return `${cleanPath}.html`;\n}\n\n/**\n * Find all layout file paths for a given page path (from root to leaf)\n * @internal Exported for testing\n */\nexport function findLayoutPathsForPage(pagePath: string, root: string): string[] {\n const pagesDir = path.join(root, \"src\", \"pages\");\n const relativePath = path.relative(pagesDir, pagePath);\n const pathParts = path\n .dirname(relativePath)\n .split(path.sep)\n .filter((p) => p !== \".\");\n\n const layoutPaths: string[] = [];\n\n const layoutNames = [\"_layout.tsx\", \"_layout.jsx\", \"_layout.ts\", \"_layout.js\"];\n for (let i = 0; i <= pathParts.length; i++) {\n const dirPath = path.join(pagesDir, ...pathParts.slice(0, i));\n const layoutPath = layoutNames.map((name) => path.join(dirPath, name)).find((candidate) => fs.existsSync(candidate));\n if (layoutPath) {\n layoutPaths.push(layoutPath);\n }\n }\n\n return layoutPaths;\n}\n\n/**\n * Find all layout components for a given page path (from root to leaf)\n * Note: Layouts cannot use routing features during SSG since they're pre-rendered\n */\nasync function findLayoutsForPage(pagePath: string, root: string, viteServer: any): Promise<any[]> {\n const layoutPaths = findLayoutPathsForPage(pagePath, root);\n const layouts = [];\n\n for (const layoutPath of layoutPaths) {\n try {\n const layoutModule = await viteServer.ssrLoadModule(layoutPath);\n if (layoutModule.default) {\n layouts.push(layoutModule.default);\n }\n } catch (error) {\n log(\"warn\", `Could not load layout at ${layoutPath}: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n return layouts;\n}\n\n/**\n * Render a page component to static HTML using Vite SSR with timeout\n */\nexport async function renderPageToHTML(page: SSGPage, root: string, htmlTemplate: string, viteServer: any, timeout: number = 10000): Promise<string> {\n // Create timeout promise\n let timeoutId: ReturnType<typeof setTimeout>;\n const timeoutPromise = new Promise<string>((_, reject) => {\n timeoutId = setTimeout(() => {\n reject(new Error(`Rendering timeout after ${timeout}ms - page may contain hooks or async operations`));\n }, timeout);\n });\n\n // Create render promise\n const renderPromise = (async () => {\n try {\n // Dynamically import React and ReactDOMServer\n const React = (await import(\"react\")).default;\n const ReactDOMServer = await import(\"react-dom/server\");\n\n // Use Vite's SSR loader to load the page component\n const pageModule = await viteServer.ssrLoadModule(page.filePath);\n const PageComponent = pageModule.default;\n\n if (!PageComponent) {\n throw new Error(`No default export found in ${page.relativePath}`);\n }\n\n // Find all layouts (from root to leaf)\n const layouts = await findLayoutsForPage(page.filePath, root, viteServer);\n\n // Build the component tree: layouts wrap the page, innermost to outermost\n const pageProps = { params: {}, searchParams: new URLSearchParams() };\n const WrappedPage = () => {\n let content: any = React.createElement(PageComponent, pageProps);\n for (let i = layouts.length - 1; i >= 0; i--) {\n content = React.createElement(layouts[i], { children: content });\n }\n return content;\n };\n const appShellPath = scanAppShell(root);\n const appShellModule = appShellPath ? await viteServer.ssrLoadModule(appShellPath) : null;\n const AppShell = appShellModule ? (appShellModule.default ?? appShellModule.App ?? appShellModule.app) : null;\n let element: any = AppShell\n ? React.createElement(AppShell, { Component: WrappedPage, pageProps, children: React.createElement(WrappedPage) })\n : React.createElement(WrappedPage);\n\n // Load RouterContext from our stub\n const heliumClient = await viteServer.ssrLoadModule(\"heliumts/client\");\n const RouterContext = heliumClient.RouterContext;\n\n // Mock Router Context with the page's URL\n const routerValue = {\n path: page.urlPath,\n params: {},\n searchParams: new URLSearchParams(),\n push: () => {},\n replace: () => {},\n on: () => () => {},\n status: 200,\n };\n\n // Wrap with RouterContext\n if (RouterContext) {\n element = React.createElement(RouterContext.Provider, { value: routerValue }, element);\n }\n\n // Render to static HTML\n const markup = ReactDOMServer.renderToString(element);\n\n // Inject the markup into the HTML template with the SSG marker\n const finalHtml = replaceHtmlRootContents(htmlTemplate, markup, { \"data-ssg-page\": page.urlPath, \"data-ssg-failed\": null });\n\n return finalHtml;\n } catch (error) {\n log(\"error\", `Failed to render ${page.relativePath}:`, error);\n throw error; // Don't fallback, let the caller handle the error\n }\n })();\n\n // Race between timeout and render\n try {\n return await Promise.race([renderPromise, timeoutPromise]);\n } finally {\n clearTimeout(timeoutId!);\n }\n}\n\n/**\n * Generate static HTML files for all SSG pages\n */\nexport async function generateStaticPages(context: any, root: string, htmlTemplate: string, distDir: string) {\n // Scan for SSG pages\n const ssgPages = scanSSGPages(root);\n\n if (ssgPages.length === 0) {\n return;\n }\n\n log(\"info\", `Generating ${ssgPages.length} static page(s) for SSG...`);\n\n // Check for dynamic routes (not supported yet)\n const dynamicPages = ssgPages.filter((p) => p.relativePath.includes(\"[\"));\n if (dynamicPages.length > 0) {\n log(\"warn\", `Skipping ${dynamicPages.length} dynamic route(s) - not yet supported:\\n` + dynamicPages.map((p) => ` - ${p.relativePath}`).join(\"\\n\"));\n }\n\n // Filter out dynamic routes\n const staticPages = ssgPages.filter((p) => !p.relativePath.includes(\"[\"));\n\n // Precompute RPC client stubs for SSG (mirrors helium Vite plugin)\n const { methods } = scanServerExports(root);\n const serverStubCode = `// Auto-generated SSG RPC stub\\n${generateClientModule(methods)}\\n`;\n\n // Create a stub for heliumts/client that provides mock Router and hooks\n const clientStubCode = `\n// Auto-generated SSG client stub\nimport React from 'react';\n\n// Mock RouterContext\nexport const RouterContext = React.createContext({\n path: '/',\n params: {},\n searchParams: new URLSearchParams(),\n push: () => {},\n replace: () => {},\n on: () => () => {},\n status: 200,\n isNavigating: false,\n isPending: false,\n});\n\n// Mock useRouter hook\nexport function useRouter() {\n const ctx = React.useContext(RouterContext);\n if (!ctx) {\n console.warn('useRouter called outside RouterContext during SSG');\n return {\n path: '/',\n params: {},\n searchParams: new URLSearchParams(),\n push: () => {},\n replace: () => {},\n on: () => () => {},\n status: 200,\n isNavigating: false,\n isPending: false,\n };\n }\n return ctx;\n}\n\n// Mock AppRouter component (alias for Router)\nexport function AppRouter({ children }) {\n return React.createElement(React.Fragment, null, children);\n}\n\n// Mock Router component\nexport function Router({ children }) {\n return React.createElement(React.Fragment, null, children);\n}\n\n// Mock Link component\nexport function Link({ href, children, prefetch, ...props }) {\n return React.createElement('a', { href, ...props }, children);\n}\n\n// Mock Redirect component\nexport function Redirect({ to, replace }) {\n return null;\n}\n\n// Browser RPC calls may be referenced by handlers but cannot run during SSG.\nexport async function callMethod() {\n throw new Error('callMethod is only available in the browser. Load server data with getServerSideProps instead.');\n}\n\nexport function useStreaming() {\n return {\n chunks: [],\n text: '',\n isStreaming: false,\n error: null,\n stats: null,\n start: async () => {\n throw new Error('useStreaming.start is only available in the browser. Load server data with getServerSideProps instead.');\n },\n cancel: () => {},\n reset: () => {},\n };\n}\n\nexport function useCall(serverFn) {\n return { call: async () => null, isCalling: false, error: null };\n}\n\n// Mock useFetch hook\nexport function useFetch(serverFn, ...args) {\n console.warn('useFetch called during SSG - returning null');\n return { data: null, isLoading: false, error: null, refetch: async () => {} };\n}\n\nexport function isSSR() { return true; }\nexport function getPublicEnv() {\n return Object.fromEntries(Object.entries(process.env).filter(([key, value]) => key.startsWith('HELIUM_PUBLIC_') && typeof value === 'string'));\n}\nexport function getPublicEnvValue(key) { return getPublicEnv()[key]; }\nexport function isDevEnvironment() { return false; }\nexport class RpcError extends Error {}\n\n// Re-export cache (mock)\nexport const cache = {\n get: () => null,\n set: () => {},\n delete: () => {},\n clear: () => {},\n};\n\n// Mock PageTransition and useDeferredNavigation (also available from heliumts/client/transitions)\nexport function useDeferredNavigation() {\n const { path } = useRouter();\n return {\n path,\n deferredPath: path,\n isStale: false,\n isPending: false,\n isTransitioning: false,\n };\n}\n\nexport function PageTransition({ children, fallback = null }) {\n return React.createElement('div', { style: { opacity: 1, transition: 'opacity 150ms ease' } },\n React.createElement(React.Suspense, { fallback }, children));\n}\n`;\n\n // Create a stub for heliumts/client/transitions\n const transitionsStubCode = `\n// Auto-generated SSG transitions stub\nimport React from 'react';\nimport { useRouter } from 'heliumts/client';\n\n// Mock useDeferredNavigation hook - returns static values for SSG\nexport function useDeferredNavigation() {\n const { path } = useRouter();\n return {\n path,\n deferredPath: path,\n isStale: false,\n isPending: false,\n isTransitioning: false,\n };\n}\n\n// Mock PageTransition component - renders children without transition logic\nexport function PageTransition({ children, fallback = null }) {\n return React.createElement('div', { style: { opacity: 1, transition: 'opacity 150ms ease' } },\n React.createElement(React.Suspense, { fallback }, children));\n}\n\nexport default {\n useDeferredNavigation,\n PageTransition,\n};\n`;\n\n // Create a stub for heliumts/client/prefetch\n const prefetchStubCode = `\n// Auto-generated SSG prefetch stub\nexport function prefetchRoute() {\n // No-op during SSG\n}\n\nexport function clearPrefetchCache() {\n // No-op during SSG\n}\n`;\n\n // Write stub files to node_modules/.heliumts\n const heliumInternalDir = path.join(root, \"node_modules\", \".heliumts\");\n if (!fs.existsSync(heliumInternalDir)) {\n fs.mkdirSync(heliumInternalDir, { recursive: true });\n }\n const ssgServerStubPath = path.join(heliumInternalDir, \"ssg-server-stub.mjs\");\n const ssgClientStubPath = path.join(heliumInternalDir, \"ssg-client-stub.mjs\");\n const ssgTransitionsStubPath = path.join(heliumInternalDir, \"ssg-transitions-stub.mjs\");\n const ssgPrefetchStubPath = path.join(heliumInternalDir, \"ssg-prefetch-stub.mjs\");\n fs.writeFileSync(ssgServerStubPath, serverStubCode, \"utf-8\");\n fs.writeFileSync(ssgClientStubPath, clientStubCode, \"utf-8\");\n fs.writeFileSync(ssgTransitionsStubPath, transitionsStubCode, \"utf-8\");\n fs.writeFileSync(ssgPrefetchStubPath, prefetchStubCode, \"utf-8\");\n\n // Create a temporary Vite server for SSR rendering\n const { createServer } = await import(\"vite\");\n const heliumPlugin = (await import(\"./heliumPlugin.js\")).default;\n\n const viteServer = await createServer({\n root,\n mode: \"production\",\n server: { middlewareMode: true },\n appType: \"custom\",\n logLevel: \"error\",\n plugins: [heliumPlugin()],\n resolve: {\n alias: [\n // Most specific aliases first - heliumts/client/transitions and heliumts/client/prefetch\n { find: /^heliumts\\/client\\/transitions$/, replacement: ssgTransitionsStubPath },\n { find: /^heliumts\\/client\\/prefetch$/, replacement: ssgPrefetchStubPath },\n // Then heliumts/client and heliumts/server\n { find: /^heliumts\\/client$/, replacement: ssgClientStubPath },\n { find: /^heliumts\\/server$/, replacement: ssgServerStubPath },\n ],\n },\n ssr: {\n external: [\"react\", \"react-dom\"],\n // Don't externalize heliumts packages - we want to use our stubs\n noExternal: [\"heliumts\"],\n },\n });\n\n try {\n // Generate HTML for each static page\n const zlib = await import(\"zlib\");\n let successCount = 0;\n let failureCount = 0;\n let hasIndexSSG = false;\n\n // Calculate max path length for proper alignment (min 35, max 80)\n const maxPathLength = Math.min(80, Math.max(35, ...staticPages.map((p) => urlPathToOutputPath(p.urlPath).length)));\n\n for (const page of staticPages) {\n try {\n // Render the page component to static HTML using Vite SSR with 10s timeout\n const html = await renderPageToHTML(page, root, htmlTemplate, viteServer, 10000);\n const outputPath = urlPathToOutputPath(page.urlPath);\n const fullOutputPath = path.join(distDir, outputPath);\n\n // Track if the root page (/) has SSG\n if (page.urlPath === \"/\") {\n hasIndexSSG = true;\n }\n\n // Ensure directory exists\n const outputDir = path.dirname(fullOutputPath);\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n\n // Write the HTML file\n fs.writeFileSync(fullOutputPath, html, \"utf-8\");\n\n // Calculate file size and gzipped size\n const size = Buffer.byteLength(html, \"utf-8\");\n const sizeKB = (size / 1024).toFixed(2);\n\n // Calculate gzipped size\n const gzipped = zlib.gzipSync(html);\n const gzipSizeKB = (gzipped.length / 1024).toFixed(2);\n\n log(\"info\", ` ${outputPath.padEnd(maxPathLength)} ${sizeKB.padStart(8)} kB │ gzip: ${gzipSizeKB.padStart(7)} kB`);\n successCount++;\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : String(error);\n if (errorMsg.includes(\"timeout\")) {\n log(\"error\", ` ✗ ${page.relativePath} - ${errorMsg}`);\n } else {\n log(\"error\", ` ✗ ${page.relativePath} - Failed to generate:`, error);\n }\n\n // Write a fallback HTML file with empty root div (client will hydrate)\n const outputPath = urlPathToOutputPath(page.urlPath);\n const fullOutputPath = path.join(distDir, outputPath);\n const outputDir = path.dirname(fullOutputPath);\n\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n\n const fallbackHtml = replaceHtmlRootContents(htmlTemplate, \"\", { \"data-ssg-page\": null, \"data-ssg-failed\": page.urlPath });\n fs.writeFileSync(fullOutputPath, fallbackHtml, \"utf-8\");\n\n failureCount++;\n }\n }\n\n // If index page has SSG, we need to handle it specially:\n // 1. Rename __index.html to index.ssg.html (the SSG version)\n // 2. Create a clean blank index.html as fallback for non-root routes\n if (hasIndexSSG) {\n const tempIndexPath = path.join(distDir, \"__index.html\");\n const ssgIndexPath = path.join(distDir, \"index.ssg.html\");\n const indexPath = path.join(distDir, \"index.html\");\n\n // Move __index.html to index.ssg.html\n if (fs.existsSync(tempIndexPath)) {\n fs.renameSync(tempIndexPath, ssgIndexPath);\n }\n\n // Create a blank index.html as the SPA fallback\n const blankIndexHtml = replaceHtmlRootContents(htmlTemplate, \"\", { \"data-ssg-page\": null, \"data-ssg-failed\": null });\n fs.writeFileSync(indexPath, blankIndexHtml, \"utf-8\");\n\n log(\"info\", ` ${\"index.ssg.html\".padEnd(maxPathLength)} (SSG root page)`);\n log(\"info\", ` ${\"index.html\".padEnd(maxPathLength)} (blank SPA fallback)`);\n }\n\n // Summary\n if (failureCount > 0) {\n log(\"warn\", \"\");\n log(\"warn\", `SSG completed with ${successCount} success(es) and ${failureCount} failure(s).`);\n }\n } finally {\n // Always close the Vite server, even if generation fails\n await viteServer.close();\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "heliumts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "A lightweight full-stack React framework with file-based routing, RPC, and SSG support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -88,8 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@msgpack/msgpack": "^3.1.2",
|
|
91
|
-
"dotenv": "^17.2.3"
|
|
92
|
-
"ws": "^8.22.1"
|
|
91
|
+
"dotenv": "^17.2.3"
|
|
93
92
|
},
|
|
94
93
|
"files": [
|
|
95
94
|
"dist"
|
|
@@ -100,7 +99,6 @@
|
|
|
100
99
|
"@types/node": "^22.0.0",
|
|
101
100
|
"@types/react": "^18.0.0 || ^19.0.0",
|
|
102
101
|
"@types/react-dom": "^18.3.7 || ^19.0.0",
|
|
103
|
-
"@types/ws": "^8.18.1",
|
|
104
102
|
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
105
103
|
"@typescript-eslint/parser": "^8.47.0",
|
|
106
104
|
"@vitest/coverage-v8": "^4.1.12",
|