moduleFederationHooks.js 880 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Alexander Akait @alexander-akait
  4. */
  5. "use strict";
  6. const { SyncHook } = require("tapable");
  7. const createHooksRegistry = require("../util/createHooksRegistry");
  8. /** @import Dependency from "../Dependency" */
  9. const createCompilationHooks = () => ({
  10. /**
  11. * @type {SyncHook<Dependency>}
  12. * @since 5.96.0
  13. */
  14. addContainerEntryDependency: new SyncHook(["dependency"]),
  15. /**
  16. * @type {SyncHook<Dependency>}
  17. * @since 5.96.0
  18. */
  19. addFederationRuntimeDependency: new SyncHook(["dependency"])
  20. });
  21. /** @typedef {ReturnType<typeof createCompilationHooks>} CompilationHooks */
  22. // lives outside `ModuleFederationPlugin` so the plugins it applies can read the
  23. // hooks without requiring it back
  24. const getCompilationHooks = createHooksRegistry(createCompilationHooks);
  25. module.exports = getCompilationHooks;