New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

folonite.js

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

folonite.js - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

public/styles/global.css

2

package.json
{
"name": "folonite.js",
"version": "2.0.0",
"version": "2.1.0",
"description": "Folonite.js - The first lightweight framework that integrates dynamic server-side rendering (SSR), streaming capabilities, and an external component marketplace.",

@@ -5,0 +5,0 @@ "type": "module",

@@ -39,3 +39,3 @@ import express from 'express';

console.log(`Health Check -> Memory Used: ${usedMemory.toFixed(2)} MB, Total Memory: ${totalMemory.toFixed(2)} MB, Free Memory: ${freeMemory.toFixed(2)} MB, CPU Load: ${cpuLoad[0].toFixed(2)}, ${cpuLoad[1].toFixed(2)}, ${cpuLoad[2].toFixed(2)}`);
}, 5000); // Log every 5 seconds
}, 150000); // Log every 5 seconds

@@ -42,0 +42,0 @@ app.use(express.json());

@@ -23,7 +23,11 @@ // src/pages/home.js

<ul>
<li>Server-Side Rendering (SSR)</li>
<li>Real-time Streaming Content</li>
<li>Advanced Command-Line Interface (CLI)</li>
<li>Component Marketplace</li>
<li>Future-ready: 3D Website Creation</li>
<li>Dynamic Server-Side Rendering (SSR)</li>
<li>Streaming Content</li>
<li>Hot Reloading (Development Mode)</li>
<li>Component-Based Architecture</li>
<li>Built-in External Component Marketplace</li>
<li>Advanced CLI (Command-Line Interface)</li>
<li>Auto Dependency Management</li>
<li>API Handling with JSON Parsing and Authentication</li>
<li>Backend Integration with Express</li>
</ul>

@@ -45,4 +49,4 @@ </section>

<p>
We welcome contributions from the developer community. Visit our
<a href="https://github.com/fffstanza/Folonite.js" target="_blank">GitHub Repository</a>
We welcome contributions from the developer community. Email us at
<a href="mailto:docs@folonite.in">docs@folonite.in</a>
to contribute, report issues, or suggest new features.

@@ -55,2 +59,11 @@ </p>

<!-- Visit Folonite Section -->
<section>
<h2>Visit Folonite</h2>
<p>
Learn more about Folonite and explore our other offerings at
<a href="https://www.folonite.in" target="_blank">www.folonite.in</a>.
</p>
</section>
</main>

@@ -57,0 +70,0 @@ <Component name="Footer" props='{}'/>

import path from 'path';
import { Readable } from 'stream';
import { pathToFileURL } from 'url';
import fs from 'fs';
import { components } from './registerComponents.js';
// Utility function to load page modules dynamically
async function loadPageModule(pageName) {

@@ -17,3 +17,2 @@ const pagePath = path.resolve(`./src/pages/${pageName}.js`);

// Utility function to replace component placeholders with actual components
function replaceComponentPlaceholders(content, pageName) {

@@ -35,3 +34,22 @@ return content.replace(/<Component\s+name="(\w+)"(?:\s+props='([^']*)')?\s*\/>/g, (_, componentName, propsJson) => {

// Function for standard page rendering
function resolveStylesheetPath(pageName) {
const stylesDir = path.resolve('./public/styles');
const normalizedPageName = path.normalize(pageName).replace(/\\/g, '/'); // Normalize paths for subdirectories
const possiblePaths = [
path.join(stylesDir, `${normalizedPageName}.css`), // Specific page CSS in subdirectories
path.join(stylesDir, `${path.basename(normalizedPageName)}.css`), // Filename-based CSS
path.join(stylesDir, 'global.css'), // Global fallback CSS
];
for (const stylesheetPath of possiblePaths) {
if (fs.existsSync(stylesheetPath)) {
return `/styles/${path.relative(stylesDir, stylesheetPath).replace(/\\/g, '/')}`; // Return relative web path
}
}
console.warn(`Stylesheet not found for page: ${pageName}`);
return null; // No stylesheet found
}
export async function renderPage(pageName, options = {}) {

@@ -42,3 +60,7 @@ try {

const renderedContent = replaceComponentPlaceholders(pageContent, pageName);
return buildHtmlPage(pageName, renderedContent);
// Dynamic CSS resolution with fallback
const stylesheet = resolveStylesheetPath(pageName);
return buildHtmlPage(pageName, renderedContent, stylesheet);
} catch (error) {

@@ -50,3 +72,2 @@ console.error(`Error rendering page "${pageName}":`, error);

// Function for page streaming
export function renderPageStream(pageName, options = {}) {

@@ -59,3 +80,7 @@ const stream = new Readable({

const renderedContent = replaceComponentPlaceholders(pageContent, pageName);
this.push(buildHtmlPage(pageName, renderedContent));
// Dynamic CSS resolution with fallback
const stylesheet = resolveStylesheetPath(pageName);
this.push(buildHtmlPage(pageName, renderedContent, stylesheet));
} catch (error) {

@@ -65,4 +90,4 @@ console.error(`Error streaming page "${pageName}":`, error);

}
this.push(null); // Signal that the stream is finished
}
this.push(null);
},
});

@@ -72,3 +97,3 @@ return stream;

function buildHtmlPage(title, bodyContent) {
function buildHtmlPage(title, bodyContent, stylesheet) {
return `

@@ -80,3 +105,3 @@ <!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/styles.css">
${stylesheet ? `<link rel="stylesheet" href="${stylesheet}">` : ''}
<script defer src="/script.js"></script>

@@ -83,0 +108,0 @@ <title>${title}</title>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc