spark-html-manifest 0.1.2 → 0.1.4
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 +4 -2
- package/package.json +3 -3
- package/src/index.js +11 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Lighthouse/devtools "installable" checks pass locally too.
|
|
|
39
39
|
## Install
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
|
|
42
|
+
bun add spark-html-manifest
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
## Config
|
|
@@ -95,11 +95,13 @@ are skipped with a warning and everything else still works.
|
|
|
95
95
|
## The Spark family
|
|
96
96
|
|
|
97
97
|
Small, single-purpose packages that share one philosophy: no compiler, no
|
|
98
|
-
virtual DOM, no build step required
|
|
98
|
+
virtual DOM, no build step required — built for humans who love hand-writing
|
|
99
|
+
their web apps. Add only what you use.
|
|
99
100
|
|
|
100
101
|
| Package | What it does |
|
|
101
102
|
|---|---|
|
|
102
103
|
| [`spark-html`](https://www.npmjs.com/package/spark-html) | The runtime — components, reactivity, stores, forms, scoped styles. 13 kB gzip, 0 deps. |
|
|
104
|
+
| [`spark-html-bun`](https://www.npmjs.com/package/spark-html-bun) | Dev server, bundler & preview on Bun — scoped HMR, no-build dev, post-build pipeline. |
|
|
103
105
|
| [`spark-html-router`](https://www.npmjs.com/package/spark-html-router) | `<template route>` routing — nested routes/layouts, `route.query`, active links. |
|
|
104
106
|
| [`spark-html-theme`](https://www.npmjs.com/package/spark-html-theme) | Dark/light/system theming in one line — persisted, no flash. |
|
|
105
107
|
| [`spark-html-head`](https://www.npmjs.com/package/spark-html-head) | Reactive `<title>`/`<meta>` per route + a `head` store. |
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spark-html-manifest",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "PWA manifest + icons + offline app shell for spark-html sites from a single config — a spark-html-bun build step that generates manifest.webmanifest, resizes icons, injects the head tags, and optionally emits a minimal service worker.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"types": "./src/index.d.ts",
|
|
8
|
-
"homepage": "https://wilkinnovo.github.io/spark",
|
|
8
|
+
"homepage": "https://wilkinnovo.github.io/spark-html",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./src/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/wilkinnovo/spark.git",
|
|
26
|
+
"url": "git+https://github.com/wilkinnovo/spark-html.git",
|
|
27
27
|
"directory": "packages/spark-html-manifest"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
package/src/index.js
CHANGED
|
@@ -136,6 +136,9 @@ self.addEventListener('fetch', function (event) {
|
|
|
136
136
|
var url;
|
|
137
137
|
try { url = new URL(req.url); } catch (e) { return; }
|
|
138
138
|
if (url.origin !== self.location.origin) return;
|
|
139
|
+
// Server channels (spark-ssr live reload / live data SSE) are streams —
|
|
140
|
+
// never intercept them, and never try to cache one.
|
|
141
|
+
if (url.pathname.indexOf('/__spark/') === 0) return;
|
|
139
142
|
// The build's hash-named assets are immutable — cache-first is always correct.
|
|
140
143
|
var immutable = /\\/assets\\/[^/]*[-.][A-Za-z0-9_-]{8,}\\.\\w+$/.test(url.pathname);
|
|
141
144
|
event.respondWith(caches.open(CACHE).then(function (cache) {
|
|
@@ -143,7 +146,14 @@ self.addEventListener('fetch', function (event) {
|
|
|
143
146
|
if (cached && immutable) return cached;
|
|
144
147
|
// Network-first keeps pages/components fresh; cache is the offline net.
|
|
145
148
|
return fetch(req).then(function (res) {
|
|
146
|
-
|
|
149
|
+
// Streams and no-store responses must not land in the cache —
|
|
150
|
+
// Cache.put() on an endless event-stream rejects with a NetworkError.
|
|
151
|
+
var ct = (res && res.headers.get('content-type')) || '';
|
|
152
|
+
var cc = (res && res.headers.get('cache-control')) || '';
|
|
153
|
+
var cachable = res && res.ok
|
|
154
|
+
&& ct.indexOf('text/event-stream') === -1
|
|
155
|
+
&& cc.indexOf('no-store') === -1;
|
|
156
|
+
if (cachable) cache.put(req, res.clone());
|
|
147
157
|
return res;
|
|
148
158
|
}).catch(function () {
|
|
149
159
|
if (cached) return cached;
|