2018-07-23 23:33:29 +08:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
*/
|
2018-07-30 23:08:51 +08:00
|
|
|
|
2018-07-23 23:33:29 +08:00
|
|
|
"use strict";
|
|
|
|
|
2019-09-28 01:50:23 +08:00
|
|
|
const AbstractMethodError = require("./AbstractMethodError");
|
|
|
|
|
2018-07-23 23:33:29 +08:00
|
|
|
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
2018-08-23 02:17:49 +08:00
|
|
|
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
2018-07-30 23:08:51 +08:00
|
|
|
/** @typedef {import("./Dependency")} Dependency */
|
2018-07-23 23:33:29 +08:00
|
|
|
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
|
2018-07-25 03:57:48 +08:00
|
|
|
/** @typedef {import("./InitFragment")} InitFragment */
|
2018-07-31 03:39:17 +08:00
|
|
|
/** @typedef {import("./Module")} Module */
|
2018-07-24 23:35:36 +08:00
|
|
|
/** @typedef {import("./ModuleGraph")} ModuleGraph */
|
2018-07-30 23:08:51 +08:00
|
|
|
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
|
2018-07-23 23:33:29 +08:00
|
|
|
|
2018-07-31 03:39:17 +08:00
|
|
|
/**
|
2018-07-18 01:38:42 +08:00
|
|
|
* @typedef {Object} DependencyTemplateContext
|
2018-07-31 03:39:17 +08:00
|
|
|
* @property {RuntimeTemplate} runtimeTemplate the runtime template
|
|
|
|
* @property {DependencyTemplates} dependencyTemplates the dependency templates
|
2018-07-24 23:35:36 +08:00
|
|
|
* @property {ModuleGraph} moduleGraph the module graph
|
2018-08-23 02:17:49 +08:00
|
|
|
* @property {ChunkGraph} chunkGraph the chunk graph
|
2018-11-15 00:31:32 +08:00
|
|
|
* @property {Set<string>} runtimeRequirements the requirements for runtime
|
2018-07-31 03:39:17 +08:00
|
|
|
* @property {Module} module current module
|
2018-11-16 23:40:03 +08:00
|
|
|
* @property {InitFragment[]} initFragments mutable array of init fragments for the current module
|
2018-07-31 03:39:17 +08:00
|
|
|
*/
|
|
|
|
|
2018-07-23 23:33:29 +08:00
|
|
|
class DependencyTemplate {
|
|
|
|
/**
|
|
|
|
* @abstract
|
|
|
|
* @param {Dependency} dependency the dependency for which the template should be applied
|
|
|
|
* @param {ReplaceSource} source the current replace source which can be modified
|
2018-07-18 01:38:42 +08:00
|
|
|
* @param {DependencyTemplateContext} templateContext the context object
|
2018-07-23 23:33:29 +08:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2018-07-18 01:38:42 +08:00
|
|
|
apply(dependency, source, templateContext) {
|
2019-09-28 01:50:23 +08:00
|
|
|
throw new AbstractMethodError();
|
2018-07-23 23:33:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = DependencyTemplate;
|