@trebor/buildhtml 1.0.2 → 1.0.3
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 +18 -19
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @trebor/buildhtml
|
|
2
2
|
|
|
3
|
-
**High-performance, server-side rendering (SSR) library for Node.js.**
|
|
4
|
-
*"Build HTML at lightning speed with reactive state management."*
|
|
3
|
+
**High-performance, server-side rendering (SSR) library for Node.js.** *"Build HTML at lightning speed with reactive state management."*
|
|
5
4
|
|
|
6
5
|
---
|
|
7
6
|
|
|
@@ -9,20 +8,20 @@
|
|
|
9
8
|
|
|
10
9
|
BuildHTML is a lightweight SSR library for Node.js featuring object pooling, reactive state management, and CSS-in-JS capabilities. Build HTML on the server with minimal memory usage and blazing-fast performance.
|
|
11
10
|
|
|
12
|
-
- **Zero dependencies** – Only Node.js required
|
|
13
|
-
- **High Performance** – Object pooling and LRU caching (1-5ms render time)
|
|
14
|
-
- **Reactive State** – Built-in state management with automatic UI updates
|
|
15
|
-
- **CSS-in-JS** – Scoped and global styling with automatic CSS generation
|
|
16
|
-
- **Security** – XSS protection, CSS sanitization, and CSP nonce support
|
|
17
|
-
- **Production Ready** – HTML minification, compression, and metrics
|
|
18
|
-
- **JSON Export** – Save/restore pages with optional obfuscation
|
|
11
|
+
- **Zero dependencies** – Only Node.js required.
|
|
12
|
+
- **High Performance** – Object pooling and LRU caching (1-5ms render time).
|
|
13
|
+
- **Reactive State** – Built-in state management with automatic UI updates.
|
|
14
|
+
- **CSS-in-JS** – Scoped and global styling with automatic CSS generation.
|
|
15
|
+
- **Security** – XSS protection, CSS sanitization, and CSP nonce support.
|
|
16
|
+
- **Production Ready** – HTML minification, compression, and metrics.
|
|
17
|
+
- **JSON Export** – Save/restore pages with optional obfuscation.
|
|
19
18
|
|
|
20
19
|
---
|
|
21
20
|
|
|
22
21
|
## Installation
|
|
23
22
|
|
|
24
23
|
```bash
|
|
25
|
-
npm install buildhtml
|
|
24
|
+
npm install @trebor/buildhtml
|
|
26
25
|
```
|
|
27
26
|
|
|
28
27
|
---
|
|
@@ -30,7 +29,7 @@ npm install buildhtml
|
|
|
30
29
|
## Quick Start
|
|
31
30
|
|
|
32
31
|
```javascript
|
|
33
|
-
const { Document } = require('buildhtml');
|
|
32
|
+
const { Document } = require('@trebor/buildhtml');
|
|
34
33
|
|
|
35
34
|
// Create a document
|
|
36
35
|
const doc = new Document();
|
|
@@ -257,7 +256,7 @@ const {
|
|
|
257
256
|
resetPools, // Reset object pools
|
|
258
257
|
healthCheck, // Health check data
|
|
259
258
|
metrics // Performance metrics
|
|
260
|
-
} = require('buildhtml');
|
|
259
|
+
} = require('@trebor/buildhtml');
|
|
261
260
|
```
|
|
262
261
|
|
|
263
262
|
---
|
|
@@ -268,7 +267,7 @@ const {
|
|
|
268
267
|
|
|
269
268
|
```javascript
|
|
270
269
|
const express = require('express');
|
|
271
|
-
const { Document } = require('buildhtml');
|
|
270
|
+
const { Document } = require('@trebor/buildhtml');
|
|
272
271
|
|
|
273
272
|
const app = express();
|
|
274
273
|
|
|
@@ -400,7 +399,7 @@ app.get('/spa', (req, res) => {
|
|
|
400
399
|
## Configuration
|
|
401
400
|
|
|
402
401
|
```javascript
|
|
403
|
-
const { CONFIG } = require('buildhtml');
|
|
402
|
+
const { CONFIG } = require('@trebor/buildhtml');
|
|
404
403
|
|
|
405
404
|
CONFIG.mode = 'prod'; // 'prod' or 'dev'
|
|
406
405
|
CONFIG.poolSize = 150; // Max pooled elements
|
|
@@ -436,14 +435,14 @@ clearCache('user-'); // Clear all keys containing 'user-'
|
|
|
436
435
|
### enableCompression()
|
|
437
436
|
|
|
438
437
|
```javascript
|
|
439
|
-
const { enableCompression } = require('buildhtml');
|
|
438
|
+
const { enableCompression } = require('@trebor/buildhtml');
|
|
440
439
|
app.use(enableCompression());
|
|
441
440
|
```
|
|
442
441
|
|
|
443
442
|
### warmupCache(routes)
|
|
444
443
|
|
|
445
444
|
```javascript
|
|
446
|
-
const { warmupCache } = require('buildhtml');
|
|
445
|
+
const { warmupCache } = require('@trebor/buildhtml');
|
|
447
446
|
|
|
448
447
|
await warmupCache([
|
|
449
448
|
{ key: 'home', builder: () => buildHomePage() },
|
|
@@ -546,7 +545,7 @@ doc.oncreate(() => {
|
|
|
546
545
|
```javascript
|
|
547
546
|
process.env.ENABLE_METRICS = 'true';
|
|
548
547
|
|
|
549
|
-
const { metrics } = require('buildhtml');
|
|
548
|
+
const { metrics } = require('@trebor/buildhtml');
|
|
550
549
|
|
|
551
550
|
// After some requests...
|
|
552
551
|
console.log(metrics.getStats());
|
|
@@ -663,7 +662,7 @@ const html = doc.render();
|
|
|
663
662
|
|
|
664
663
|
```javascript
|
|
665
664
|
const express = require('express');
|
|
666
|
-
const { Document, createCachedRenderer } = require('buildhtml');
|
|
665
|
+
const { Document, createCachedRenderer } = require('@trebor/buildhtml');
|
|
667
666
|
|
|
668
667
|
const app = express();
|
|
669
668
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trebor/buildhtml",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Zero-dependency, ultra-fast HTML builder for server-side rendering (SSR).",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -35,4 +35,4 @@
|
|
|
35
35
|
"url": "https://github.com/0trebor0/buildhtml/issues"
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/0trebor0/buildhtml#readme"
|
|
38
|
-
}
|
|
38
|
+
}
|