spark-html-manifest 0.1.3 → 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 CHANGED
@@ -95,7 +95,8 @@ 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. Add only what you use.
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
  |---|---|
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "spark-html-manifest",
3
- "version": "0.1.3",
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
- if (res && res.ok) cache.put(req, res.clone());
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;