source: imaps-frontend/node_modules/webpack/lib/dependencies/ModuleDependencyTemplateAsId.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[79a0317]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/** @typedef {import("../Module")} Module */
14
15class ModuleDependencyTemplateAsId extends ModuleDependency.Template {
16 /**
17 * @param {Dependency} dependency the dependency for which the template should be applied
18 * @param {ReplaceSource} source the current replace source which can be modified
19 * @param {DependencyTemplateContext} templateContext the context object
20 * @returns {void}
21 */
22 apply(dependency, source, { runtimeTemplate, moduleGraph, chunkGraph }) {
23 const dep = /** @type {ModuleDependency} */ (dependency);
24 if (!dep.range) return;
25 const content = runtimeTemplate.moduleId({
26 module: /** @type {Module} */ (moduleGraph.getModule(dep)),
27 chunkGraph,
28 request: dep.request,
29 weak: dep.weak
30 });
31 source.replace(dep.range[0], dep.range[1] - 1, content);
32 }
33}
34
35module.exports = ModuleDependencyTemplateAsId;
Note: See TracBrowser for help on using the repository browser.