From 6b0711e79c128ea239b938750f62a0cd0c394e7f Mon Sep 17 00:00:00 2001 From: Taylor Cargill Date: Tue, 4 Aug 2020 09:35:09 -0400 Subject: [PATCH] fix: fix typos in comments (#1484) --- index.js | 12 ++++++------ lib/cached-child-compiler.js | 2 +- lib/child-compiler.js | 8 ++++---- lib/file-watcher-api.js | 2 +- lib/html-tags.js | 4 ++-- spec/basic.spec.js | 4 ++-- spec/caching.spec.js | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/index.js b/index.js index 2d58ab54..60b0ca7e 100644 --- a/index.js +++ b/index.js @@ -201,7 +201,7 @@ class HtmlWebpackPlugin { plugin: self })) .then(({ assetTags }) => { - // Inject scripts to body unless it set explictly to head + // Inject scripts to body unless it set explicitly to head const scriptTarget = self.options.inject === 'head' ? 'head' : 'body'; // Group assets to `head` and `body` tag arrays const assetGroups = this.generateAssetGroups(assetTags, scriptTarget); @@ -214,7 +214,7 @@ class HtmlWebpackPlugin { }); }); - // Turn the compiled tempalte into a nodejs function or into a nodejs string + // Turn the compiled template into a nodejs function or into a nodejs string const templateEvaluationPromise = Promise.resolve() .then(() => { if ('error' in templateResult) { @@ -527,7 +527,7 @@ class HtmlWebpackPlugin { /** * @type {string} the configured public path to the asset root * if a path publicPath is set in the current webpack config use it otherwise - * fallback to a realtive path + * fallback to a relative path */ const webpackPublicPath = compilation.mainTemplate.getPublicPath({ hash: compilationHash }); const isPublicPathDefined = webpackPublicPath.trim() !== ''; @@ -585,7 +585,7 @@ class HtmlWebpackPlugin { if (!asset) { return true; } - // Prevent hot-module files from beeing included: + // Prevent hot-module files from being included: const assetMetaInformation = asset.info || {}; return !(assetMetaInformation.hotModuleReplacement || assetMetaInformation.development); }); @@ -622,8 +622,8 @@ class HtmlWebpackPlugin { } /** - * Converts a favicon file from disk to a webpack ressource - * and returns the url to the ressource + * Converts a favicon file from disk to a webpack resource + * and returns the url to the resource * * @param {string|false} faviconFilePath * @param {WebpackCompilation} compilation diff --git a/lib/cached-child-compiler.js b/lib/cached-child-compiler.js index e7444005..ee044fc3 100644 --- a/lib/cached-child-compiler.js +++ b/lib/cached-child-compiler.js @@ -58,7 +58,7 @@ class CachedChildCompilation { * @type {WebpackCompiler} */ this.compiler = compiler; - // Create a singlton instance for the compiler + // Create a singleton instance for the compiler // if there is none if (compilerMap.has(compiler)) { return; diff --git a/lib/child-compiler.js b/lib/child-compiler.js index d8959792..88180a0a 100644 --- a/lib/child-compiler.js +++ b/lib/child-compiler.js @@ -18,8 +18,8 @@ const LibraryTemplatePlugin = require('webpack/lib/LibraryTemplatePlugin'); const SingleEntryPlugin = require('webpack/lib/SingleEntryPlugin'); /** - * The HtmlWebpackChildCompiler is a helper to allow resusing one childCompiler - * for multile HtmlWebpackPlugin instances to improve the compilation performance. + * The HtmlWebpackChildCompiler is a helper to allow reusing one childCompiler + * for multiple HtmlWebpackPlugin instances to improve the compilation performance. */ class HtmlWebpackChildCompiler { /** @@ -53,14 +53,14 @@ class HtmlWebpackChildCompiler { /** * Returns true if the childCompiler is currently compiling - * @retuns {boolean} + * @returns {boolean} */ isCompiling () { return !this.didCompile() && this.compilationStartedTimestamp !== undefined; } /** - * Returns true if the childCOmpiler is done compiling + * Returns true if the childCompiler is done compiling */ didCompile () { return this.compilationEndedTimestamp !== undefined; diff --git a/lib/file-watcher-api.js b/lib/file-watcher-api.js index 83c78fe8..316796ba 100644 --- a/lib/file-watcher-api.js +++ b/lib/file-watcher-api.js @@ -1,6 +1,6 @@ // @ts-check /** - * To use the availble webpack core api + * To use the available webpack core api * we have to use different child compilers * depending on the used webpack version */ diff --git a/lib/html-tags.js b/lib/html-tags.js index da571580..94911d1a 100644 --- a/lib/html-tags.js +++ b/lib/html-tags.js @@ -2,8 +2,8 @@ /** @typedef {import("../typings").HtmlTagObject} HtmlTagObject */ /** * @file - * This file provides to helper to create html as a object repesentation as - * thoses objects are easier to modify than pure string representations + * This file provides to helper to create html as a object representation as + * those objects are easier to modify than pure string representations * * Usage: * ``` diff --git a/spec/basic.spec.js b/spec/basic.spec.js index 9575312a..c4692e6b 100644 --- a/spec/basic.spec.js +++ b/spec/basic.spec.js @@ -1786,7 +1786,7 @@ describe('HtmlWebpackPlugin', () => { }, [//], path.join('subfolder', 'test.html'), done); }); - it('adds a favicon with a publichPath set to /[hash]/ and replaces the hash', done => { + it('adds a favicon with a publicPath set to /[hash]/ and replaces the hash', done => { testHtmlPlugin({ mode: 'production', entry: path.join(__dirname, 'fixtures/index.js'), @@ -1803,7 +1803,7 @@ describe('HtmlWebpackPlugin', () => { }, [//], null, done); }); - it('adds a favicon with a publichPath set to [hash]/ and replaces the hash', done => { + it('adds a favicon with a publicPath set to [hash]/ and replaces the hash', done => { testHtmlPlugin({ mode: 'production', entry: path.join(__dirname, 'fixtures/index.js'), diff --git a/spec/caching.spec.js b/spec/caching.spec.js index f7cbc030..88d00435 100644 --- a/spec/caching.spec.js +++ b/spec/caching.spec.js @@ -103,7 +103,7 @@ describe('HtmlWebpackPluginCaching', () => { // Verify that no file was built expect(getCompiledModules(stats.toJson())) .toEqual([]); - // Verify that the html was processed only during the inital build + // Verify that the html was processed only during the initial build expect(htmlWebpackPlugin.evaluateCompilationResult.mock.calls.length) .toBe(1); // Verify that the child compilation was executed twice @@ -131,7 +131,7 @@ describe('HtmlWebpackPluginCaching', () => { // Verify that only one file was built expect(getCompiledModuleCount(stats.toJson())) .toBe(1); - // Verify that the html was processed only during the inital build + // Verify that the html was processed only during the initial build expect(htmlWebpackPlugin.evaluateCompilationResult.mock.calls.length) .toBe(1); // Verify that the child compilation was executed only once