source: trip-planner-front/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsId.js@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[6a3a178]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const ModuleDependency = require("./ModuleDependency");
9
10/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
11/** @typedef {import("../Dependency")} Dependency */
12/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
13
14class ModuleDependencyTemplateAsId extends ModuleDependency.Template {
15 /**
16 * @param {Dependency} dependency the dependency for which the template should be applied
17 * @param {ReplaceSource} source the current replace source which can be modified
18 * @param {DependencyTemplateContext} templateContext the context object
19 * @returns {void}
20 */
21 apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) {
22 const dep = /** @type {ModuleDependency} */ (dependency);
23 if (!dep.range) return;
24 const content = runtimeTemplate.moduleId({
25 module: moduleGraph.getModule(dep),
26 chunkGraph,
27 request: dep.request,
28 weak: dep.weak
29 });
30 source.replace(dep.range[0], dep.range[1] - 1, content);
31 }
32}
33
34module.exports = ModuleDependencyTemplateAsId;
Note: See TracBrowser for help on using the repository browser.