From 6ed9f9c8df1e8ac2722bed01a9d28b660d64e744 Mon Sep 17 00:00:00 2001 From: Evgenii Sokolov Date: Mon, 11 Jul 2022 21:21:58 +0400 Subject: [PATCH] feat: added the `scriptingEnabled` option (#448) --- 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 `