-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make sure the cloned config doesn't reference the root config
- Loading branch information
1 parent
1e41e34
commit 603e323
Showing
24 changed files
with
498 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 10 additions & 8 deletions
18
packages/browser/src/node/middlewares/orchestratorMiddleware.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
import type { Connect } from 'vite' | ||
import type { BrowserServer } from '../server' | ||
import type { ParentBrowserProject } from '../projectParent' | ||
import { resolveOrchestrator } from '../serverOrchestrator' | ||
import { allowIframes, disableCache } from './utils' | ||
|
||
export function createOrchestratorMiddleware(browserServer: BrowserServer): Connect.NextHandleFunction { | ||
export function createOrchestratorMiddleware(parentServer: ParentBrowserProject): Connect.NextHandleFunction { | ||
return async function vitestOrchestratorMiddleware(req, res, next) { | ||
if (!req.url) { | ||
return next() | ||
} | ||
const url = new URL(req.url, 'http://localhost') | ||
if (url.pathname !== browserServer.base) { | ||
if (url.pathname !== parentServer.base) { | ||
return next() | ||
} | ||
|
||
disableCache(res) | ||
allowIframes(res) | ||
const html = await resolveOrchestrator(parentServer, url, res) | ||
if (html) { | ||
disableCache(res) | ||
allowIframes(res) | ||
|
||
const html = await resolveOrchestrator(browserServer, url, res) | ||
res.write(html, 'utf-8') | ||
res.end() | ||
res.write(html, 'utf-8') | ||
res.end() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.