Socket
Socket
Sign inDemoInstall

html-loader

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-loader - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

8

dist/plugins/sources-plugin.js

@@ -8,11 +8,15 @@ "use strict";

var _parse = require("parse5");
var _parse = _interopRequireDefault(require("parse5"));
var _utils = require("../utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = options => function process(html) {
const sources = [];
const document = (0, _parse.parse)(html, {
const document = _parse.default.parse(html, {
sourceCodeLocationInfo: true
});
let needIgnore = false;

@@ -19,0 +23,0 @@ (0, _utils.traverse)(document, node => {

@@ -966,6 +966,4 @@ "use strict";

}
} // Replaces "<script>" or "</script>" to "<" + "script>" or "<" + "/script>".
}
code = code.replace(/<(\/?script)/g, (_, s) => `<" + "${s}`);
return `// Module\n${replacersCode}var code = ${code};\n`;

@@ -972,0 +970,0 @@ }

{
"name": "html-loader",
"version": "3.1.1",
"version": "3.1.2",
"description": "Html loader module for webpack",

@@ -16,3 +16,3 @@ "license": "MIT",

"engines": {
"node": ">= 14.15.0"
"node": ">= 12.13.0"
},

@@ -46,33 +46,33 @@ "scripts": {

"dependencies": {
"html-minifier-terser": "^6.1.0",
"parse5": "^7.0.0"
"html-minifier-terser": "^6.0.2",
"parse5": "^6.0.1"
},
"devDependencies": {
"@babel/cli": "^7.17.10",
"@babel/core": "^7.18.2",
"@babel/preset-env": "^7.18.2",
"@commitlint/cli": "^17.0.2",
"@commitlint/config-conventional": "^17.0.2",
"@babel/cli": "^7.16.7",
"@babel/core": "^7.16.7",
"@babel/preset-env": "^7.16.7",
"@commitlint/cli": "^14.1.0",
"@commitlint/config-conventional": "^14.1.0",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^28.1.1",
"babel-jest": "^27.4.5",
"cross-env": "^7.0.3",
"del": "^6.1.1",
"del": "^6.0.0",
"del-cli": "^4.0.0",
"es-check": "^6.2.1",
"eslint": "^8.16.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"es-check": "^6.1.1",
"eslint": "^8.6.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.4",
"handlebars": "^4.7.7",
"html-webpack-plugin": "^5.3.2",
"husky": "^8.0.1",
"jest": "^28.1.1",
"lint-staged": "^13.0.1",
"memfs": "^3.4.4",
"husky": "^7.0.0",
"jest": "^27.4.5",
"lint-staged": "^11.0.0",
"memfs": "^3.4.1",
"npm-run-all": "^4.1.5",
"posthtml": "^0.16.6",
"posthtml-webp": "^2.2.0",
"prettier": "^2.6.2",
"standard-version": "^9.5.0",
"posthtml": "^0.16.4",
"posthtml-webp": "^2.1.0",
"prettier": "^2.5.1",
"standard-version": "^9.3.0",
"unescape-unicode": "^0.2.0",
"webpack": "^5.73.0"
"webpack": "^5.65.0"
},

@@ -79,0 +79,0 @@ "keywords": [

<div align="center">
<img width="200" height="200" src="https://www.w3.org/html/logo/downloads/HTML5_Logo.svg" alt="html-loader">
<img width="200" height="200" src="https://worldvectorlogo.com/logos/html5.svg" alt="html-loader">
<a href="https://github.com/webpack/webpack">

@@ -10,2 +10,3 @@ <img width="200" height="200" vspace="" hspace="25" src="https://webpack.js.org/assets/icon-square-big.svg" alt="webpack">

[![node][node]][node-url]
[![deps][deps]][deps-url]
[![tests][tests]][tests-url]

@@ -28,14 +29,2 @@ [![coverage][cover]][cover-url]

or
```console
yarn add -D html-loader
```
or
```console
pnpm add -D html-loader
```
Then add the plugin to your `webpack` config. For example:

@@ -66,34 +55,12 @@

- **[`sources`](#sources)**
- **[`preprocessor`](#preprocessor)**
- **[`minimize`](#minimize)**
- **[`esModule`](#esmodule)**
| Name | Type | Default | Description |
| :---------------------------------: | :-----------------: | :------------------------------------------: | :----------------------------------------------- |
| **[`sources`](#sources)** | `{Boolean\|Object}` | `true` | Enables/Disables sources handling |
| **[`preprocessor`](#preprocessor)** | `{Function}` | `undefined` | Allows pre-processing of content before handling |
| **[`minimize`](#minimize)** | `{Boolean\|Object}` | `true` in production mode, otherwise `false` | Tell `html-loader` to minimize HTML |
| **[`esModule`](#esmodule)** | `{Boolean}` | `true` | Enable/disable ES modules syntax |
### `sources`
Type:
```ts
type sources =
| boolean
| {
list?: Array<{
tag?: string;
attribute?: string;
type?: string;
filter?: (
tag: string,
attribute: string,
attributes: string,
resourcePath: string
) => boolean;
}>;
urlFilter?: (
attribute: string,
value: string,
resourcePath: string
) => boolean;
};
```
Type: `Boolean|Object`
Default: `true`

@@ -129,3 +96,3 @@

#### `boolean`
#### `Boolean`

@@ -153,3 +120,3 @@ The `true` value enables processing of all default elements and attributes, the `false` disable processing of all attributes.

#### `object`
#### `Object`

@@ -206,18 +173,3 @@ Allows you to specify which tags and attributes to process, filter them, filter urls and process sources starts with `/`.

Type:
```ts
type list = Array<{
tag?: string;
attribute?: string;
type?: string;
filter?: (
tag: string,
attribute: string,
attributes: string,
resourcePath: string
) => boolean;
}>;
```
Type: `Array`
Default: [supported tags and attributes](#sources).

@@ -411,12 +363,3 @@

Type:
```ts
type urlFilter = (
attribute: string,
value: string,
resourcePath: string
) => boolean;
```
Type: `Function`
Default: `undefined`

@@ -457,11 +400,3 @@

Type:
```ts
type preprocessor = (
content: string | Buffer,
loaderContext: LoaderContext
) => HTMLElement;
```
Type: `Function`
Default: `undefined`

@@ -482,5 +417,5 @@

#### `function`
#### `Function`
You can set the `preprocessor` option as a `function` instance.
You can set the `preprocessor` option as a `Function` instance.

@@ -563,21 +498,3 @@ **webpack.config.js**

Type:
```ts
type minimize =
| boolean
| {
caseSensitive?: boolean;
collapseWhitespace?: boolean;
conservativeCollapse?: boolean;
keepClosingSlash?: boolean;
minifyCSS?: boolean;
minifyJS?: boolean;
removeComments?: boolean;
removeRedundantAttributes?: boolean;
removeScriptTypeAttributes?: boolean;
removeStyleLinkTypeAttributes?: boolean;
};
```
Type: `Boolean|Object`
Default: `true` in production mode, otherwise `false`

@@ -587,3 +504,3 @@

#### `boolean`
#### `Boolean`

@@ -625,3 +542,3 @@ The enabled rules for minimizing by default are the following ones:

#### `object`
#### `Object`

@@ -683,8 +600,3 @@ **webpack.config.js**

Type:
```ts
type esModule = boolean;
```
Type: `Boolean`
Default: `true`

@@ -879,3 +791,3 @@

test: /\.html$/i,
use: ["html-loader"],
use: ["extract-loader", "html-loader"],
},

@@ -1030,3 +942,3 @@ {

test: /\.html$/i,
use: ["html-loader"],
use: ["extract-loader", "html-loader"],
},

@@ -1052,2 +964,4 @@ ],

[node-url]: https://nodejs.org
[deps]: https://david-dm.org/webpack-contrib/html-loader.svg
[deps-url]: https://david-dm.org/webpack-contrib/html-loader
[tests]: https://github.com/webpack-contrib/html-loader/workflows/html-loader/badge.svg

@@ -1054,0 +968,0 @@ [tests-url]: https://github.com/webpack-contrib/html-loader/actions

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc