source: trip-planner-front/node_modules/webpack/lib/dependencies/ImportEagerDependency.js@ 1ad8e64

Last change on this file since 1ad8e64 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 ImportEagerDependency 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 }
26
27 get type() {
28 return "import() eager";
29 }
30
31 get category() {
32 return "esm";
33 }
34}
35
36makeSerializable(
37 ImportEagerDependency,
38 "webpack/lib/dependencies/ImportEagerDependency"
39);
40
41ImportEagerDependency.Template = class ImportEagerDependencyTemplate extends (
42 ImportDependency.Template
43) {
44 /**
45 * @param {Dependency} dependency the dependency for which the template should be applied
46 * @param {ReplaceSource} source the current replace source which can be modified
47 * @param {DependencyTemplateContext} templateContext the context object
48 * @returns {void}
49 */
50 apply(
51 dependency,
52 source,
53 { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements }
54 ) {
55 const dep = /** @type {ImportEagerDependency} */ (dependency);
56 const content = runtimeTemplate.moduleNamespacePromise({
57 chunkGraph,
58 module: moduleGraph.getModule(dep),
59 request: dep.request,
60 strict: module.buildMeta.strictHarmonyModule,
61 message: "import() eager",
62 runtimeRequirements
63 });
64
65 source.replace(dep.range[0], dep.range[1] - 1, content);
66 }
67};
68
69module.exports = ImportEagerDependency;
Note: See TracBrowser for help on using the repository browser.