Projekt

Obecné

Profil

Stáhnout (752 Bajtů) Statistiky
| Větev: | Revize:
1 3a515b92 cagy
/*
2
	MIT License http://www.opensource.org/licenses/mit-license.php
3
	Author Tobias Koppers @sokra
4
*/
5
"use strict";
6
7
var SourceNode = require("source-map").SourceNode;
8
var SourceMapConsumer = require("source-map").SourceMapConsumer;
9
10
class Source {
11
12
	source() {
13
		throw new Error("Abstract");
14
	}
15
16
	size() {
17
		if(Buffer.from.length === 1) return new Buffer(this.source()).length;
18
		return Buffer.byteLength(this.source())
19
	}
20
21
	map(options) {
22
		return null;
23
	}
24
25
	sourceAndMap(options) {
26
		return {
27
			source: this.source(),
28
			map: this.map()
29
		};
30
	}
31
32
	node() {
33
		throw new Error("Abstract");
34
	}
35
36
	listNode() {
37
		throw new Error("Abstract");
38
	}
39
40
	updateHash(hash) {
41
		var source = this.source();
42
		hash.update(source || "");
43
	}
44
}
45
46
module.exports = Source;