inject-manifest.d.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import webpack from 'webpack';
  2. import { WebpackInjectManifestOptions } from 'workbox-build';
  3. /**
  4. * This class supports compiling a service worker file provided via `swSrc`,
  5. * and injecting into that service worker a list of URLs and revision
  6. * information for precaching based on the webpack asset pipeline.
  7. *
  8. * Use an instance of `InjectManifest` in the
  9. * [`plugins` array](https://webpack.js.org/concepts/plugins/#usage) of a
  10. * webpack config.
  11. *
  12. * In addition to injecting the manifest, this plugin will perform a compilation
  13. * of the `swSrc` file, using the options from the main webpack configuration.
  14. *
  15. * ```
  16. * // The following lists some common options; see the rest of the documentation
  17. * // for the full set of options and defaults.
  18. * new InjectManifest({
  19. * exclude: [/.../, '...'],
  20. * maximumFileSizeToCacheInBytes: ...,
  21. * swSrc: '...',
  22. * });
  23. * ```
  24. *
  25. * @memberof module:workbox-webpack-plugin
  26. */
  27. declare class InjectManifest {
  28. protected config: WebpackInjectManifestOptions;
  29. private alreadyCalled;
  30. /**
  31. * Creates an instance of InjectManifest.
  32. */
  33. constructor(config: WebpackInjectManifestOptions);
  34. /**
  35. * @param {Object} [compiler] default compiler object passed from webpack
  36. *
  37. * @private
  38. */
  39. propagateWebpackConfig(compiler: webpack.Compiler): void;
  40. /**
  41. * @param {Object} [compiler] default compiler object passed from webpack
  42. *
  43. * @private
  44. */
  45. apply(compiler: webpack.Compiler): void;
  46. /**
  47. * @param {Object} compilation The webpack compilation.
  48. * @param {Object} parentCompiler The webpack parent compiler.
  49. *
  50. * @private
  51. */
  52. performChildCompilation(compilation: webpack.Compilation, parentCompiler: webpack.Compiler): Promise<void>;
  53. /**
  54. * @param {Object} compilation The webpack compilation.
  55. * @param {Object} parentCompiler The webpack parent compiler.
  56. *
  57. * @private
  58. */
  59. addSrcToAssets(compilation: webpack.Compilation, parentCompiler: webpack.Compiler): void;
  60. /**
  61. * @param {Object} compilation The webpack compilation.
  62. * @param {Object} parentCompiler The webpack parent compiler.
  63. *
  64. * @private
  65. */
  66. handleMake(compilation: webpack.Compilation, parentCompiler: webpack.Compiler): Promise<void>;
  67. /**
  68. * @param {Object} compilation The webpack compilation.
  69. *
  70. * @private
  71. */
  72. addAssets(compilation: webpack.Compilation): Promise<void>;
  73. }
  74. export { InjectManifest };