s4d 0.2.2 → 0.2.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/dist/DevServer.js +15 -3
- package/package.json +5 -5
package/dist/DevServer.js
CHANGED
|
@@ -227,12 +227,12 @@ export class DevServer {
|
|
|
227
227
|
|
|
228
228
|
// Hot reload stylesheets
|
|
229
229
|
document.querySelectorAll('link[rel=stylesheet]').forEach((el) => {
|
|
230
|
-
const href = el.getAttribute('href');
|
|
230
|
+
const href = untaintURL(el.getAttribute('href'));
|
|
231
231
|
|
|
232
232
|
if (endsWithURL(data.url, href)) {
|
|
233
233
|
reload = false;
|
|
234
234
|
|
|
235
|
-
el.setAttribute('href', href);
|
|
235
|
+
el.setAttribute('href', taintURL(href));
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
238
|
|
|
@@ -283,7 +283,19 @@ export class DevServer {
|
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
function containsURL(candidate, target) {
|
|
286
|
-
return candidate.
|
|
286
|
+
return candidate.includes(target.replace(/^\\.?\\//, ''));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function taintURL(url) {
|
|
290
|
+
if (url.includes("?")) {
|
|
291
|
+
return url + '&t=' + Math.random();
|
|
292
|
+
} else {
|
|
293
|
+
return url + '?t=' + Math.random();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function untaintURL(url) {
|
|
298
|
+
return url.replace(/[?&]t=[\\d.]+/, '');
|
|
287
299
|
}`;
|
|
288
300
|
}
|
|
289
301
|
async stat(file) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "s4d",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Minimal web development server with live reload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"local",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"ws": "^8.16.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@eslint/js": "^
|
|
44
|
+
"@eslint/js": "^10.0.1",
|
|
45
45
|
"@playwright/test": "^1.44.1",
|
|
46
46
|
"@types/eslint__js": "^8.42.3",
|
|
47
|
-
"@types/node": "^
|
|
47
|
+
"@types/node": "^24.12.2",
|
|
48
48
|
"@types/ws": "^8.5.10",
|
|
49
|
-
"eslint": "^
|
|
49
|
+
"eslint": "^10.2.0",
|
|
50
50
|
"prettier": "^3.3.1",
|
|
51
|
-
"typescript": "^
|
|
51
|
+
"typescript": "^6.0.2",
|
|
52
52
|
"typescript-eslint": "^8.2.0"
|
|
53
53
|
}
|
|
54
54
|
}
|