achi-html-stream 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/README.md +13 -12
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -7,6 +7,8 @@
7
7
 
8
8
  It uses tagged template literals with automatic XSS escaping, async values, readable-stream embedding/piping and response, with zero runtime dependencies.
9
9
 
10
+ For the full up-to-date documentation, please visit our [GitHub Repository](https://github.com/kimbugwe-mark/achi-html-stream#readme).
11
+
10
12
  ## Features
11
13
 
12
14
  - **Streaming by design**: HTML is flushed progressively as data resolves, without buffering whole pages.
@@ -35,8 +37,6 @@ Pre-bundled builds expose `window.achiHTML`. ```html
35
37
 
36
38
  Pin a version in production, for example `https://unpkg.com/achi-html-stream@1.2.3`.
37
39
 
38
- ````
39
-
40
40
  ## Quick start
41
41
 
42
42
  ### Service worker
@@ -44,12 +44,12 @@ Pin a version in production, for example `https://unpkg.com/achi-html-stream@1.2
44
44
  Return a streaming `Response` from a `fetch` handler:
45
45
 
46
46
  ```ts
47
- import { html, render } from 'achi-html-stream'
47
+ import { html, render } from "achi-html-stream";
48
48
 
49
- self.addEventListener('fetch', (event) => {
50
- const url = new URL(event.request.url)
49
+ self.addEventListener("fetch", (event) => {
50
+ const url = new URL(event.request.url);
51
51
 
52
- if (url.pathname === '/') {
52
+ if (url.pathname === "/") {
53
53
  event.respondWith(
54
54
  render(
55
55
  html`<!doctype html>
@@ -59,15 +59,15 @@ self.addEventListener('fetch', (event) => {
59
59
  <title>PWA Streaming</title>
60
60
  </head>
61
61
  <body>
62
- <h1>Hello, ${'world'}!</h1>
62
+ <h1>Hello, ${"world"}!</h1>
63
63
  </body>
64
64
  </html>`,
65
- { 'Cache-Control': 'no-cache' }
66
- )
67
- )
65
+ { "Cache-Control": "no-cache" },
66
+ ),
67
+ );
68
68
  }
69
- })
70
- ````
69
+ });
70
+ ```
71
71
 
72
72
  `render()` sets `Content-Type: text/html; charset=utf-8` by default and streams the output through a native `Response`.
73
73
 
@@ -78,6 +78,7 @@ The Node entry point pipes the rendered stream into a `http.ServerResponse`:
78
78
  ```ts
79
79
  import { createServer } from "node:http";
80
80
  import { html, render } from "achi-html-stream";
81
+ //require("achi-html-stream")
81
82
 
82
83
  createServer((req, res) => {
83
84
  render(
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "achi-html-stream",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "description": "An HTML streaming library for multi-page progressive web apps that renders HTML in service workers and also works with Node.js and other JavaScript runtimes",
6
6
  "author": {
7
7
  "name": "Kimbugwe Mark",
8
8
  "email": "markkimbugwe@gmail.com"
9
9
  },
10
10
  "license": "MIT",
11
- "homepage": "https://github.com/kimbugwe-mark/achi-html#readme",
11
+ "homepage": "https://github.com/kimbugwe-mark/achi-html-stream#readme",
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "git+https://github.com/kimbugwe-mark/achi-html.git"
14
+ "url": "git+https://github.com/kimbugwe-mark/achi-html-stream.git"
15
15
  },
16
16
  "keywords": [
17
17
  "html templating",
@@ -29,7 +29,7 @@
29
29
  "html"
30
30
  ],
31
31
  "bugs": {
32
- "url": "https://github.com/kimbugwe-mark/achi-html/issues"
32
+ "url": "https://github.com/kimbugwe-mark/achi-html-stream/issues"
33
33
  },
34
34
  "types": "./dist/node/index.d.mts",
35
35
  "unpkg": "./dist/browser/index.iife.js",