|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.3 KB
|
| Rev | Line | |
|---|
| [9af201e] | 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Author Tobias Koppers @sokra
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | "use strict";
|
|---|
| 7 |
|
|---|
| 8 | const Source = require("./Source");
|
|---|
| 9 |
|
|---|
| 10 | /** @typedef {import("./Source").HashLike} HashLike */
|
|---|
| 11 | /** @typedef {import("./Source").MapOptions} MapOptions */
|
|---|
| 12 | /** @typedef {import("./Source").RawSourceMap} RawSourceMap */
|
|---|
| 13 | /** @typedef {import("./Source").SourceValue} SourceValue */
|
|---|
| 14 |
|
|---|
| 15 | class SizeOnlySource extends Source {
|
|---|
| 16 | /**
|
|---|
| 17 | * @param {number} size size
|
|---|
| 18 | */
|
|---|
| 19 | constructor(size) {
|
|---|
| 20 | super();
|
|---|
| 21 | /**
|
|---|
| 22 | * @private
|
|---|
| 23 | * @type {number}
|
|---|
| 24 | */
|
|---|
| 25 | this._size = size;
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | _error() {
|
|---|
| 29 | return new Error(
|
|---|
| 30 | "Content and Map of this Source is not available (only size() is supported)",
|
|---|
| 31 | );
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | /**
|
|---|
| 35 | * @returns {number} size
|
|---|
| 36 | */
|
|---|
| 37 | size() {
|
|---|
| 38 | return this._size;
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | /**
|
|---|
| 42 | * @returns {SourceValue} source
|
|---|
| 43 | */
|
|---|
| 44 | source() {
|
|---|
| 45 | throw this._error();
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | /**
|
|---|
| 49 | * @returns {Buffer} buffer
|
|---|
| 50 | */
|
|---|
| 51 | buffer() {
|
|---|
| 52 | throw this._error();
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | /**
|
|---|
| 56 | * @returns {Buffer[]} buffers
|
|---|
| 57 | */
|
|---|
| 58 | buffers() {
|
|---|
| 59 | throw this._error();
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | /**
|
|---|
| 63 | * @param {MapOptions=} options map options
|
|---|
| 64 | * @returns {RawSourceMap | null} map
|
|---|
| 65 | */
|
|---|
| 66 | // eslint-disable-next-line no-unused-vars
|
|---|
| 67 | map(options) {
|
|---|
| 68 | throw this._error();
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 | /**
|
|---|
| 72 | * @param {HashLike} hash hash
|
|---|
| 73 | * @returns {void}
|
|---|
| 74 | */
|
|---|
| 75 | // eslint-disable-next-line no-unused-vars
|
|---|
| 76 | updateHash(hash) {
|
|---|
| 77 | throw this._error();
|
|---|
| 78 | }
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | module.exports = SizeOnlySource;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.