source: trip-planner-front/node_modules/webpack/lib/dependencies/HarmonyExportHeaderDependency.js@ 6a3a178

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

initial commit

  • Property mode set to 100644
File size: 1.8 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 makeSerializable = require("../util/makeSerializable");
9const NullDependency = require("./NullDependency");
10
11/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
12/** @typedef {import("../Dependency")} Dependency */
13/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
14
15class HarmonyExportHeaderDependency extends NullDependency {
16 constructor(range, rangeStatement) {
17 super();
18 this.range = range;
19 this.rangeStatement = rangeStatement;
20 }
21
22 get type() {
23 return "harmony export header";
24 }
25
26 serialize(context) {
27 const { write } = context;
28 write(this.range);
29 write(this.rangeStatement);
30 super.serialize(context);
31 }
32
33 deserialize(context) {
34 const { read } = context;
35 this.range = read();
36 this.rangeStatement = read();
37 super.deserialize(context);
38 }
39}
40
41makeSerializable(
42 HarmonyExportHeaderDependency,
43 "webpack/lib/dependencies/HarmonyExportHeaderDependency"
44);
45
46HarmonyExportHeaderDependency.Template = class HarmonyExportDependencyTemplate extends (
47 NullDependency.Template
48) {
49 /**
50 * @param {Dependency} dependency the dependency for which the template should be applied
51 * @param {ReplaceSource} source the current replace source which can be modified
52 * @param {DependencyTemplateContext} templateContext the context object
53 * @returns {void}
54 */
55 apply(dependency, source, templateContext) {
56 const dep = /** @type {HarmonyExportHeaderDependency} */ (dependency);
57 const content = "";
58 const replaceUntil = dep.range
59 ? dep.range[0] - 1
60 : dep.rangeStatement[1] - 1;
61 source.replace(dep.rangeStatement[0], replaceUntil, content);
62 }
63};
64
65module.exports = HarmonyExportHeaderDependency;
Note: See TracBrowser for help on using the repository browser.