| 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("./CodeGenerationResults")} CodeGenerationResults */
|
|---|
| 11 | /** @typedef {import("./ConcatenationScope")} ConcatenationScope */
|
|---|
| 12 | /** @typedef {import("./Dependency")} Dependency */
|
|---|
| 13 | /** @typedef {import("./Dependency").RuntimeSpec} RuntimeSpec */
|
|---|
| 14 | /** @typedef {import("./DependencyTemplates")} DependencyTemplates */
|
|---|
| 15 | /** @typedef {import("./Generator").GenerateContext} GenerateContext */
|
|---|
| 16 | /** @typedef {import("./Module")} Module */
|
|---|
| 17 | /** @typedef {import("./Module").RuntimeRequirements} RuntimeRequirements */
|
|---|
| 18 | /** @typedef {import("./ModuleGraph")} ModuleGraph */
|
|---|
| 19 | /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
|
|---|
| 20 |
|
|---|
| 21 | /**
|
|---|
| 22 | * Defines the init fragment type used by this module.
|
|---|
| 23 | * @template T
|
|---|
| 24 | * @typedef {import("./InitFragment")<T>} InitFragment
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 | /**
|
|---|
| 28 | * Defines the dependency template context type used by this module.
|
|---|
| 29 | * @typedef {object} DependencyTemplateContext
|
|---|
| 30 | * @property {RuntimeTemplate} runtimeTemplate the runtime template
|
|---|
| 31 | * @property {DependencyTemplates} dependencyTemplates the dependency templates
|
|---|
| 32 | * @property {ModuleGraph} moduleGraph the module graph
|
|---|
| 33 | * @property {ChunkGraph} chunkGraph the chunk graph
|
|---|
| 34 | * @property {RuntimeRequirements} runtimeRequirements the requirements for runtime
|
|---|
| 35 | * @property {Module} module current module
|
|---|
| 36 | * @property {RuntimeSpec} runtime current runtimes, for which code is generated
|
|---|
| 37 | * @property {InitFragment<GenerateContext>[]} initFragments mutable array of init fragments for the current module
|
|---|
| 38 | * @property {ConcatenationScope=} concatenationScope when in a concatenated module, information about other concatenated modules
|
|---|
| 39 | * @property {CodeGenerationResults} codeGenerationResults the code generation results
|
|---|
| 40 | * @property {InitFragment<GenerateContext>[]} chunkInitFragments chunkInitFragments
|
|---|
| 41 | */
|
|---|
| 42 |
|
|---|
| 43 | /**
|
|---|
| 44 | * Defines the css dependency template context extras type used by this module.
|
|---|
| 45 | * @typedef {object} CssDependencyTemplateContextExtras
|
|---|
| 46 | * @property {CssData} cssData the css exports data
|
|---|
| 47 | * @property {string} type the css exports data
|
|---|
| 48 | */
|
|---|
| 49 |
|
|---|
| 50 | /**
|
|---|
| 51 | * Defines the css data type used by this module.
|
|---|
| 52 | * @typedef {object} CssData
|
|---|
| 53 | * @property {boolean} esModule whether export __esModule
|
|---|
| 54 | * @property {Map<string, string>} exports the css exports
|
|---|
| 55 | * @property {Map<string, { line: number, column: number }>=} exportLocs source position (line is 1-based, column is 0-based) of each export's defining identifier in the original CSS, used to emit fine-grained JS-to-CSS source mappings
|
|---|
| 56 | */
|
|---|
| 57 |
|
|---|
| 58 | /** @typedef {DependencyTemplateContext & CssDependencyTemplateContextExtras} CssDependencyTemplateContext */
|
|---|
| 59 |
|
|---|
| 60 | class DependencyTemplate {
|
|---|
| 61 | /* istanbul ignore next */
|
|---|
| 62 | /**
|
|---|
| 63 | * Applies the plugin by registering its hooks on the compiler.
|
|---|
| 64 | * @abstract
|
|---|
| 65 | * @param {Dependency} dependency the dependency for which the template should be applied
|
|---|
| 66 | * @param {ReplaceSource} source the current replace source which can be modified
|
|---|
| 67 | * @param {DependencyTemplateContext} templateContext the context object
|
|---|
| 68 | * @returns {void}
|
|---|
| 69 | */
|
|---|
| 70 | apply(dependency, source, templateContext) {
|
|---|
| 71 | const AbstractMethodError = require("./errors/AbstractMethodError");
|
|---|
| 72 |
|
|---|
| 73 | throw new AbstractMethodError();
|
|---|
| 74 | }
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | module.exports = DependencyTemplate;
|
|---|