You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
602 B

3 months ago
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const Source = require("./Source");
  7. class SizeOnlySource extends Source {
  8. constructor(size) {
  9. super();
  10. this._size = size;
  11. }
  12. _error() {
  13. return new Error(
  14. "Content and Map of this Source is not available (only size() is supported)"
  15. );
  16. }
  17. size() {
  18. return this._size;
  19. }
  20. source() {
  21. throw this._error();
  22. }
  23. buffer() {
  24. throw this._error();
  25. }
  26. map(options) {
  27. throw this._error();
  28. }
  29. updateHash() {
  30. throw this._error();
  31. }
  32. }
  33. module.exports = SizeOnlySource;