UNPKG

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