Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update miniflare to v3 #14107

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@

// breaking changes
"kill-port", // `kill-port:^2.0.0 has perf issues (#8392)
"miniflare", // `miniflare:v2.0.0+` only supports node 16.7
],
}
26 changes: 8 additions & 18 deletions playground/ssr-webworker/__tests__/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import path from 'node:path'
import kill from 'kill-port'
import { isBuild, ports, rootDir } from '~utils'
import { ports, rootDir } from '~utils'

export const port = ports['ssr-webworker']

Expand All @@ -26,22 +26,12 @@ export async function serve(): Promise<{ close(): Promise<void> }> {
})

const { createServer } = await import(path.resolve(rootDir, 'worker.js'))
const { app } = await createServer(rootDir, isBuild)
const { mf } = await createServer(port)

return new Promise((resolve, reject) => {
try {
const server = app.listen(port, () => {
resolve({
// for test teardown
async close() {
await new Promise((resolve) => {
server.close(resolve)
})
},
})
})
} catch (e) {
reject(e)
}
})
return {
// for test teardown
async close() {
await mf.dispose()
},
}
}
2 changes: 1 addition & 1 deletion playground/ssr-webworker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"react": "^18.2.0"
},
"devDependencies": {
"miniflare": "^1.4.1",
"miniflare": "^3.20230807.0",
"@vitejs/test-resolve-linked": "workspace:*"
}
}
15 changes: 5 additions & 10 deletions playground/ssr-webworker/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))

const isTest = !!process.env.TEST

export async function createServer() {
export async function createServer(port) {
const mf = new Miniflare({
scriptPath: path.resolve(__dirname, 'dist/worker/entry-worker.js'),
port,
})

const app = mf.createServer()

return { app }
await mf.ready
return { mf }
}

if (!isTest) {
createServer().then(({ app }) =>
app.listen(5173, () => {
console.log('http://localhost:5173')
}),
)
createServer(5173).then(() => console.log('http://localhost:5173'))
}
Loading