From 4624b303791a626c4b5be32973cc0b53edc73923 Mon Sep 17 00:00:00 2001 From: Make it real <26638058+echolimazulu@users.noreply.github.com> Date: Tue, 5 Jul 2022 23:42:14 +0400 Subject: [PATCH] feat: adding "scriptingEnabled" option to source set - added option "scriptingEnabled" for "source" object, affected src/utils.js; - added description and example of using "scriptingEnabled" option in README.md; - improved plugin: src/plugins/sources-plugin.js; - extended options structure: src/options.json; - extended test: test/sources-option.test.js; - extended test: test/validate-options.test.js; - added image: test/fixtures/noscript.png; - extended content: test/fixtures/simple.html; - snapshots generated, tests passed. --- README.md | 38 +++++ src/options.json | 3 + src/plugins/sources-plugin.js | 5 +- src/utils.js | 9 +- .../esModule-option.test.js.snap | 33 +++- test/__snapshots__/loader.test.js.snap | 11 +- .../minimize-option.test.js.snap | 51 ++++-- .../__snapshots__/sources-option.test.js.snap | 158 ++++++++++++++---- .../validate-options.test.js.snap | 15 +- test/fixtures/noscript.png | Bin 0 -> 70 bytes test/fixtures/simple.html | 6 +- test/sources-option.test.js | 1 + test/validate-options.test.js | 3 + 13 files changed, 273 insertions(+), 60 deletions(-) create mode 100644 test/fixtures/noscript.png diff --git a/README.md b/README.md index e13eb93b..9a5cdf21 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ type sources = value: string, resourcePath: string ) => boolean; + scriptingEnabled?: boolean; }; ``` @@ -447,6 +448,43 @@ module.exports = { }; ``` +#### `scriptingEnabled` + +Type: + +```ts +type scriptingEnabled = boolean; +``` + +Default: `true` + +By default, the parser in `html-loader` interprets content inside `