Skip to content

Commit

Permalink
refactor: optimize async and await in code (#9854)
Browse files Browse the repository at this point in the history
  • Loading branch information
那里好脏不可以 authored Sep 6, 2022
1 parent 9c1be10 commit 31f5ff3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/vite/src/node/optimizer/optimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ async function createDepsOptimizer(
}
}

async function startNextDiscoveredBatch() {
function startNextDiscoveredBatch() {
newDepsDiscovered = false

// Add the current depOptimizationProcessing to the queue, these
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function markExplicitImport(url: string) {
return url
}

async function extractImportedBindings(
function extractImportedBindings(
id: string,
source: string,
importSpec: ImportSpecifier,
Expand Down
2 changes: 1 addition & 1 deletion playground/assets/__tests__/assets.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ describe.runIf(isBuild)('encodeURI', () => {
test('img src with encodeURI', async () => {
const img = await page.$('.encodeURI')
expect(
await (await img.getAttribute('src')).startsWith('data:image/png;base64')
(await img.getAttribute('src')).startsWith('data:image/png;base64')
).toBe(true)
})
})
Expand Down
2 changes: 1 addition & 1 deletion playground/ssr-vue/src/entry-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function render(url, manifest) {
const { app, router } = createApp()

// set the router to the desired URL before rendering
router.push(url)
await router.push(url)
await router.isReady()

// passing SSR context object which will be available via useSSRContext()
Expand Down
2 changes: 1 addition & 1 deletion playground/vitestGlobalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function setup(): Promise<void> {
}

export async function teardown(): Promise<void> {
browserServer?.close()
await browserServer?.close()
if (!process.env.VITE_PRESERVE_BUILD_ARTIFACTS) {
fs.removeSync(path.resolve(__dirname, '../playground-temp'))
}
Expand Down
2 changes: 1 addition & 1 deletion playground/vitestSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ beforeAll(async (s) => {
serverLogs.length = 0
await page?.close()
await server?.close()
watcher?.close()
await watcher?.close()
if (browser) {
await browser.close()
}
Expand Down

0 comments on commit 31f5ff3

Please sign in to comment.