From 563b3560fce8802faaf34a18fd06b1c2cbbbef2f Mon Sep 17 00:00:00 2001 From: biodiscus Date: Thu, 9 Nov 2023 14:30:41 +0100 Subject: [PATCH] test: fix testing condition of source.filter option --- examples/simple-site/package-lock.json | 70 +++++++------------ .../expected/index.html | 2 + .../src/index.html | 2 + .../webpack.config.js | 10 +-- 4 files changed, 31 insertions(+), 53 deletions(-) diff --git a/examples/simple-site/package-lock.json b/examples/simple-site/package-lock.json index 9b5324cf..6b62fc58 100644 --- a/examples/simple-site/package-lock.json +++ b/examples/simple-site/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "devDependencies": { "css-loader": "^6.8.1", - "html-bundler-webpack-plugin": "^2.5.1", + "html-bundler-webpack-plugin": "^2.14.2", "sass": "^1.64.2", "sass-loader": "^13.3.2", "webpack": "^5.88.2", @@ -597,9 +597,9 @@ } }, "node_modules/ansis": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/ansis/-/ansis-1.5.5.tgz", - "integrity": "sha512-DNctovTacxs/NfZpGo6bIGWgLd2oZsDO7RJbiYX6Ttj40LPZM1XKv9WtesH13ieOEm1GajjD+Vik2n9YnSTPdA==", + "version": "1.5.6", + "resolved": "https://registry.npmjs.org/ansis/-/ansis-1.5.6.tgz", + "integrity": "sha512-vKn0k5V0oiaOClcUMNDFb7DvI3+asAozhg1wI8bLkYxV0lhfPtIuwjUa1wG9/YaUY/KwO9U2B7m0FMqzn/jXUQ==", "dev": true, "engines": { "node": ">=12.13" @@ -1234,9 +1234,9 @@ } }, "node_modules/eta": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eta/-/eta-3.1.0.tgz", - "integrity": "sha512-my4rbVATtKt9P7oNH6NkynI2bMY081ak9mZfX5Hh2tZ0HHCMhhFKYh6KH9NyUTRMTgohYd2Pd8lA2b9IbR0WrA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/eta/-/eta-3.1.1.tgz", + "integrity": "sha512-GVKq8BhYjvGiwKAnvPOnTwAHach3uHglvW0nG9gjEmo8ZIe8HR1aCLdQ97jlxXPcCWhB6E3rDWOk2fahFKG5Cw==", "dev": true, "engines": { "node": ">=6.0.0" @@ -1651,16 +1651,15 @@ } }, "node_modules/html-bundler-webpack-plugin": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/html-bundler-webpack-plugin/-/html-bundler-webpack-plugin-2.5.1.tgz", - "integrity": "sha512-7MnQYXnBoWJS9QPJ/VaY0ouMFjwVQzf4tRAb91b1h8rwkDgvv/DBYMHg/NbzwO/mOXx9o+zKZ9Wkpt3prJZkng==", + "version": "2.15.2", + "resolved": "https://registry.npmjs.org/html-bundler-webpack-plugin/-/html-bundler-webpack-plugin-2.15.2.tgz", + "integrity": "sha512-h5jlKCy1MK7h5C9lR3USvfJvoIFVxWQkFpAncraY+nWnIRfZtTw35la+1Aw9TLnX8Xl1CZeGegbOEZ/fL7Sk4g==", "dev": true, "dependencies": { - "ansis": "1.5.5", + "ansis": "1.5.6", "enhanced-resolve": ">=5.7.0", - "eta": "^3.0.3", - "html-minifier-terser": "^7.2.0", - "json5": "^2.2.3" + "eta": "^3.1.1", + "html-minifier-terser": "^7.2.0" }, "engines": { "node": ">=14.21.0" @@ -2054,18 +2053,6 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -4483,9 +4470,9 @@ "dev": true }, "ansis": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/ansis/-/ansis-1.5.5.tgz", - "integrity": "sha512-DNctovTacxs/NfZpGo6bIGWgLd2oZsDO7RJbiYX6Ttj40LPZM1XKv9WtesH13ieOEm1GajjD+Vik2n9YnSTPdA==", + "version": "1.5.6", + "resolved": "https://registry.npmjs.org/ansis/-/ansis-1.5.6.tgz", + "integrity": "sha512-vKn0k5V0oiaOClcUMNDFb7DvI3+asAozhg1wI8bLkYxV0lhfPtIuwjUa1wG9/YaUY/KwO9U2B7m0FMqzn/jXUQ==", "dev": true }, "anymatch": { @@ -4954,9 +4941,9 @@ "dev": true }, "eta": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eta/-/eta-3.1.0.tgz", - "integrity": "sha512-my4rbVATtKt9P7oNH6NkynI2bMY081ak9mZfX5Hh2tZ0HHCMhhFKYh6KH9NyUTRMTgohYd2Pd8lA2b9IbR0WrA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/eta/-/eta-3.1.1.tgz", + "integrity": "sha512-GVKq8BhYjvGiwKAnvPOnTwAHach3uHglvW0nG9gjEmo8ZIe8HR1aCLdQ97jlxXPcCWhB6E3rDWOk2fahFKG5Cw==", "dev": true }, "etag": { @@ -5276,16 +5263,15 @@ } }, "html-bundler-webpack-plugin": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/html-bundler-webpack-plugin/-/html-bundler-webpack-plugin-2.5.1.tgz", - "integrity": "sha512-7MnQYXnBoWJS9QPJ/VaY0ouMFjwVQzf4tRAb91b1h8rwkDgvv/DBYMHg/NbzwO/mOXx9o+zKZ9Wkpt3prJZkng==", + "version": "2.15.2", + "resolved": "https://registry.npmjs.org/html-bundler-webpack-plugin/-/html-bundler-webpack-plugin-2.15.2.tgz", + "integrity": "sha512-h5jlKCy1MK7h5C9lR3USvfJvoIFVxWQkFpAncraY+nWnIRfZtTw35la+1Aw9TLnX8Xl1CZeGegbOEZ/fL7Sk4g==", "dev": true, "requires": { - "ansis": "1.5.5", + "ansis": "1.5.6", "enhanced-resolve": ">=5.7.0", - "eta": "^3.0.3", - "html-minifier-terser": "^7.2.0", - "json5": "^2.2.3" + "eta": "^3.1.1", + "html-minifier-terser": "^7.2.0" } }, "html-entities": { @@ -5540,12 +5526,6 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true - }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", diff --git a/test/cases/loader-option-sources-filter-property/expected/index.html b/test/cases/loader-option-sources-filter-property/expected/index.html index 3f1eb13a..4a519f45 100644 --- a/test/cases/loader-option-sources-filter-property/expected/index.html +++ b/test/cases/loader-option-sources-filter-property/expected/index.html @@ -7,6 +7,8 @@ + +

