[6a3a178] | 1 | /*
|
---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
| 3 | Author Tobias Koppers @sokra
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | "use strict";
|
---|
| 7 |
|
---|
| 8 | const Dependency = require("../Dependency");
|
---|
| 9 | const makeSerializable = require("../util/makeSerializable");
|
---|
| 10 | const ModuleDependency = require("./ModuleDependency");
|
---|
| 11 | const ModuleDependencyAsId = require("./ModuleDependencyTemplateAsId");
|
---|
| 12 |
|
---|
| 13 | /** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
|
---|
| 14 | /** @typedef {import("../ModuleGraph")} ModuleGraph */
|
---|
| 15 | /** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
---|
| 16 |
|
---|
| 17 | class RequireResolveDependency extends ModuleDependency {
|
---|
| 18 | constructor(request, range) {
|
---|
| 19 | super(request);
|
---|
| 20 |
|
---|
| 21 | this.range = range;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | get type() {
|
---|
| 25 | return "require.resolve";
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | get category() {
|
---|
| 29 | return "commonjs";
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | /**
|
---|
| 33 | * Returns list of exports referenced by this dependency
|
---|
| 34 | * @param {ModuleGraph} moduleGraph module graph
|
---|
| 35 | * @param {RuntimeSpec} runtime the runtime for which the module is analysed
|
---|
| 36 | * @returns {(string[] | ReferencedExport)[]} referenced exports
|
---|
| 37 | */
|
---|
| 38 | getReferencedExports(moduleGraph, runtime) {
|
---|
| 39 | // This doesn't use any export
|
---|
| 40 | return Dependency.NO_EXPORTS_REFERENCED;
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | makeSerializable(
|
---|
| 45 | RequireResolveDependency,
|
---|
| 46 | "webpack/lib/dependencies/RequireResolveDependency"
|
---|
| 47 | );
|
---|
| 48 |
|
---|
| 49 | RequireResolveDependency.Template = ModuleDependencyAsId;
|
---|
| 50 |
|
---|
| 51 | module.exports = RequireResolveDependency;
|
---|