Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and astrobot-houston committed Feb 1, 2024
1 parent 1568afb commit 756f959
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/astro/src/core/build/buildPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ export class BuildPipeline extends Pipeline {

const renderersEntryUrl = new URL(`renderers.mjs?time=${Date.now()}`, baseDirectory);
const renderers = await import(renderersEntryUrl.toString());

const middleware = await import(new URL('middleware.mjs', baseDirectory).toString())
.then((mod) => mod.onRequest)
// middleware.mjs is not emitted if there is no user middleware
// in which case the import fails with ERR_MODULE_NOT_FOUND, and we fall back to a no-op middleware
.catch(() => manifest.middleware);

if (!renderers) {
throw new Error(
"Astro couldn't find the emitted renderers. This is an internal error, please file an issue."
Expand All @@ -140,7 +140,7 @@ export class BuildPipeline extends Pipeline {
return {
...manifest,
renderers: renderers.renderers as SSRLoadedRenderer[],
middleware
middleware,
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/astro/test/middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ describe('Middleware API in PROD mode, SSR', () => {
});

it('can set locals for prerendered pages to use', async () => {
const text = await fixture.readFile("/client/prerendered/index.html")
const text = await fixture.readFile('/client/prerendered/index.html');
expect(text.includes('<p>yes they can!</p>')).to.be.true;
})
});

// keep this last
it('the integration should receive the path to the middleware', async () => {
Expand Down

0 comments on commit 756f959

Please sign in to comment.