Home

diff --git a/test/cases/loader-option-sources-filter-property/src/index.html b/test/cases/loader-option-sources-filter-property/src/index.html index 7c0c1231..2199d8ad 100644 --- a/test/cases/loader-option-sources-filter-property/src/index.html +++ b/test/cases/loader-option-sources-filter-property/src/index.html @@ -7,6 +7,8 @@ + +

Home

diff --git a/test/cases/loader-option-sources-filter-property/webpack.config.js b/test/cases/loader-option-sources-filter-property/webpack.config.js index ef9f6dd3..909b4409 100644 --- a/test/cases/loader-option-sources-filter-property/webpack.config.js +++ b/test/cases/loader-option-sources-filter-property/webpack.config.js @@ -26,17 +26,11 @@ module.exports = { { tag: 'meta', attributes: ['content'], - // TODO: resolve the `content` attribute when one of other attributes contains one of a value - // or try to resolve a relative path in the attribute - // oneOf: { - // name: ['twitter:image'], - // property: ['og:image', 'og:video'], - // itemprop: ['image', 'screenshot'], - // }, filter: ({ attributes }) => { const attrName = 'property'; const attrValues = ['og:image', 'og:video']; // allowed values - if (attributes[attrName] && attrValues.indexOf(attributes[attrName]) < 0) { + + if (!attributes[attrName] || attrValues.indexOf(attributes[attrName]) < 0) { return false; // return false to disable processing } // return true or undefined to enable processing