flight-manifest-plugin.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. import { webpack } from 'next/dist/compiled/webpack/webpack';
  8. interface Options {
  9. dev: boolean;
  10. }
  11. /**
  12. * Webpack module id
  13. */
  14. declare type ModuleId = string | number;
  15. export declare type ManifestChunks = Array<`${string}:${string}` | string>;
  16. interface ManifestNode {
  17. [moduleExport: string]: {
  18. /**
  19. * Webpack module id
  20. */
  21. id: ModuleId;
  22. /**
  23. * Export name
  24. */
  25. name: string;
  26. /**
  27. * Chunks for the module. JS and CSS.
  28. */
  29. chunks: ManifestChunks;
  30. };
  31. }
  32. export declare type FlightManifest = {
  33. __ssr_module_mapping__: {
  34. [moduleId: string]: ManifestNode;
  35. };
  36. } & {
  37. [modulePath: string]: ManifestNode;
  38. };
  39. export declare type FlightCSSManifest = {
  40. [modulePath: string]: string[];
  41. };
  42. export declare class FlightManifestPlugin {
  43. dev: Options['dev'];
  44. constructor(options: Options);
  45. apply(compiler: webpack.Compiler): void;
  46. createAsset(assets: webpack.Compilation['assets'], compilation: webpack.Compilation, context: string): void;
  47. }
  48. export {};