2017-05-03 15:35:00 +02:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
*/
|
2017-08-14 05:01:11 +02:00
|
|
|
"use strict";
|
|
|
|
|
2017-05-03 15:35:00 +02:00
|
|
|
var SourceNode = require("source-map").SourceNode;
|
|
|
|
var SourceMapConsumer = require("source-map").SourceMapConsumer;
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
class Source {
|
2017-05-03 15:35:00 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
source() {
|
|
|
|
throw new Error("Abstract");
|
|
|
|
}
|
2017-05-03 15:35:00 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
size() {
|
|
|
|
return this.source().length;
|
|
|
|
}
|
2017-05-03 15:35:00 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
map(options) {
|
|
|
|
return null;
|
|
|
|
}
|
2017-05-03 15:35:00 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
sourceAndMap(options) {
|
|
|
|
return {
|
|
|
|
source: this.source(),
|
|
|
|
map: this.map()
|
|
|
|
};
|
|
|
|
}
|
2017-05-03 15:35:00 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
node() {
|
|
|
|
throw new Error("Abstract");
|
|
|
|
}
|
2017-05-03 15:35:00 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
listNode() {
|
|
|
|
throw new Error("Abstract");
|
|
|
|
}
|
2017-05-03 15:35:00 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
updateHash(hash) {
|
|
|
|
var source = this.source();
|
|
|
|
hash.update(source || "");
|
|
|
|
}
|
|
|
|
}
|
2017-05-03 15:35:00 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
module.exports = Source;
|