Skip to content

Commit 31f5ff3

Browse files
author
那里好脏不可以
authoredSep 6, 2022
refactor: optimize async and await in code (#9854)
1 parent 9c1be10 commit 31f5ff3

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed
 

‎packages/vite/src/node/optimizer/optimizer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ async function createDepsOptimizer(
232232
}
233233
}
234234

235-
async function startNextDiscoveredBatch() {
235+
function startNextDiscoveredBatch() {
236236
newDepsDiscovered = false
237237

238238
// Add the current depOptimizationProcessing to the queue, these

‎packages/vite/src/node/plugins/importAnalysis.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function markExplicitImport(url: string) {
8787
return url
8888
}
8989

90-
async function extractImportedBindings(
90+
function extractImportedBindings(
9191
id: string,
9292
source: string,
9393
importSpec: ImportSpecifier,

‎playground/assets/__tests__/assets.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ describe.runIf(isBuild)('encodeURI', () => {
272272
test('img src with encodeURI', async () => {
273273
const img = await page.$('.encodeURI')
274274
expect(
275-
await (await img.getAttribute('src')).startsWith('data:image/png;base64')
275+
(await img.getAttribute('src')).startsWith('data:image/png;base64')
276276
).toBe(true)
277277
})
278278
})

‎playground/ssr-vue/src/entry-server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export async function render(url, manifest) {
66
const { app, router } = createApp()
77

88
// set the router to the desired URL before rendering
9-
router.push(url)
9+
await router.push(url)
1010
await router.isReady()
1111

1212
// passing SSR context object which will be available via useSSRContext()

‎playground/vitestGlobalSetup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function setup(): Promise<void> {
4242
}
4343

4444
export async function teardown(): Promise<void> {
45-
browserServer?.close()
45+
await browserServer?.close()
4646
if (!process.env.VITE_PRESERVE_BUILD_ARTIFACTS) {
4747
fs.removeSync(path.resolve(__dirname, '../playground-temp'))
4848
}

‎playground/vitestSetup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ beforeAll(async (s) => {
172172
serverLogs.length = 0
173173
await page?.close()
174174
await server?.close()
175-
watcher?.close()
175+
await watcher?.close()
176176
if (browser) {
177177
await browser.close()
178178
}

0 commit comments

Comments
 (0)
Please sign in to comment.