source: trip-planner-front/node_modules/webpack/lib/dependencies/CreateScriptUrlDependency.js@ 188ee53

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

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const RuntimeGlobals = require("../RuntimeGlobals");
9const makeSerializable = require("../util/makeSerializable");
10const NullDependency = require("./NullDependency");
11
12/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
13/** @typedef {import("../Dependency")} Dependency */
14/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
15
16class CreateScriptUrlDependency extends NullDependency {
17 /**
18 * @param {[number, number]} range range
19 */
20 constructor(range) {
21 super();
22 this.range = range;
23 }
24
25 get type() {
26 return "create script url";
27 }
28}
29
30CreateScriptUrlDependency.Template = class CreateScriptUrlDependencyTemplate extends (
31 NullDependency.Template
32) {
33 /**
34 * @param {Dependency} dependency the dependency for which the template should be applied
35 * @param {ReplaceSource} source the current replace source which can be modified
36 * @param {DependencyTemplateContext} templateContext the context object
37 * @returns {void}
38 */
39 apply(dependency, source, { runtimeRequirements }) {
40 const dep = /** @type {CreateScriptUrlDependency} */ (dependency);
41
42 runtimeRequirements.add(RuntimeGlobals.createScriptUrl);
43
44 source.insert(dep.range[0], `${RuntimeGlobals.createScriptUrl}(`);
45 source.insert(dep.range[1], ")");
46 }
47};
48
49makeSerializable(
50 CreateScriptUrlDependency,
51 "webpack/lib/dependencies/CreateScriptUrlDependency"
52);
53
54module.exports = CreateScriptUrlDependency;
Note: See TracBrowser for help on using the repository browser.