MCPcopy
hub / github.com/webpack/webpack / constructor

Method constructor

lib/ChunkTemplate.js:39–172  ·  view source on GitHub ↗

* Creates an instance of ChunkTemplate. * @param {OutputOptions} outputOptions output options * @param {Compilation} compilation the compilation

(outputOptions, compilation)

Source from the content-addressed store, hash-verified

37 * @param {Compilation} compilation the compilation
38 */
39 constructor(outputOptions, compilation) {
40 this._outputOptions = outputOptions || {};
41 this.hooks = Object.freeze({
42 renderManifest: {
43 tap: util.deprecate(
44 /**
45 * Handles the callback logic for this hook.
46 * @template AdditionalOptions
47 * @param {string | Tap & IfSet<AdditionalOptions>} options options
48 * @param {(renderManifestEntries: RenderManifestEntry[], renderManifestOptions: RenderManifestOptions) => RenderManifestEntry[]} fn function
49 */
50 (options, fn) => {
51 compilation.hooks.renderManifest.tap(
52 options,
53 (entries, options) => {
54 if (options.chunk.hasRuntime()) return entries;
55 return fn(entries, options);
56 }
57 );
58 },
59 "ChunkTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)",
60 "DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_MANIFEST"
61 )
62 },
63 modules: {
64 tap: util.deprecate(
65 /**
66 * Handles the callback logic for this hook.
67 * @template AdditionalOptions
68 * @param {string | Tap & IfSet<AdditionalOptions>} options options
69 * @param {(source: Source, moduleTemplate: ModuleTemplate, renderContext: RenderContext) => Source} fn function
70 */
71 (options, fn) => {
72 getJavascriptModulesPlugin()
73 .getCompilationHooks(compilation)
74 .renderChunk.tap(options, (source, renderContext) =>
75 fn(
76 source,
77 compilation.moduleTemplates.javascript,
78 renderContext
79 )
80 );
81 },
82 "ChunkTemplate.hooks.modules is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderChunk instead)",
83 "DEP_WEBPACK_CHUNK_TEMPLATE_MODULES"
84 )
85 },
86 render: {
87 tap: util.deprecate(
88 /**
89 * Handles the callback logic for this hook.
90 * @template AdditionalOptions
91 * @param {string | Tap & IfSet<AdditionalOptions>} options options
92 * @param {(source: Source, moduleTemplate: ModuleTemplate, renderContext: RenderContext) => Source} fn function
93 */
94 (options, fn) => {
95 getJavascriptModulesPlugin()
96 .getCompilationHooks(compilation)

Callers

nothing calls this directly

Calls 6

freezeMethod · 0.80
tapMethod · 0.80
hasRuntimeMethod · 0.80
fnFunction · 0.50
getCompilationHooksMethod · 0.45

Tested by

no test coverage detected