From ed0286186b24748ec7bfa336f83c382363a22f1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=A3=E9=87=8C=E5=A5=BD=E8=84=8F=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5?= <453491931@qq.com> Date: Fri, 22 Jul 2022 19:28:41 +0800 Subject: [PATCH] chore: fix code typos (#9033) --- .github/workflows/ci.yml | 2 +- packages/plugin-legacy/LICENSE | 21 +++++++++++++++++++ packages/plugin-vue/LICENSE | 2 +- packages/vite/src/node/config.ts | 4 ++-- packages/vite/src/node/optimizer/index.ts | 2 +- packages/vite/src/node/optimizer/optimizer.ts | 8 +++---- packages/vite/src/node/plugins/html.ts | 2 +- .../src/node/server/middlewares/transform.ts | 4 ++-- packages/vite/src/node/ssr/ssrModuleLoader.ts | 2 +- playground/css/index.html | 6 +++--- playground/define/__tests__/define.spec.ts | 2 +- .../main-accepted/main-accepted.ts | 2 +- playground/legacy/__tests__/legacy.spec.ts | 2 +- .../browser-field/no-ext-index/index.js | 2 +- playground/resolve/browser-field/no-ext.js | 2 +- .../resolve/browser-field/out/esm.browser.js | 2 +- playground/tailwind/src/router.ts | 4 ++-- playground/vue/__tests__/vue.spec.ts | 2 +- 18 files changed, 46 insertions(+), 25 deletions(-) create mode 100644 packages/plugin-legacy/LICENSE diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f190529faa247d..973b78df00591d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,7 @@ jobs: path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} - name: Install Playwright - # does not need to explictly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved + # does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved run: pnpm playwright install chromium - name: Build diff --git a/packages/plugin-legacy/LICENSE b/packages/plugin-legacy/LICENSE new file mode 100644 index 00000000000000..9c1b313d7b1816 --- /dev/null +++ b/packages/plugin-legacy/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/plugin-vue/LICENSE b/packages/plugin-vue/LICENSE index b3d494d14e9c88..9c1b313d7b1816 100644 --- a/packages/plugin-vue/LICENSE +++ b/packages/plugin-vue/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019-present, Yuxi (Evan) You and contributors +Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index ef1b284f06b5a8..55374774da6ecc 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -257,14 +257,14 @@ export interface UserConfig { export interface ExperimentalOptions { /** - * Append fake `&lang.(ext)` when queries are specified, to preseve the file extension for following plugins to process. + * Append fake `&lang.(ext)` when queries are specified, to preserve the file extension for following plugins to process. * * @experimental * @default false */ importGlobRestoreExtension?: boolean /** - * Allow finegrain contol over assets and public files paths + * Allow finegrain control over assets and public files paths * * @experimental */ diff --git a/packages/vite/src/node/optimizer/index.ts b/packages/vite/src/node/optimizer/index.ts index b544bc9f060d20..b678d983353c8f 100644 --- a/packages/vite/src/node/optimizer/index.ts +++ b/packages/vite/src/node/optimizer/index.ts @@ -151,7 +151,7 @@ export type DepOptimizationOptions = DepOptimizationConfig & { export interface DepOptimizationResult { metadata: DepOptimizationMetadata /** - * When doing a re-run, if there are newly discovered dependendencies + * When doing a re-run, if there are newly discovered dependencies * the page reload will be delayed until the next rerun so we need * to be able to discard the result */ diff --git a/packages/vite/src/node/optimizer/optimizer.ts b/packages/vite/src/node/optimizer/optimizer.ts index b754a01ca411a3..9bf03aa88005b0 100644 --- a/packages/vite/src/node/optimizer/optimizer.ts +++ b/packages/vite/src/node/optimizer/optimizer.ts @@ -240,12 +240,12 @@ async function createDepsOptimizer( depOptimizationProcessingQueue.push(depOptimizationProcessing) // Create a new promise for the next rerun, discovered missing - // dependencies will be asigned this promise from this point + // dependencies will be assigned this promise from this point depOptimizationProcessing = newDepOptimizationProcessing() } async function optimizeNewDeps() { - // a succesful completion of the optimizeDeps rerun will end up + // a successful completion of the optimizeDeps rerun will end up // creating new bundled version of all current and discovered deps // in the cache dir and a new metadata info object assigned // to _metadata. A fullReload is only issued if the previous bundled @@ -391,7 +391,7 @@ async function createDepsOptimizer( } else { if (newDepsDiscovered) { // There are newly discovered deps, and another rerun is about to be - // excecuted. Avoid the current full reload discarding this rerun result + // executed. Avoid the current full reload discarding this rerun result // We don't resolve the processing promise, as they will be resolved // once a rerun is committed processingResult.cancel() @@ -528,7 +528,7 @@ async function createDepsOptimizer( src: resolved, // Assing a browserHash to this missing dependency that is unique to // the current state of known + missing deps. If its optimizeDeps run - // doesn't alter the bundled files of previous known dependendencies, + // doesn't alter the bundled files of previous known dependencies, // we don't need a full reload and this browserHash will be kept browserHash: getDiscoveredBrowserHash( metadata.hash, diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index 5287e6e5208ab5..6618d317fc8319 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -45,7 +45,7 @@ interface ScriptAssetsUrl { url: string } -const htmlProxyRE = /\?html-proxy=?[&inline\-css]*&index=(\d+)\.(js|css)$/ +const htmlProxyRE = /\?html-proxy=?(?:&inline-css)?&index=(\d+)\.(js|css)$/ const inlineCSSRE = /__VITE_INLINE_CSS__([a-z\d]{8}_\d+)__/g // Do not allow preceding '.', but do allow preceding '...' for spread operations const inlineImportRE = diff --git a/packages/vite/src/node/server/middlewares/transform.ts b/packages/vite/src/node/server/middlewares/transform.ts index 8d240df9cda2f1..1bba1711e1b326 100644 --- a/packages/vite/src/node/server/middlewares/transform.ts +++ b/packages/vite/src/node/server/middlewares/transform.ts @@ -218,9 +218,9 @@ export function transformMiddleware( } // We don't need to log an error in this case, the request // is outdated because new dependencies were discovered and - // the new pre-bundle dependendencies have changed. + // the new pre-bundle dependencies have changed. // A full-page reload has been issued, and these old requests - // can't be properly fullfilled. This isn't an unexpected + // can't be properly fulfilled. This isn't an unexpected // error but a normal part of the missing deps discovery flow return } diff --git a/packages/vite/src/node/ssr/ssrModuleLoader.ts b/packages/vite/src/node/ssr/ssrModuleLoader.ts index e856b02402b659..8f61125c134d8c 100644 --- a/packages/vite/src/node/ssr/ssrModuleLoader.ts +++ b/packages/vite/src/node/ssr/ssrModuleLoader.ts @@ -307,7 +307,7 @@ async function nodeImport( // rollup-style default import interop for cjs function proxyESM(mod: any) { - // This is the only sensible option when the exports object is a primitve + // This is the only sensible option when the exports object is a primitive if (isPrimitive(mod)) return { default: mod } let defaultExport = 'default' in mod ? mod.default : mod diff --git a/playground/css/index.html b/playground/css/index.html index 7e591ee25f0a5b..39e4305ceda7b8 100644 --- a/playground/css/index.html +++ b/playground/css/index.html @@ -100,13 +100,13 @@

CSS


 
   

- @import dependency w/ style enrtrypoints: this should be purple + @import dependency w/ style entrypoints: this should be purple

- @import dependency w/ sass enrtrypoints: this should be orange + @import dependency w/ sass entrypoints: this should be orange

- @import dependency w/ styl enrtrypoints: this should be red + @import dependency w/ styl entrypoints: this should be red

PostCSS dir-dependency: this should be grey

diff --git a/playground/define/__tests__/define.spec.ts b/playground/define/__tests__/define.spec.ts index 76b1dfef5feb39..c22a622f3bfc21 100644 --- a/playground/define/__tests__/define.spec.ts +++ b/playground/define/__tests__/define.spec.ts @@ -37,7 +37,7 @@ test('string', async () => { ) expect(await page.textContent('.no-identifier-substring')).toBe(String(true)) expect(await page.textContent('.no-property')).toBe(String(true)) - // html would't need to define replacement + // html wouldn't need to define replacement expect(await page.textContent('.exp-define')).toBe('__EXP__') expect(await page.textContent('.import-json')).toBe('__EXP__') expect(await page.textContent('.define-in-dep')).toBe( diff --git a/playground/hmr/accept-exports/main-accepted/main-accepted.ts b/playground/hmr/accept-exports/main-accepted/main-accepted.ts index f48bc7011ff652..0156fbf39d92e2 100644 --- a/playground/hmr/accept-exports/main-accepted/main-accepted.ts +++ b/playground/hmr/accept-exports/main-accepted/main-accepted.ts @@ -1,7 +1,7 @@ import def, { a } from './target' import { x } from './callback' -// we don't want to polute other checks' logs... +// we don't want to pollute other checks' logs... if (0 > 1) console.log(x) console.log(`>>>>>> ${a} ${def}`) diff --git a/playground/legacy/__tests__/legacy.spec.ts b/playground/legacy/__tests__/legacy.spec.ts index 4825757830a901..e9375e051efa6d 100644 --- a/playground/legacy/__tests__/legacy.spec.ts +++ b/playground/legacy/__tests__/legacy.spec.ts @@ -81,7 +81,7 @@ describe.runIf(isBuild)('build', () => { test('should minify legacy chunks with terser', async () => { // This is a ghetto heuristic, but terser output seems to reliably start // with one of the following, and non-terser output (including unminified or - // ebuild-minified) does not! + // esbuild-minified) does not! const terserPattern = /^(?:!function|System.register)/ expect(findAssetFile(/chunk-async-legacy/)).toMatch(terserPattern) diff --git a/playground/resolve/browser-field/no-ext-index/index.js b/playground/resolve/browser-field/no-ext-index/index.js index d3f4967324ffb7..cfce659df53665 100644 --- a/playground/resolve/browser-field/no-ext-index/index.js +++ b/playground/resolve/browser-field/no-ext-index/index.js @@ -1,2 +1,2 @@ -import jsdom from 'jsdom' // should be redireted to empty module +import jsdom from 'jsdom' // should be redirected to empty module export default '' diff --git a/playground/resolve/browser-field/no-ext.js b/playground/resolve/browser-field/no-ext.js index d3f4967324ffb7..cfce659df53665 100644 --- a/playground/resolve/browser-field/no-ext.js +++ b/playground/resolve/browser-field/no-ext.js @@ -1,2 +1,2 @@ -import jsdom from 'jsdom' // should be redireted to empty module +import jsdom from 'jsdom' // should be redirected to empty module export default '' diff --git a/playground/resolve/browser-field/out/esm.browser.js b/playground/resolve/browser-field/out/esm.browser.js index bddf03df0b0c22..b473ac9059ee74 100644 --- a/playground/resolve/browser-field/out/esm.browser.js +++ b/playground/resolve/browser-field/out/esm.browser.js @@ -1,2 +1,2 @@ -import jsdom from 'jsdom' // should be redireted to empty module +import jsdom from 'jsdom' // should be redirected to empty module export default '[success] resolve browser field' diff --git a/playground/tailwind/src/router.ts b/playground/tailwind/src/router.ts index 32f1a47b40540d..cfcf2a29b637e2 100644 --- a/playground/tailwind/src/router.ts +++ b/playground/tailwind/src/router.ts @@ -3,7 +3,7 @@ import Page from './views/Page.vue' const history = createWebHistory() -const routeur = createRouter({ +const router = createRouter({ history: history, routes: [ { @@ -13,4 +13,4 @@ const routeur = createRouter({ ] }) -export default routeur +export default router diff --git a/playground/vue/__tests__/vue.spec.ts b/playground/vue/__tests__/vue.spec.ts index 4a55bdfe80802f..b2fbcf4e093cf5 100644 --- a/playground/vue/__tests__/vue.spec.ts +++ b/playground/vue/__tests__/vue.spec.ts @@ -212,7 +212,7 @@ describe('src imports', () => { await untilUpdated(() => getColor(el), 'red') }) - test('tempalte src import hmr', async () => { + test('template src import hmr', async () => { const el = await page.$('.src-imports-style') editFile('src-import/template.html', (code) => code.replace('should be tan', 'should be red')