packaton 0.0.13 → 0.0.14
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/package.json +1 -1
- package/src/router.js +12 -1
package/package.json
CHANGED
package/src/router.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path'
|
|
2
2
|
import { readFile } from 'node:fs/promises'
|
|
3
|
+
import { randomUUID } from 'node:crypto'
|
|
3
4
|
|
|
4
5
|
import { docs } from './app.js'
|
|
5
6
|
import { mimeFor } from './utils/mimes.js'
|
|
@@ -7,6 +8,8 @@ import { devClientWatcher } from './plugins-dev/WatcherDevClient.js'
|
|
|
7
8
|
import { sendError, sendJSON, servePartialContent, serveAsset } from './utils/http-response.js'
|
|
8
9
|
|
|
9
10
|
|
|
11
|
+
const devtoolsWorkspaceId = randomUUID()
|
|
12
|
+
|
|
10
13
|
const WATCHER_DEV = '/plugins-dev/watcherDev.js'
|
|
11
14
|
|
|
12
15
|
const API = {
|
|
@@ -21,7 +24,15 @@ export function router({ srcPath, ignore, mode }) {
|
|
|
21
24
|
return async function (req, response) {
|
|
22
25
|
let url = new URL(req.url, 'http://_').pathname
|
|
23
26
|
try {
|
|
24
|
-
if (url ===
|
|
27
|
+
if (url === '/.well-known/appspecific/com.chrome.devtools.json')
|
|
28
|
+
sendJSON(response, {
|
|
29
|
+
workspace: {
|
|
30
|
+
root: srcPath,
|
|
31
|
+
uuid: devtoolsWorkspaceId
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
else if (url === API.watchDev)
|
|
25
36
|
longPollDevHotReload(req, response)
|
|
26
37
|
|
|
27
38
|
else if (url === WATCHER_DEV)
|