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";
|
|
|
|
|
|
|
|
/** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */
|
2018-08-23 02:17:49 +08:00
|
|
|
/** @typedef {import("./ChunkGraph")} ChunkGraph */
|
2021-11-30 20:46:42 +08:00
|
|
|
/** @typedef {import("./CodeGenerationResults")} CodeGenerationResults */
|
2020-09-11 15:06:24 +08:00
|
|
|
/** @typedef {import("./ConcatenationScope")} ConcatenationScope */
|
2018-07-30 23:08:51 +08:00
|
|
|
/** @typedef {import("./Dependency")} Dependency */
|
2020-07-28 00:09:48 +08:00
|
|
|
/** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */
|
2018-07-23 23:33:29 +08:00
|
|
|
/** @typedef {import("./DependencyTemplates")} DependencyTemplates */
|
2021-06-24 22:44:14 +08:00
|
|
|
/** @typedef {import("./Generator").GenerateContext} GenerateContext */
|
2018-07-31 03:39:17 +08:00
|
|
|
/** @typedef {import("./Module")} Module */
|
2024-03-18 23:28:40 +08:00
|
|
|
/** @typedef {import("./Module").RuntimeRequirements} RuntimeRequirements */
|
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
|
|
|
|
2024-03-18 23:28:40 +08:00
|
|
|
/**
|
|
|
|
* @template T
|
|
|
|
* @typedef {import("./InitFragment")<T>} InitFragment
|
|
|
|
*/
|
|
|
|
|
2018-07-31 03:39:17 +08:00
|
|
|
/**
|
2024-06-11 21:09:50 +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
|
2024-03-18 23:28:40 +08:00
|
|
|
* @property {RuntimeRequirements} runtimeRequirements the requirements for runtime
|
2018-07-31 03:39:17 +08:00
|
|
|
* @property {Module} module current module
|
2024-06-04 14:35:05 +08:00
|
|
|
* @property {RuntimeSpec} runtime current runtimes, for which code is generated
|
2021-06-24 22:44:14 +08:00
|
|
|
* @property {InitFragment<GenerateContext>[]} initFragments mutable array of init fragments for the current module
|
2020-09-11 15:06:24 +08:00
|
|
|
* @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules
|
2021-11-30 20:46:42 +08:00
|
|
|
* @property {CodeGenerationResults} codeGenerationResults the code generation results
|
2021-11-30 18:57:32 +08:00
|
|
|
* @property {InitFragment<GenerateContext>[]} chunkInitFragments chunkInitFragments
|
2018-07-31 03:39:17 +08:00
|
|
|
*/
|
|
|
|
|
2021-12-14 23:02:26 +08:00
|
|
|
/**
|
2024-06-11 21:09:50 +08:00
|
|
|
* @typedef {object} CssDependencyTemplateContextExtras
|
2024-11-29 04:35:59 +08:00
|
|
|
* @property {CssData} cssData the css exports data
|
2024-04-26 14:53:52 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2024-11-29 04:35:59 +08:00
|
|
|
* @typedef {object} CssData
|
2024-04-26 14:53:52 +08:00
|
|
|
* @property {boolean} esModule whether export __esModule
|
|
|
|
* @property {Map<string, string>} exports the css exports
|
2021-12-14 23:02:26 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/** @typedef {DependencyTemplateContext & CssDependencyTemplateContextExtras} CssDependencyTemplateContext */
|
|
|
|
|
2018-07-23 23:33:29 +08:00
|
|
|
class DependencyTemplate {
|
2020-04-16 15:37:11 +08:00
|
|
|
/* istanbul ignore next */
|
2018-07-23 23:33:29 +08:00
|
|
|
/**
|
|
|
|
* @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) {
|
2020-04-16 15:37:11 +08:00
|
|
|
const AbstractMethodError = require("./AbstractMethodError");
|
2025-07-02 20:10:54 +08:00
|
|
|
|
2019-09-28 01:50:23 +08:00
|
|
|
throw new AbstractMethodError();
|
2018-07-23 23:33:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = DependencyTemplate;
|