123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- "use strict";
- const { Tapable, SyncWaterfallHook, SyncHook } = require("tapable");
- module.exports = class ChunkTemplate extends Tapable {
- constructor(outputOptions) {
- super();
- this.outputOptions = outputOptions || {};
- this.hooks = {
-
- renderManifest: new SyncWaterfallHook(["result", "options"]),
- modules: new SyncWaterfallHook([
- "source",
- "chunk",
- "moduleTemplate",
- "dependencyTemplates"
- ]),
- render: new SyncWaterfallHook([
- "source",
- "chunk",
- "moduleTemplate",
- "dependencyTemplates"
- ]),
- renderWithEntry: new SyncWaterfallHook(["source", "chunk"]),
- hash: new SyncHook(["hash"]),
- hashForChunk: new SyncHook(["hash", "chunk"])
- };
- }
-
- getRenderManifest(options) {
- const result = [];
- this.hooks.renderManifest.call(result, options);
- return result;
- }
-
- updateHash(hash) {
- hash.update("ChunkTemplate");
- hash.update("2");
- this.hooks.hash.call(hash);
- }
-
- updateHashForChunk(hash, chunk, moduleTemplate, dependencyTemplates) {
- this.updateHash(hash);
- this.hooks.hashForChunk.call(hash, chunk);
- }
- };
|