Skip to content

Commit

Permalink
Remove server-destroy dependency (#10132)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Feb 15, 2024
1 parent 1f598b3 commit 1da9c5f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/poor-llamas-chew.md
@@ -0,0 +1,5 @@
---
"astro": patch
---

Simplifies internal Vite preview server teardown
2 changes: 0 additions & 2 deletions packages/astro/package.json
Expand Up @@ -166,7 +166,6 @@
"rehype": "^13.0.1",
"resolve": "^1.22.4",
"semver": "^7.5.4",
"server-destroy": "^1.0.1",
"shikiji": "^0.9.19",
"shikiji-core": "^0.9.19",
"string-width": "^7.0.0",
Expand Down Expand Up @@ -210,7 +209,6 @@
"@types/resolve": "^1.20.5",
"@types/semver": "^7.5.2",
"@types/send": "^0.17.4",
"@types/server-destroy": "^1.0.3",
"@types/unist": "^3.0.2",
"@types/yargs-parser": "^21.0.3",
"astro-scripts": "workspace:*",
Expand Down
9 changes: 1 addition & 8 deletions packages/astro/src/core/preview/static-preview-server.ts
@@ -1,7 +1,6 @@
import type http from 'node:http';
import { fileURLToPath } from 'node:url';
import { performance } from 'perf_hooks';
import enableDestroy from 'server-destroy';
import { preview, type PreviewServer as VitePreviewServer } from 'vite';
import type { AstroSettings } from '../../@types/astro.js';
import type { Logger } from '../logger/core.js';
Expand Down Expand Up @@ -47,8 +46,6 @@ export default async function createStaticPreviewServer(
throw err;
}

enableDestroy(previewServer.httpServer);

// Log server start URLs
logger.info(
'SKIP_FORMAT',
Expand All @@ -73,10 +70,6 @@ export default async function createStaticPreviewServer(
port: settings.config.server.port,
closed,
server: previewServer.httpServer as http.Server,
stop: async () => {
await new Promise((resolve, reject) => {
previewServer.httpServer.destroy((err) => (err ? reject(err) : resolve(undefined)));
});
},
stop: previewServer.close.bind(previewServer),
};
}
6 changes: 0 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1da9c5f

Please sign in to comment.