1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | Author Tobias Koppers @sokra
|
---|
4 | */
|
---|
5 |
|
---|
6 | "use strict";
|
---|
7 |
|
---|
8 | /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
---|
9 | /** @typedef {import("./ChunkGraph")} ChunkGraph */
|
---|
10 | /** @typedef {import("./ConcatenationScope")} ConcatenationScope */
|
---|
11 | /** @typedef {import("./Dependency")} Dependency */
|
---|
12 | /** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */
|
---|
13 | /** @typedef {import("./DependencyTemplates")} DependencyTemplates */
|
---|
14 | /** @typedef {import("./Generator").GenerateContext} GenerateContext */
|
---|
15 | /** @template T @typedef {import("./InitFragment")<T>} InitFragment */
|
---|
16 | /** @typedef {import("./Module")} Module */
|
---|
17 | /** @typedef {import("./ModuleGraph")} ModuleGraph */
|
---|
18 | /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * @typedef {Object} DependencyTemplateContext
|
---|
22 | * @property {RuntimeTemplate} runtimeTemplate the runtime template
|
---|
23 | * @property {DependencyTemplates} dependencyTemplates the dependency templates
|
---|
24 | * @property {ModuleGraph} moduleGraph the module graph
|
---|
25 | * @property {ChunkGraph} chunkGraph the chunk graph
|
---|
26 | * @property {Set<string>} runtimeRequirements the requirements for runtime
|
---|
27 | * @property {Module} module current module
|
---|
28 | * @property {RuntimeSpec} runtime current runtimes, for which code is generated
|
---|
29 | * @property {InitFragment<GenerateContext>[]} initFragments mutable array of init fragments for the current module
|
---|
30 | * @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules
|
---|
31 | */
|
---|
32 |
|
---|
33 | class DependencyTemplate {
|
---|
34 | /* istanbul ignore next */
|
---|
35 | /**
|
---|
36 | * @abstract
|
---|
37 | * @param {Dependency} dependency the dependency for which the template should be applied
|
---|
38 | * @param {ReplaceSource} source the current replace source which can be modified
|
---|
39 | * @param {DependencyTemplateContext} templateContext the context object
|
---|
40 | * @returns {void}
|
---|
41 | */
|
---|
42 | apply(dependency, source, templateContext) {
|
---|
43 | const AbstractMethodError = require("./AbstractMethodError");
|
---|
44 | throw new AbstractMethodError();
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 | module.exports = DependencyTemplate;
|
---|