@domphy/press 0.19.1 → 0.20.0

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.
@@ -26,7 +26,10 @@ var MIME = {
26
26
  };
27
27
  var DEV_SCRIPT = `<script>(function(){var es=new EventSource('/_dev/sse');es.onmessage=function(e){if(e.data==='reload')location.reload();};es.onerror=function(){setTimeout(function(){location.reload();},2000);};})();</script>`;
28
28
  function resolveFile(root, urlPath) {
29
- const safe = normalize(decodeURIComponent(urlPath.split("?")[0])).replace(/^(\.\.[/\\])+/, "");
29
+ const safe = normalize(decodeURIComponent(urlPath.split("?")[0])).replace(
30
+ /^(\.\.[/\\])+/,
31
+ ""
32
+ );
30
33
  const candidates = extname(safe) ? [join(root, safe)] : [join(root, safe, "index.html"), join(root, `${safe}.html`)];
31
34
  for (const candidate of candidates) {
32
35
  if (existsSync(candidate) && statSync(candidate).isFile()) return candidate;
@@ -45,10 +48,16 @@ function startServer(root, port) {
45
48
  return;
46
49
  }
47
50
  response.statusCode = 200;
48
- response.setHeader("content-type", MIME[extname(file)] ?? "application/octet-stream");
51
+ response.setHeader(
52
+ "content-type",
53
+ MIME[extname(file)] ?? "application/octet-stream"
54
+ );
49
55
  createReadStream(file).pipe(response);
50
56
  });
51
- server.listen(port, () => console.log(`DomphyPress preview: http://localhost:${port}/`));
57
+ server.listen(
58
+ port,
59
+ () => console.log(`DomphyPress preview: http://localhost:${port}/`)
60
+ );
52
61
  return server;
53
62
  }
54
63
  function startDevServer(root, port) {
@@ -59,7 +68,7 @@ function startDevServer(root, port) {
59
68
  response.writeHead(200, {
60
69
  "Content-Type": "text/event-stream",
61
70
  "Cache-Control": "no-cache",
62
- "Connection": "keep-alive"
71
+ Connection: "keep-alive"
63
72
  });
64
73
  response.write("data: connected\n\n");
65
74
  clients.add(response);
@@ -85,7 +94,12 @@ function startDevServer(root, port) {
85
94
  createReadStream(file).pipe(response);
86
95
  }
87
96
  });
88
- server.listen(port, () => console.log(`DomphyPress dev: http://localhost:${port}/ (live reload active)`));
97
+ server.listen(
98
+ port,
99
+ () => console.log(
100
+ `DomphyPress dev: http://localhost:${port}/ (live reload active)`
101
+ )
102
+ );
89
103
  return {
90
104
  server,
91
105
  notify: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domphy/press",
3
- "version": "0.19.1",
3
+ "version": "0.20.0",
4
4
  "description": "Domphy Press — VitePress-baseline static doc site framework built on @domphy/app + @domphy/markdown",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -22,7 +22,7 @@
22
22
  "dev": "tsup --watch",
23
23
  "pack": "tsup && npm pack",
24
24
  "prepublishOnly": "npm run build",
25
- "test": "vitest run",
25
+ "test": "vitest run --passWithNoTests",
26
26
  "test:watch": "vitest"
27
27
  },
28
28
  "keywords": [