/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/

"use strict";

const NullDependency = require("./NullDependency");

/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
/** @typedef {import("../Dependency")} Dependency */
/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */

class UnsupportedDependency extends NullDependency {
	constructor(request, range) {
		super();
		this.request = request;
		this.range = range;
	}
}

UnsupportedDependency.Template = class UnsupportedDependencyTemplate extends NullDependency.Template {
	/**
	 * @param {Dependency} dependency the dependency for which the template should be applied
	 * @param {ReplaceSource} source the current replace source which can be modified
	 * @param {DependencyTemplateContext} templateContext the context object
	 * @returns {void}
	 */
	apply(dependency, source, { runtimeTemplate }) {
		const dep = /** @type {UnsupportedDependency} */ (dependency);
		source.replace(
			dep.range[0],
			dep.range[1],
			runtimeTemplate.missingModule({
				request: dep.request
			})
		);
	}
};

module.exports = UnsupportedDependency;

@@ -109,16 +109,78 @@
 rict%22;%0A%0A
+const makeSerializable = require(%22../util/makeSerializable%22);%0A
 const Nu
@@ -547,16 +547,17 @@
 uper();%0A
+%0A
 %09%09this.r
@@ -599,17 +599,378 @@
 nge;%0A%09%7D%0A
-%7D
+%0A%09serialize(context) %7B%0A%09%09const %7B write %7D = context;%0A%0A%09%09write(this.request);%0A%09%09write(this.range);%0A%0A%09%09super.serialize(context);%0A%09%7D%0A%0A%09deserialize(context) %7B%0A%09%09const %7B read %7D = context;%0A%0A%09%09this.request = read();%0A%09%09this.range = read();%0A%0A%09%09super.deserialize(context);%0A%09%7D%0A%7D%0A%0AmakeSerializable(%0A%09UnsupportedDependency,%0A%09%22webpack/lib/dependencies/UnsupportedDependency%22%0A);
 %0A%0AUnsupp
@@ -1459,16 +1459,17 @@
 dency);%0A
+%0A
 %09%09source

make serializable