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

"use strict";

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

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

class ImportEagerDependency extends ModuleDependency {
	constructor(request, range) {
		super(request);
		this.range = range;
	}

	get type() {
		return "import() eager";
	}
}

ImportEagerDependency.Template = class ImportEagerDependencyTemplate extends ModuleDependency.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, module, moduleGraph, chunkGraph }
	) {
		const dep = /** @type {ImportEagerDependency} */ (dependency);
		const content = runtimeTemplate.moduleNamespacePromise({
			chunkGraph,
			module: moduleGraph.getModule(dep),
			request: dep.request,
			strict: module.buildMeta.strictHarmonyModule,
			message: "import() eager"
		});
		source.replace(dep.range[0], dep.range[1] - 1, content);
	}
};

module.exports = ImportEagerDependency;

@@ -109,16 +109,78 @@
 rict%22;%0A%0A
+const makeSerializable = require(%22../util/makeSerializable%22);%0A
 const Mo
@@ -560,16 +560,17 @@
 quest);%0A
+%0A
 %09%09this.r
@@ -631,17 +631,330 @@
 er%22;%0A%09%7D%0A
-%7D
+%0A%09serialize(context) %7B%0A%09%09const %7B write %7D = context;%0A%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.range = read();%0A%0A%09%09super.deserialize(context);%0A%09%7D%0A%7D%0A%0AmakeSerializable(%0A%09ImportEagerDependency,%0A%09%22webpack/lib/dependencies/ImportEagerDependency%22%0A);
 %0A%0AImport
@@ -1709,16 +1709,17 @@
 %22%0A%09%09%7D);%0A
+%0A
 %09%09source

make serializable