source: trip-planner-front/node_modules/webpack/lib/dependencies/ImportWeakDependency.js@ 59329aa

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

initial commit

  • Property mode set to 100644
File size: 2.0 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 ImportDependency = require("./ImportDependency");
10
11/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
12/** @typedef {import("../Dependency")} Dependency */
13/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
14/** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */
15/** @typedef {import("../ModuleGraph")} ModuleGraph */
16
17class ImportWeakDependency extends ImportDependency {
18 /**
19 * @param {string} request the request
20 * @param {[number, number]} range expression range
21 * @param {string[][]=} referencedExports list of referenced exports
22 */
23 constructor(request, range, referencedExports) {
24 super(request, range, referencedExports);
25 this.weak = true;
26 }
27
28 get type() {
29 return "import() weak";
30 }
31}
32
33makeSerializable(
34 ImportWeakDependency,
35 "webpack/lib/dependencies/ImportWeakDependency"
36);
37
38ImportWeakDependency.Template = class ImportDependencyTemplate extends (
39 ImportDependency.Template
40) {
41 /**
42 * @param {Dependency} dependency the dependency for which the template should be applied
43 * @param {ReplaceSource} source the current replace source which can be modified
44 * @param {DependencyTemplateContext} templateContext the context object
45 * @returns {void}
46 */
47 apply(
48 dependency,
49 source,
50 { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements }
51 ) {
52 const dep = /** @type {ImportWeakDependency} */ (dependency);
53 const content = runtimeTemplate.moduleNamespacePromise({
54 chunkGraph,
55 module: moduleGraph.getModule(dep),
56 request: dep.request,
57 strict: module.buildMeta.strictHarmonyModule,
58 message: "import() weak",
59 weak: true,
60 runtimeRequirements
61 });
62
63 source.replace(dep.range[0], dep.range[1] - 1, content);
64 }
65};
66
67module.exports = ImportWeakDependency;
Note: See TracBrowser for help on using the repository browser.