@farm.js/devtools 0.1.31 → 0.1.34

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.
Files changed (2) hide show
  1. package/dist/server.js +6 -0
  2. package/package.json +2 -2
package/dist/server.js CHANGED
@@ -2,8 +2,14 @@ import { readdir, readFile } from "node:fs/promises";
2
2
  import { isIP } from "node:net";
3
3
  import { createModuleInspector, ModuleInspectionError } from "./modules.js";
4
4
  import { DEVTOOLS_PATH } from "./types.js";
5
+ /** Set by the `farm preview` relay and gateway client on every tunnelled request. */
6
+ const FARM_PREVIEW_REQUEST_HEADER = "x-farm-preview";
5
7
  /** Guard our early middleware, before Vite's own host/CORS middleware runs. */
6
8
  export function isTrustedRequest(req, server) {
9
+ // `farm preview` tunnels public visitors in with a localhost Host and marks them; DevTools
10
+ // describes the developer's machine and is never served on a public preview URL.
11
+ if (req.headers[FARM_PREVIEW_REQUEST_HEADER] !== undefined)
12
+ return false;
7
13
  try {
8
14
  const authority = req.headers.host ?? "";
9
15
  if (!authority || /[\s/@\\?#]/.test(authority))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm.js/devtools",
3
- "version": "0.1.31",
3
+ "version": "0.1.34",
4
4
  "description": "Development workspace inspector for Farm.js routes, runtime, and browser modules",
5
5
  "keywords": [
6
6
  "devtools",
@@ -57,7 +57,7 @@
57
57
  "typescript": "^5.3.3",
58
58
  "vite": "8.3.4",
59
59
  "vitest": "5.0.5",
60
- "@farm.js/core": "0.1.31"
60
+ "@farm.js/core": "0.1.34"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@farm.js/core": ">=0.1.28 <0.2.0"