This commit is contained in:
chrosey
2017-09-13 07:52:34 +02:00
parent a1f16c37f4
commit 2340b0226b
24621 changed files with 2912161 additions and 149 deletions
+222
View File
@@ -0,0 +1,222 @@
# webpack-sources
Contains multiple classes which represent a `Source`. A `Source` can be asked for source code, size, source map and hash.
## `Source`
Base class for all sources.
### Public methods
All methods should be considered as expensive as they may need to do computations.
#### `source`
``` js
Source.prototype.source() -> String
```
Returns the represented source code as string.
#### `size`
``` js
Source.prototype.size() -> Number
```
Returns the size in chars of the represented source code.
#### `map`
``` js
Source.prototype.map(options: Object) -> Object | null
```
Returns the SourceMap of the represented source code as JSON. May return `null` if no SourceMap is available.
The `options` object can contain the following keys:
* `columns: Boolean` (default `true`): If set to false the implementation may omit mappings for columns.
* `module: Boolean` (default `true`): If set to false the implementation may omit inner mappings for modules.
#### `sourceAndMap`
``` js
Source.prototype.sourceAndMap(options: Object) -> {
code: String,
map: Object
}
```
Returns both, source code (like `Source.prototype.source()` and SourceMap (like `Source.prototype.map()`). This method could have better performance than calling `source()` and `map()` separatly.
See `map()` for `options`.
#### `updateHash`
``` js
Source.prototype.updateHash(hash: Hash) -> void
```
Updates the provided `Hash` object with the content of the represented source code. (`Hash` is an object with an `update` method, which is called with string values)
#### `node` (optional)
``` js
Source.prototype.node(options: Object) -> SourceNode
```
This is an optional method. It may be `null` if not implemented.
Returns a `SourceNode` (see source-map library) for the represented source code.
See `map()` for `options`.
#### `listNode` (optional)
``` js
Source.prototype.listNode(options: Object) -> SourceNode
```
This is an optional method. It may be `null` if not implemented.
Returns a `SourceListMap` (see source-list-map library) for the represented source code.
See `map()` for `options`.
## `RawSource`
Represents source code without SourceMap.
``` js
new RawSource(sourceCode: String)
```
## `OriginalSource`
Represents source code, which is a copy of the original file.
``` js
new OriginalSource(
sourceCode: String,
name: String
)
```
* `sourceCode`: The source code.
* `name`: The filename of the original source code.
OriginalSource tries to create column mappings if requested, by splitting the source code at typical statement borders (`;`, `{`, `}`).
## `SourceMapSource`
Represents source code with SourceMap, optionally having an additional SourceMap for the original source.
``` js
new SourceMapSource(
sourceCode: String,
name: String,
sourceMap: Object | String,
originalSource?: String,
innerSourceMap?: Object | String
)
```
* `sourceCode`: The source code.
* `name`: The filename of the original source code.
* `sourceMap`: The SourceMap for the source code.
* `originalSource`: The source code of the original file. Can be omitted if the `sourceMap` already contains the original source code.
* `innerSourceMap`: The SourceMap for the `originalSource`/`name`.
## `LineToLineMappedSource`
Represents source code, which is mapped line by line to the orginal file.
``` js
new LineToLineMappedSource(
sourceCode: String,
name: String,
originalSource: String
)
```
* `sourceCode`: The source code.
* `name`: The filename of the original source code.
* `originalSource`: The original source code.
## `CachedSource`
Decorates a `Source` and caches returned results of `map`, `source`, `size` and `sourceAndMap` in memory. Every other operation is delegated to the wrapped `Source`.
``` js
new CachedSource(source: Source)
```
## `PrefixSource`
Prefix every line of the decorated `Source` with a provided string.
``` js
new PrefixSource(
prefix: String,
source: Source
)
```
## `ConcatSource`
Concatenate mulitple `Source`s or strings to a single source.
``` js
new ConcatSource(
...items?: Source | String
)
```
### Public methods
#### `add`
``` js
ConcatSource.prototype.add(item: Source | String)
```
Adds an item to the source.
## `ReplaceSource`
Decorates a `Source` with replacements and insertions of source code.
### Public methods
#### `replace`
``` js
ReplaceSource.prototype.replace(
start: Number,
end: Number,
replacement: String
)
```
Replaces chars from `start` (0-indexed, inclusive) to `end` (0-indexed, inclusive) with `replacement`.
Locations represents locations in the original source and are not influenced by other replacements or insertions.
#### `insert`
``` js
ReplaceSource.prototype.insert(
pos: Number,
insertion: String
)
```
Inserts the `insertion` before char `pos` (0-indexed).
Location represents location in the original source and is not influenced by other replacements or insertions.
#### `original`
Get decorated `Source`.
+78
View File
@@ -0,0 +1,78 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const Source = require("./Source");
class CachedSource extends Source {
constructor(source) {
super();
this._source = source;
this._cachedSource = undefined;
this._cachedSize = undefined;
this._cachedMaps = {};
if(source.node) this.node = function(options) {
return this._source.node(options);
};
if(source.listMap) this.listMap = function(options) {
return this._source.listMap(options);
};
}
source() {
if(typeof this._cachedSource !== "undefined") return this._cachedSource;
return this._cachedSource = this._source.source();
}
size() {
if(typeof this._cachedSize !== "undefined") return this._cachedSize;
if(typeof this._cachedSource !== "undefined")
return this._cachedSize = this._cachedSource.length;
return this._cachedSize = this._source.size();
}
sourceAndMap(options) {
const key = JSON.stringify(options);
if(typeof this._cachedSource !== "undefined" && key in this._cachedMaps)
return {
source: this._cachedSource,
map: this._cachedMaps[key]
};
else if(typeof this._cachedSource !== "undefined") {
return {
source: this._cachedSource,
map: this._cachedMaps[key] = this._source.map(options)
};
} else if(key in this._cachedMaps) {
return {
source: this._cachedSource = this._source.source(),
map: this._cachedMaps[key]
};
}
const result = this._source.sourceAndMap(options);
this._cachedSource = result.source;
this._cachedMaps[key] = result.map;
return {
source: this._cachedSource,
map: this._cachedMaps[key]
};
}
map(options) {
if(!options) options = {};
const key = JSON.stringify(options);
if(key in this._cachedMaps)
return this._cachedMaps[key];
return this._cachedMaps[key] = this._source.map();
}
updateHash(hash) {
this._source.updateHash(hash);
}
}
module.exports = CachedSource;
+65
View File
@@ -0,0 +1,65 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const SourceNode = require("source-map").SourceNode;
const SourceListMap = require("source-list-map").SourceListMap;
const Source = require("./Source");
class ConcatSource extends Source {
constructor() {
super();
this.children = Array.prototype.slice.call(arguments);
}
add(item) {
this.children.push(item);
}
source() {
return this.children.map(function(item) {
return typeof item === "string" ? item : item.source();
}).join("");
}
size() {
return this.children.map(function(item) {
return typeof item === "string" ? item.length : item.size();
}).reduce(function(sum, s) {
return sum + s;
}, 0);
}
node(options) {
const node = new SourceNode(null, null, null, this.children.map(function(item) {
return typeof item === "string" ? item : item.node(options);
}));
return node;
}
listMap(options) {
const map = new SourceListMap();
this.children.forEach(function(item) {
if(typeof item === "string")
map.add(item);
else
map.add(item.listMap(options));
});
return map;
}
updateHash(hash) {
this.children.forEach(function(item) {
if(typeof item === "string")
hash.update(item);
else
item.updateHash(hash);
});
}
}
require("./SourceAndMapMixin")(ConcatSource.prototype);
module.exports = ConcatSource;
+49
View File
@@ -0,0 +1,49 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
var SourceNode = require("source-map").SourceNode;
var SourceMapConsumer = require("source-map").SourceMapConsumer;
var SourceListMap = require("source-list-map").SourceListMap;
var Source = require("./Source");
class LineToLineMappedSource extends Source {
constructor(value, name, originalSource) {
super();
this._value = value;
this._name = name;
this._originalSource = originalSource;
}
source() {
return this._value;
}
node(options) {
var value = this._value;
var name = this._name;
var lines = value.split("\n");
var node = new SourceNode(null, null, null,
lines.map(function(line, idx) {
return new SourceNode(idx + 1, 0, name, (line + (idx != lines.length - 1 ? "\n" : "")));
})
);
node.setSourceContent(name, this._originalSource);
return node;
}
listMap(options) {
return new SourceListMap(this._value, this._name, this._originalSource)
}
updateHash(hash) {
hash.update(this._value);
hash.update(this._originalSource);
}
}
require("./SourceAndMapMixin")(LineToLineMappedSource.prototype);
module.exports = LineToLineMappedSource;
+89
View File
@@ -0,0 +1,89 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
var SourceNode = require("source-map").SourceNode;
var SourceMapConsumer = require("source-map").SourceMapConsumer;
var SourceListMap = require("source-list-map").SourceListMap;
var Source = require("./Source");
function isSplitter(c) {
switch(c) {
case 10: // \n
case 13: // \r
case 59: // ;
case 123: // {
case 125: // }
return true;
}
return false;
}
function _splitCode(code) {
var result = [];
var i = 0;
var j = 0;
for(; i < code.length; i++) {
if(isSplitter(code.charCodeAt(i))) {
while(isSplitter(code.charCodeAt(++i)));
result.push(code.substring(j, i));
j = i;
}
}
if(j < code.length)
result.push(code.substr(j));
return result;
}
class OriginalSource extends Source {
constructor(value, name) {
super();
this._value = value;
this._name = name;
}
source() {
return this._value;
}
node(options) {
options = options || {};
var sourceMap = this._sourceMap;
var value = this._value;
var name = this._name;
var lines = value.split("\n");
var node = new SourceNode(null, null, null,
lines.map(function(line, idx) {
var pos = 0;
if(options.columns === false) {
var content = line + (idx != lines.length - 1 ? "\n" : "");
return new SourceNode(idx + 1, 0, name, content);
}
return new SourceNode(null, null, null,
_splitCode(line + (idx != lines.length - 1 ? "\n" : "")).map(function(item) {
if(/^\s*$/.test(item)) return item;
var res = new SourceNode(idx + 1, pos, name, item);
pos += item.length;
return res;
})
);
})
);
node.setSourceContent(name, value);
return node;
}
listMap(options) {
return new SourceListMap(this._value, this._name, this._value)
}
updateHash(hash) {
hash.update(this._value);
}
}
require("./SourceAndMapMixin")(OriginalSource.prototype);
module.exports = OriginalSource;
+76
View File
@@ -0,0 +1,76 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
var Source = require("./Source");
var SourceNode = require("source-map").SourceNode;
var REPLACE_REGEX = /\n(?=.|\s)/g;
function cloneAndPrefix(node, prefix, append) {
if(typeof node === "string") {
var result = node.replace(REPLACE_REGEX, "\n" + prefix);
if(append.length > 0) result = append.pop() + result;
if(/\n$/.test(node)) append.push(prefix);
return result;
} else {
var newNode = new SourceNode(
node.line,
node.column,
node.source,
node.children.map(function(node) {
return cloneAndPrefix(node, prefix, append);
}),
node.name
);
newNode.sourceContents = node.sourceContents;
return newNode;
}
};
class PrefixSource extends Source {
constructor(prefix, source) {
super();
this._source = source;
this._prefix = prefix;
}
source() {
var node = typeof this._source === "string" ? this._source : this._source.source();
var prefix = this._prefix;
return prefix + node.replace(REPLACE_REGEX, "\n" + prefix);
}
node(options) {
var node = this._source.node(options);
var append = [this._prefix];
return new SourceNode(null, null, null, [
cloneAndPrefix(node, this._prefix, append)
]);
}
listMap(options) {
var prefix = this._prefix;
var map = this._source.listMap(options);
return map.mapGeneratedCode(function(code) {
return prefix + code.replace(REPLACE_REGEX, "\n" + prefix);
});
}
updateHash(hash) {
if(typeof this._source === "string")
hash.update(this._source);
else
this._source.updateHash(hash);
if(typeof this._prefix === "string")
hash.update(this._prefix);
else
this._prefix.updateHash(hash);
}
}
require("./SourceAndMapMixin")(PrefixSource.prototype);
module.exports = PrefixSource;
+38
View File
@@ -0,0 +1,38 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
var Source = require("./Source");
var SourceNode = require("source-map").SourceNode;
var SourceListMap = require("source-list-map").SourceListMap;
class RawSource extends Source {
constructor(value) {
super();
this._value = value;
}
source() {
return this._value;
}
map(options) {
return null;
}
node(options) {
return new SourceNode(null, null, null, this._value);
}
listMap(options) {
return new SourceListMap(this._value);
}
updateHash(hash) {
hash.update(this._value);
}
}
module.exports = RawSource;
+198
View File
@@ -0,0 +1,198 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
var Source = require("./Source");
var SourceNode = require("source-map").SourceNode;
var SourceListMap = require("source-list-map").SourceListMap;
var fromStringWithSourceMap = require("source-list-map").fromStringWithSourceMap;
var SourceMapConsumer = require("source-map").SourceMapConsumer;
class ReplaceSource extends Source {
constructor(source, name) {
super();
this._source = source;
this._name = name;
this.replacements = [];
}
replace(start, end, newValue) {
if(typeof newValue !== "string")
throw new Error("insertion must be a string, but is a " + typeof newValue);
this.replacements.push([start, end, newValue, this.replacements.length]);
}
insert(pos, newValue) {
if(typeof newValue !== "string")
throw new Error("insertion must be a string, but is a " + typeof newValue + ": " + newValue);
this.replacements.push([pos, pos - 1, newValue, this.replacements.length]);
}
source(options) {
return this._replaceString(this._source.source());
}
original() {
return this._source;
}
_sortReplacements() {
this.replacements.sort(function(a, b) {
var diff = b[1] - a[1];
if(diff !== 0)
return diff;
diff = b[0] - a[0];
if(diff !== 0)
return diff;
return b[3] - a[3];
});
}
_replaceString(str) {
if(typeof str !== "string")
throw new Error("str must be a string, but is a " + typeof str + ": " + str);
this._sortReplacements();
var result = [str];
this.replacements.forEach(function(repl) {
var remSource = result.pop();
var splitted1 = this._splitString(remSource, Math.floor(repl[1] + 1));
var splitted2 = this._splitString(splitted1[0], Math.floor(repl[0]));
result.push(splitted1[1], repl[2], splitted2[0]);
}, this);
result = result.reverse();
return result.join("");
}
node(options) {
this._sortReplacements();
var result = [this._source.node(options)];
this.replacements.forEach(function(repl) {
var remSource = result.pop();
var splitted1 = this._splitSourceNode(remSource, Math.floor(repl[1] + 1));
var splitted2;
if(Array.isArray(splitted1)) {
splitted2 = this._splitSourceNode(splitted1[0], Math.floor(repl[0]));
if(Array.isArray(splitted2)) {
result.push(splitted1[1], this._replacementToSourceNode(splitted2[1], repl[2]), splitted2[0]);
} else {
result.push(splitted1[1], this._replacementToSourceNode(splitted1[1], repl[2]), splitted1[0]);
}
} else {
splitted2 = this._splitSourceNode(remSource, Math.floor(repl[0]));
if(Array.isArray(splitted2)) {
result.push(this._replacementToSourceNode(splitted2[1], repl[2]), splitted2[0]);
} else {
result.push(repl[2], remSource);
}
}
}, this);
result = result.reverse();
return new SourceNode(null, null, null, result);
}
listMap(options) {
this._sortReplacements();
var map = this._source.listMap(options);
var currentIndex = 0;
var replacements = this.replacements;
var idxReplacement = replacements.length - 1;
var removeChars = 0;
map = map.mapGeneratedCode(function(str) {
var newCurrentIndex = currentIndex + str.length;
if(removeChars > str.length) {
removeChars -= str.length;
str = "";
} else {
if(removeChars > 0) {
str = str.substr(removeChars);
currentIndex += removeChars;
removeChars = 0;
}
var finalStr = "";
while(idxReplacement >= 0 && replacements[idxReplacement][0] < newCurrentIndex) {
var repl = replacements[idxReplacement];
var start = Math.floor(repl[0]);
var end = Math.floor(repl[1] + 1);
var before = str.substr(0, Math.max(0, start - currentIndex));
if(end <= newCurrentIndex) {
var after = str.substr(Math.max(0, end - currentIndex));
finalStr += before + repl[2];
str = after;
currentIndex = Math.max(currentIndex, end);
} else {
finalStr += before + repl[2];
str = "";
removeChars = end - newCurrentIndex;
}
idxReplacement--;
}
str = finalStr + str;
}
currentIndex = newCurrentIndex;
return str;
});
var extraCode = "";
while(idxReplacement >= 0) {
extraCode += replacements[idxReplacement][2];
idxReplacement--;
}
if(extraCode) {
map.add(extraCode);
}
return map;
}
_replacementToSourceNode(oldNode, newString) {
var map = oldNode.toStringWithSourceMap({
file: "?"
}).map;
var original = new SourceMapConsumer(map.toJSON()).originalPositionFor({
line: 1,
column: 0
});
if(original) {
return new SourceNode(original.line, original.column, original.source, newString);
} else {
return newString;
}
}
_splitSourceNode(node, position) {
if(typeof node === "string") {
if(node.length <= position) return position - node.length;
return position <= 0 ? ["", node] : [node.substr(0, position), node.substr(position)];
} else {
for(var i = 0; i < node.children.length; i++) {
position = this._splitSourceNode(node.children[i], position);
if(Array.isArray(position)) {
var leftNode = new SourceNode(
node.line,
node.column,
node.source,
node.children.slice(0, i).concat([position[0]]),
node.name
);
var rightNode = new SourceNode(
node.line,
node.column,
node.source, [position[1]].concat(node.children.slice(i + 1)),
node.name
);
leftNode.sourceContents = node.sourceContents;
return [leftNode, rightNode];
}
}
return position;
}
}
_splitString(str, position) {
return position <= 0 ? ["", str] : [str.substr(0, position), str.substr(position)];
}
}
require("./SourceAndMapMixin")(ReplaceSource.prototype);
module.exports = ReplaceSource;
+45
View File
@@ -0,0 +1,45 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
var SourceNode = require("source-map").SourceNode;
var SourceMapConsumer = require("source-map").SourceMapConsumer;
class Source {
source() {
throw new Error("Abstract");
}
size() {
return this.source().length;
}
map(options) {
return null;
}
sourceAndMap(options) {
return {
source: this.source(),
map: this.map()
};
}
node() {
throw new Error("Abstract");
}
listNode() {
throw new Error("Abstract");
}
updateHash(hash) {
var source = this.source();
hash.update(source || "");
}
}
module.exports = Source;
+38
View File
@@ -0,0 +1,38 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
module.exports = function mixinSourceAndMap(proto) {
proto.map = function(options) {
options = options || {};
if(options.columns === false) {
return this.listMap(options).toStringWithSourceMap({
file: "x"
}).map;
}
return this.node(options).toStringWithSourceMap({
file: "x"
}).map.toJSON();
};
proto.sourceAndMap = function(options) {
options = options || {};
if(options.columns === false) {
//console.log(this.listMap(options).debugInfo());
return this.listMap(options).toStringWithSourceMap({
file: "x"
});
}
var res = this.node(options).toStringWithSourceMap({
file: "x"
});
return {
source: res.code,
map: res.map.toJSON()
};
};
}
+58
View File
@@ -0,0 +1,58 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
var SourceNode = require("source-map").SourceNode;
var SourceMapConsumer = require("source-map").SourceMapConsumer;
var SourceMapGenerator = require("source-map").SourceMapGenerator;
var SourceListMap = require("source-list-map").SourceListMap;
var fromStringWithSourceMap = require("source-list-map").fromStringWithSourceMap;
var Source = require("./Source");
class SourceMapSource extends Source {
constructor(value, name, sourceMap, originalSource, innerSourceMap) {
super();
this._value = value;
this._name = name;
this._sourceMap = sourceMap;
this._originalSource = originalSource;
this._innerSourceMap = innerSourceMap;
}
source() {
return this._value;
}
node(options) {
var innerSourceMap = this._innerSourceMap;
var sourceMap = this._sourceMap;
if(innerSourceMap) {
sourceMap = SourceMapGenerator.fromSourceMap(new SourceMapConsumer(sourceMap));
if(this._originalSource)
sourceMap.setSourceContent(this._name, this._originalSource);
innerSourceMap = new SourceMapConsumer(innerSourceMap);
sourceMap.applySourceMap(innerSourceMap, this._name);
sourceMap = sourceMap.toJSON();
}
return SourceNode.fromStringWithSourceMap(this._value, new SourceMapConsumer(sourceMap));
}
listMap(options) {
options = options || {};
if(options.module === false)
return new SourceListMap(this._value, this._name, this._value);
return fromStringWithSourceMap(this._value, typeof this._sourceMap === "string" ? JSON.parse(this._sourceMap) : this._sourceMap);
}
updateHash(hash) {
hash.update(this._value);
if(this._originalSource)
hash.update(this._originalSource);
}
}
require("./SourceAndMapMixin")(SourceMapSource.prototype);
module.exports = SourceMapSource;
+15
View File
@@ -0,0 +1,15 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
exports.Source = require("./Source");
exports.RawSource = require("./RawSource");
exports.OriginalSource = require("./OriginalSource");
exports.SourceMapSource = require("./SourceMapSource");
exports.LineToLineMappedSource = require("./LineToLineMappedSource");
exports.CachedSource = require("./CachedSource");
exports.ConcatSource = require("./ConcatSource");
exports.ReplaceSource = require("./ReplaceSource");
exports.PrefixSource = require("./PrefixSource");
+91
View File
@@ -0,0 +1,91 @@
# source-list-map
## API
### Example
``` js
var SourceListMap = require("source-list-map").SourceListMap;
// Create a new map
var map = new SourceListMap();
// Add generated code that is map line to line to some soure
map.add("Generated\ncode1\n", "source-code.js", "Orginal\nsource");
// Add generated code that isn't mapped
map.add("Generated\ncode2\n");
// Get SourceMap and generated source
map.toStringWithSourceMap({ file: "generated-code.js" });
// {
// source: 'Generated\ncode1\nGenerated\ncode2\n',
// map: {
// version: 3,
// file: 'generated-code.js',
// sources: [ 'source-code.js' ],
// sourcesContent: [ 'Orginal\nsource' ],
// mappings: 'AAAA;AACA;;;'
// }
// }
// Convert existing SourceMap into SourceListMap
// (Only the first mapping per line is preserved)
var fromStringWithSourceMap = require("source-list-map").fromStringWithSourceMap;
var map = fromStringWithSourceMap("Generated\ncode", { version: 3, ... });
```
### `new SourceListMap()`
### `SourceListMap.prototype.add`
``` js
SourceListMap.prototype.add(generatedCode: string)
SourceListMap.prototype.add(generatedCode: string, source: string, originalSource: string)
SourceListMap.prototype.add(sourceListMap: SourceListMap)
```
Append some stuff.
### `SourceListMap.prototype.prepend`
``` js
SourceListMap.prototype.prepend(generatedCode: string)
SourceListMap.prototype.prepend(generatedCode: string, source: string, originalSource: string)
SourceListMap.prototype.prepend(sourceListMap: SourceListMap)
```
Prepend some stuff.
### `SourceListMap.prototype.toString()`
Get generated code.
### `SourceListMap.prototype.toStringWithSourceMap`
``` js
SourceListMap.prototype.toStringWithSourceMap(options: object)
```
Get generated code and SourceMap. `options` can contains `file` property which defines the `file` property of the SourceMap.
### `SourceListMap.prototype.mapGeneratedCode`
``` js
SourceListMap.prototype.mapGeneratedCode(fn: function) : SourceListMap
```
Applies `fn` to each generated code block (per line). The returned value is set as new generated code. Returns a new SourceListMap.
Removing and adding lines is supported. The SourceMap complexity will increase when doing this.
## Test
[![Build Status](https://travis-ci.org/webpack/source-list-map.svg)](https://travis-ci.org/webpack/source-list-map)
## License
Copyright (c) 2017 JS Foundation
MIT (http://www.opensource.org/licenses/mit-license.php)
@@ -0,0 +1,66 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const getNumberOfLines = require("./helpers").getNumberOfLines;
const getUnfinishedLine = require("./helpers").getUnfinishedLine;
class CodeNode {
constructor(generatedCode) {
this.generatedCode = generatedCode;
}
clone() {
return new CodeNode(this.generatedCode);
}
getGeneratedCode() {
return this.generatedCode;
}
getMappings(mappingsContext) {
const lines = getNumberOfLines(this.generatedCode);
const mapping = Array(lines+1).join(";");
if(lines > 0) {
mappingsContext.unfinishedGeneratedLine = getUnfinishedLine(this.generatedCode);
if(mappingsContext.unfinishedGeneratedLine > 0) {
return mapping + "A";
} else {
return mapping;
}
} else {
const prevUnfinished = mappingsContext.unfinishedGeneratedLine;
mappingsContext.unfinishedGeneratedLine += getUnfinishedLine(this.generatedCode);
if(prevUnfinished === 0 && mappingsContext.unfinishedGeneratedLine > 0) {
return "A";
} else {
return "";
}
}
}
addGeneratedCode(generatedCode) {
this.generatedCode += generatedCode;
}
mapGeneratedCode(fn) {
const generatedCode = fn(this.generatedCode);
return new CodeNode(generatedCode);
}
getNormalizedNodes() {
return [this];
}
merge(otherNode) {
if(otherNode instanceof CodeNode) {
this.generatedCode += otherNode.generatedCode;
return this;
}
return false;
}
}
module.exports = CodeNode;
@@ -0,0 +1,45 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
class MappingsContext {
constructor() {
this.sourcesIndices = new Map();
this.sourcesContent = new Map();
this.hasSourceContent = false;
this.currentOriginalLine = 1;
this.currentSource = 0;
this.unfinishedGeneratedLine = false;
}
ensureSource(source, originalSource) {
let idx = this.sourcesIndices.get(source);
if(typeof idx === "number") {
return idx;
}
idx = this.sourcesIndices.size;
this.sourcesIndices.set(source, idx);
this.sourcesContent.set(source, originalSource)
if(typeof originalSource === "string")
this.hasSourceContent = true;
return idx;
}
getArrays() {
const sources = [];
const sourcesContent = [];
for(const pair of this.sourcesContent) {
sources.push(pair[0]);
sourcesContent.push(pair[1]);
}
return {
sources,
sourcesContent
};
}
}
module.exports = MappingsContext;
@@ -0,0 +1,93 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const base64VLQ = require("./base64-vlq");
const getNumberOfLines = require("./helpers").getNumberOfLines;
const getUnfinishedLine = require("./helpers").getUnfinishedLine;
const LINE_MAPPING = ";AAAA";
class SingleLineNode {
constructor(generatedCode, source, originalSource, line) {
this.generatedCode = generatedCode;
this.originalSource = originalSource;
this.source = source;
this.line = line || 1;
this._numberOfLines = getNumberOfLines(this.generatedCode);
this._endsWithNewLine = generatedCode[generatedCode.length - 1] === "\n";
}
clone() {
return new SingleLineNode(this.generatedCode, this.source, this.originalSource, this.line);
}
getGeneratedCode() {
return this.generatedCode;
}
getMappings(mappingsContext) {
if(!this.generatedCode)
return "";
const lines = this._numberOfLines;
const sourceIdx = mappingsContext.ensureSource(this.source, this.originalSource);
let mappings = "A"; // generated column 0
if(mappingsContext.unfinishedGeneratedLine)
mappings = "," + base64VLQ.encode(mappingsContext.unfinishedGeneratedLine);
mappings += base64VLQ.encode(sourceIdx - mappingsContext.currentSource); // source index
mappings += base64VLQ.encode(this.line - mappingsContext.currentOriginalLine); // original line index
mappings += "A"; // original column 0
mappingsContext.currentSource = sourceIdx;
mappingsContext.currentOriginalLine = this.line;
const unfinishedGeneratedLine = mappingsContext.unfinishedGeneratedLine = getUnfinishedLine(this.generatedCode)
mappings += Array(lines).join(LINE_MAPPING);
if(unfinishedGeneratedLine === 0) {
mappings += ";";
} else {
if(lines !== 0)
mappings += LINE_MAPPING;
}
return mappings;
}
getNormalizedNodes() {
return [this];
}
mapGeneratedCode(fn) {
const generatedCode = fn(this.generatedCode);
return new SingleLineNode(generatedCode, this.source, this.originalSource, this.line);
}
merge(otherNode) {
if(otherNode instanceof SingleLineNode) {
return this.mergeSingleLineNode(otherNode);
}
return false;
}
mergeSingleLineNode(otherNode) {
if(this.source === otherNode.source &&
this.originalSource === otherNode.originalSource) {
if(this.line === otherNode.line) {
this.generatedCode += otherNode.generatedCode;
this._numberOfLines += otherNode._numberOfLines;
this._endsWithNewLine = otherNode._endsWithNewLine;
return this;
} else if(this.line + 1 === otherNode.line &&
this._endsWithNewLine &&
this._numberOfLines === 1 &&
otherNode._numberOfLines <= 1) {
return new SourceNode(this.generatedCode + otherNode.generatedCode, this.source, this.originalSource, this.line);
}
}
return false;
}
}
module.exports = SingleLineNode;
const SourceNode = require("./SourceNode"); // circular dependency
@@ -0,0 +1,117 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const CodeNode = require("./CodeNode");
const SourceNode = require("./SourceNode");
const MappingsContext = require("./MappingsContext");
const getNumberOfLines = require("./helpers").getNumberOfLines;
class SourceListMap {
constructor(generatedCode, source, originalSource) {
if(Array.isArray(generatedCode)) {
this.children = generatedCode;
} else {
this.children = [];
if(generatedCode || source)
this.add(generatedCode, source, originalSource);
}
}
add(generatedCode, source, originalSource) {
if(typeof generatedCode === "string") {
if(source) {
this.children.push(new SourceNode(generatedCode, source, originalSource));
} else if(this.children.length > 0 && this.children[this.children.length - 1] instanceof CodeNode) {
this.children[this.children.length - 1].addGeneratedCode(generatedCode);
} else {
this.children.push(new CodeNode(generatedCode));
}
} else if(generatedCode.getMappings && generatedCode.getGeneratedCode) {
this.children.push(generatedCode);
} else if(generatedCode.children) {
generatedCode.children.forEach(function(sln) {
this.children.push(sln);
}, this);
} else {
throw new Error("Invalid arguments to SourceListMap.protfotype.add: Expected string, Node or SourceListMap");
}
};
preprend(generatedCode, source, originalSource) {
if(typeof generatedCode === "string") {
if(source) {
this.children.unshift(new SourceNode(generatedCode, source, originalSource));
} else if(this.children.length > 0 && this.children[this.children.length - 1].preprendGeneratedCode) {
this.children[this.children.length - 1].preprendGeneratedCode(generatedCode);
} else {
this.children.unshift(new CodeNode(generatedCode));
}
} else if(generatedCode.getMappings && generatedCode.getGeneratedCode) {
this.children.unshift(generatedCode);
} else if(generatedCode.children) {
generatedCode.children.slice().reverse().forEach(function(sln) {
this.children.unshift(sln);
}, this);
} else {
throw new Error("Invalid arguments to SourceListMap.protfotype.prerend: Expected string, Node or SourceListMap");
}
};
mapGeneratedCode(fn) {
const normalizedNodes = [];
this.children.forEach(function(sln) {
sln.getNormalizedNodes().forEach(function(newNode) {
normalizedNodes.push(newNode);
});
});
const optimizedNodes = [];
normalizedNodes.forEach(function(sln) {
sln = sln.mapGeneratedCode(fn);
if(optimizedNodes.length === 0) {
optimizedNodes.push(sln);
} else {
const last = optimizedNodes[optimizedNodes.length - 1];
const mergedNode = last.merge(sln);
if(mergedNode) {
optimizedNodes[optimizedNodes.length - 1] = mergedNode;
} else {
optimizedNodes.push(sln);
}
}
});
return new SourceListMap(optimizedNodes);
};
toString() {
return this.children.map(function(sln) {
return sln.getGeneratedCode();
}).join("");
};
toStringWithSourceMap(options) {
const mappingsContext = new MappingsContext();
const source = this.children.map(function(sln) {
return sln.getGeneratedCode();
}).join("");
const mappings = this.children.map(function(sln) {
return sln.getMappings(mappingsContext);
}).join("");
const arrays = mappingsContext.getArrays();
return {
source: source,
map: {
version: 3,
file: options && options.file,
sources: arrays.sources,
sourcesContent: mappingsContext.hasSourceContent ? arrays.sourcesContent : undefined,
mappings: mappings
}
};
}
}
module.exports = SourceListMap;
@@ -0,0 +1,129 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const base64VLQ = require("./base64-vlq");
const getNumberOfLines = require("./helpers").getNumberOfLines;
const getUnfinishedLine = require("./helpers").getUnfinishedLine;
const LINE_MAPPING = ";AACA";
class SourceNode {
constructor(generatedCode, source, originalSource, startingLine) {
this.generatedCode = generatedCode;
this.originalSource = originalSource;
this.source = source;
this.startingLine = startingLine || 1;
this._numberOfLines = getNumberOfLines(this.generatedCode);
this._endsWithNewLine = generatedCode[generatedCode.length - 1] === "\n";
}
clone() {
return new SourceNode(this.generatedCode, this.source, this.originalSource, this.startingLine);
}
getGeneratedCode() {
return this.generatedCode;
}
addGeneratedCode(code) {
this.generatedCode += code;
this._numberOfLines += getNumberOfLines(code);
this._endsWithNewLine = code[code.length - 1] === "\n";
}
getMappings(mappingsContext) {
if(!this.generatedCode)
return "";
const lines = this._numberOfLines;
const sourceIdx = mappingsContext.ensureSource(this.source, this.originalSource);
let mappings = "A"; // generated column 0
if(mappingsContext.unfinishedGeneratedLine)
mappings = "," + base64VLQ.encode(mappingsContext.unfinishedGeneratedLine);
mappings += base64VLQ.encode(sourceIdx - mappingsContext.currentSource); // source index
mappings += base64VLQ.encode(this.startingLine - mappingsContext.currentOriginalLine); // original line index
mappings += "A"; // original column 0
mappingsContext.currentSource = sourceIdx;
mappingsContext.currentOriginalLine = this.startingLine + lines - 1;
const unfinishedGeneratedLine = mappingsContext.unfinishedGeneratedLine = getUnfinishedLine(this.generatedCode)
mappings += Array(lines).join(LINE_MAPPING);
if(unfinishedGeneratedLine === 0) {
mappings += ";";
} else {
if(lines !== 0) {
mappings += LINE_MAPPING;
}
mappingsContext.currentOriginalLine++;
}
return mappings;
}
mapGeneratedCode(fn) {
throw new Error("Cannot map generated code on a SourceMap. Normalize to SingleLineNode first.");
}
getNormalizedNodes() {
var results = [];
var currentLine = this.startingLine;
var generatedCode = this.generatedCode;
var index = 0;
var indexEnd = generatedCode.length;
while(index < indexEnd) {
// get one generated line
var nextLine = generatedCode.indexOf("\n", index) + 1;
if(nextLine === 0) nextLine = indexEnd;
var lineGenerated = generatedCode.substr(index, nextLine - index);
results.push(new SingleLineNode(lineGenerated, this.source, this.originalSource, currentLine));
// move cursors
index = nextLine;
currentLine++;
}
return results;
}
merge(otherNode) {
if(otherNode instanceof SourceNode) {
return this.mergeSourceNode(otherNode);
} else if(otherNode instanceof SingleLineNode) {
return this.mergeSingleLineNode(otherNode);
}
return false;
}
mergeSourceNode(otherNode) {
if(this.source === otherNode.source &&
this._endsWithNewLine &&
this.startingLine + this._numberOfLines === otherNode.startingLine) {
this.generatedCode += otherNode.generatedCode;
this._numberOfLines += otherNode._numberOfLines;
this._endsWithNewLine = otherNode._endsWithNewLine;
return this;
}
return false;
}
mergeSingleLineNode(otherNode) {
if(this.source === otherNode.source &&
this._endsWithNewLine &&
this.startingLine + this._numberOfLines === otherNode.line &&
otherNode._numberOfLines <= 1) {
this.addSingleLineNode(otherNode);
return this;
}
return false;
}
addSingleLineNode(otherNode) {
this.generatedCode += otherNode.generatedCode;
this._numberOfLines += otherNode._numberOfLines
this._endsWithNewLine = otherNode._endsWithNewLine;
}
}
module.exports = SourceNode;
const SingleLineNode = require("./SingleLineNode"); // circular dependency
@@ -0,0 +1,169 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*
* Based on the Base 64 VLQ implementation in Closure Compiler:
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
*
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*eslint no-bitwise:0,quotes:0,global-strict:0*/
var charToIntMap = {};
var intToCharMap = {};
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
.split('')
.forEach(function (ch, index) {
charToIntMap[ch] = index;
intToCharMap[index] = ch;
});
var base64 = {};
/**
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
*/
base64.encode = function base64_encode(aNumber) {
if (aNumber in intToCharMap) {
return intToCharMap[aNumber];
}
throw new TypeError("Must be between 0 and 63: " + aNumber);
};
/**
* Decode a single base 64 digit to an integer.
*/
base64.decode = function base64_decode(aChar) {
if (aChar in charToIntMap) {
return charToIntMap[aChar];
}
throw new TypeError("Not a valid base 64 digit: " + aChar);
};
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
// length quantities we use in the source map spec, the first bit is the sign,
// the next four bits are the actual value, and the 6th bit is the
// continuation bit. The continuation bit tells us whether there are more
// digits in this value following this digit.
//
// Continuation
// | Sign
// | |
// V V
// 101011
var VLQ_BASE_SHIFT = 5;
// binary: 100000
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
// binary: 011111
var VLQ_BASE_MASK = VLQ_BASE - 1;
// binary: 100000
var VLQ_CONTINUATION_BIT = VLQ_BASE;
/**
* Converts from a two-complement value to a value where the sign bit is
* placed in the least significant bit. For example, as decimals:
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
*/
function toVLQSigned(aValue) {
return aValue < 0
? ((-aValue) << 1) + 1
: (aValue << 1) + 0;
}
/**
* Converts to a two-complement value from a value where the sign bit is
* placed in the least significant bit. For example, as decimals:
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
*/
function fromVLQSigned(aValue) {
var isNegative = (aValue & 1) === 1;
var shifted = aValue >> 1;
return isNegative
? -shifted
: shifted;
}
/**
* Returns the base 64 VLQ encoded value.
*/
exports.encode = function base64VLQ_encode(aValue) {
var encoded = "";
var digit;
var vlq = toVLQSigned(aValue);
do {
digit = vlq & VLQ_BASE_MASK;
vlq >>>= VLQ_BASE_SHIFT;
if (vlq > 0) {
// There are still more digits in this value, so we must make sure the
// continuation bit is marked.
digit |= VLQ_CONTINUATION_BIT;
}
encoded += base64.encode(digit);
} while (vlq > 0);
return encoded;
};
/**
* Decodes the next base 64 VLQ value from the given string and returns the
* value and the rest of the string via the out parameter.
*/
exports.decode = function base64VLQ_decode(aStr, aOutParam) {
var i = 0;
var strLen = aStr.length;
var result = 0;
var shift = 0;
var continuation, digit;
do {
if (i >= strLen) {
throw new Error("Expected more digits in base 64 VLQ value.");
}
digit = base64.decode(aStr.charAt(i++));
continuation = !!(digit & VLQ_CONTINUATION_BIT);
digit &= VLQ_BASE_MASK;
result = result + (digit << shift);
shift += VLQ_BASE_SHIFT;
} while (continuation);
aOutParam.value = fromVLQSigned(result);
aOutParam.rest = aStr.slice(i);
};
@@ -0,0 +1,102 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const base64VLQ = require("./base64-vlq");
const SourceNode = require("./SourceNode");
const CodeNode = require("./CodeNode");
const SourceListMap = require("./SourceListMap");
module.exports = function fromStringWithSourceMap(code, map) {
const sources = map.sources;
const sourcesContent = map.sourcesContent;
const mappings = map.mappings.split(";");
const lines = code.split("\n");
const nodes = [];
let currentNode = null;
let currentLine = 1;
let currentSourceIdx = 0;
let currentSourceNodeLine;
mappings.forEach(function(mapping, idx) {
let line = lines[idx];
if(typeof line === 'undefined') return;
if(idx !== lines.length - 1) line += "\n";
if(!mapping)
return addCode(line);
mapping = { value: 0, rest: mapping };
let lineAdded = false;
while(mapping.rest)
lineAdded = processMapping(mapping, line, lineAdded) || lineAdded;
if(!lineAdded)
addCode(line);
});
if(mappings.length < lines.length) {
let idx = mappings.length;
while(!lines[idx].trim() && idx < lines.length-1) {
addCode(lines[idx] + "\n");
idx++;
}
addCode(lines.slice(idx).join("\n"));
}
return new SourceListMap(nodes);
function processMapping(mapping, line, ignore) {
if(mapping.rest && mapping.rest[0] !== ",") {
base64VLQ.decode(mapping.rest, mapping);
}
if(!mapping.rest)
return false;
if(mapping.rest[0] === ",") {
mapping.rest = mapping.rest.substr(1);
return false;
}
base64VLQ.decode(mapping.rest, mapping);
const sourceIdx = mapping.value + currentSourceIdx;
currentSourceIdx = sourceIdx;
let linePosition;
if(mapping.rest && mapping.rest[0] !== ",") {
base64VLQ.decode(mapping.rest, mapping);
linePosition = mapping.value + currentLine;
currentLine = linePosition;
} else {
linePosition = currentLine;
}
if(mapping.rest) {
const next = mapping.rest.indexOf(",");
mapping.rest = next === -1 ? "" : mapping.rest.substr(next);
}
if(!ignore) {
addSource(line, sources ? sources[sourceIdx] : null, sourcesContent ? sourcesContent[sourceIdx] : null, linePosition)
return true;
}
}
function addCode(generatedCode) {
if(currentNode && currentNode instanceof CodeNode) {
currentNode.addGeneratedCode(generatedCode);
} else if(currentNode && currentNode instanceof SourceNode && !generatedCode.trim()) {
currentNode.addGeneratedCode(generatedCode);
currentSourceNodeLine++;
} else {
currentNode = new CodeNode(generatedCode);
nodes.push(currentNode);
}
}
function addSource(generatedCode, source, originalSource, linePosition) {
if(currentNode && currentNode instanceof SourceNode &&
currentNode.source === source &&
currentSourceNodeLine === linePosition
) {
currentNode.addGeneratedCode(generatedCode);
currentSourceNodeLine++;
} else {
currentNode = new SourceNode(generatedCode, source, originalSource, linePosition);
currentSourceNodeLine = linePosition + 1;
nodes.push(currentNode);
}
}
};
@@ -0,0 +1,23 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
exports.getNumberOfLines = function getNumberOfLines(str) {
let nr = -1;
let idx = -1;
do {
nr++
idx = str.indexOf("\n", idx + 1);
} while(idx >= 0);
return nr;
};
exports.getUnfinishedLine = function getUnfinishedLine(str) {
const idx = str.lastIndexOf("\n");
if(idx === -1)
return str.length;
else
return str.length - idx - 1;
};
@@ -0,0 +1,6 @@
exports.SourceListMap = require("./SourceListMap");
exports.SourceNode = require("./SourceNode");
exports.SingleLineNode = require("./SingleLineNode");
exports.CodeNode = require("./CodeNode");
exports.MappingsContext = require("./MappingsContext");
exports.fromStringWithSourceMap = require("./fromStringWithSourceMap");
+93
View File
@@ -0,0 +1,93 @@
{
"_args": [
[
{
"raw": "source-list-map@^2.0.0",
"scope": null,
"escapedName": "source-list-map",
"name": "source-list-map",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"c:\\xampp\\htdocs\\laravel\\node_modules\\webpack-sources"
]
],
"_from": "source-list-map@>=2.0.0 <3.0.0",
"_id": "source-list-map@2.0.0",
"_inCache": true,
"_location": "/webpack-sources/source-list-map",
"_nodeVersion": "8.0.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/source-list-map-2.0.0.tgz_1496490051594_0.6906744700390846"
},
"_npmUser": {
"name": "sokra",
"email": "tobias.koppers@googlemail.com"
},
"_npmVersion": "5.0.0",
"_phantomChildren": {},
"_requested": {
"raw": "source-list-map@^2.0.0",
"scope": null,
"escapedName": "source-list-map",
"name": "source-list-map",
"rawSpec": "^2.0.0",
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/webpack-sources"
],
"_resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz",
"_shasum": "aaa47403f7b245a92fbc97ea08f250d6087ed085",
"_shrinkwrap": null,
"_spec": "source-list-map@^2.0.0",
"_where": "c:\\xampp\\htdocs\\laravel\\node_modules\\webpack-sources",
"author": {
"name": "Tobias Koppers @sokra"
},
"bugs": {
"url": "https://github.com/webpack/source-list-map/issues"
},
"dependencies": {},
"description": "Fast line to line SourceMap generator.",
"devDependencies": {
"mocha": "^2.2.1",
"should": "^5.2.0"
},
"directories": {},
"dist": {
"integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==",
"shasum": "aaa47403f7b245a92fbc97ea08f250d6087ed085",
"tarball": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz"
},
"files": [
"lib"
],
"gitHead": "572d5107c710b590bbbf358401dff9bae8adcc1c",
"homepage": "https://github.com/webpack/source-list-map",
"keywords": [
"source-map"
],
"license": "MIT",
"main": "lib/index.js",
"maintainers": [
{
"name": "sokra",
"email": "tobias.koppers@googlemail.com"
}
],
"name": "source-list-map",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/webpack/source-list-map.git"
},
"scripts": {
"test": "mocha -R spec"
},
"version": "2.0.0"
}
+128
View File
@@ -0,0 +1,128 @@
{
"_args": [
[
{
"raw": "webpack-sources@^1.0.1",
"scope": null,
"escapedName": "webpack-sources",
"name": "webpack-sources",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"c:\\xampp\\htdocs\\laravel\\node_modules\\extract-text-webpack-plugin"
]
],
"_from": "webpack-sources@>=1.0.1 <2.0.0",
"_id": "webpack-sources@1.0.1",
"_inCache": true,
"_location": "/webpack-sources",
"_nodeVersion": "8.0.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/webpack-sources-1.0.1.tgz_1496500323403_0.9926682878285646"
},
"_npmUser": {
"name": "sokra",
"email": "tobias.koppers@googlemail.com"
},
"_npmVersion": "5.0.0",
"_phantomChildren": {},
"_requested": {
"raw": "webpack-sources@^1.0.1",
"scope": null,
"escapedName": "webpack-sources",
"name": "webpack-sources",
"rawSpec": "^1.0.1",
"spec": ">=1.0.1 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/extract-text-webpack-plugin"
],
"_resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.1.tgz",
"_shasum": "c7356436a4d13123be2e2426a05d1dad9cbe65cf",
"_shrinkwrap": null,
"_spec": "webpack-sources@^1.0.1",
"_where": "c:\\xampp\\htdocs\\laravel\\node_modules\\extract-text-webpack-plugin",
"author": {
"name": "Tobias Koppers @sokra"
},
"bugs": {
"url": "https://github.com/webpack/webpack-sources/issues"
},
"dependencies": {
"source-list-map": "^2.0.0",
"source-map": "~0.5.3"
},
"description": "Source code handling classes for webpack",
"devDependencies": {
"beautify-lint": "^1.0.3",
"codecov.io": "^0.1.6",
"coveralls": "^2.11.6",
"eslint": "^3.19.0",
"eslint-plugin-nodeca": "^1.0.3",
"istanbul": "^0.4.1",
"js-beautify": "^1.5.10",
"mocha": "^3.4.2",
"should": "^11.2.1"
},
"directories": {},
"dist": {
"integrity": "sha512-05tMxipUCwHqYaVS8xc7sYPTly8PzXayRCB4dTxLhWTqlKUiwH6ezmEe0OSreL1c30LAuA3Zqmc+uEBUGFJDjw==",
"shasum": "c7356436a4d13123be2e2426a05d1dad9cbe65cf",
"tarball": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.1.tgz"
},
"files": [
"lib/"
],
"gitHead": "5cadaf4ab143a32cf994365db4b2ddacd0ab0eb9",
"homepage": "https://github.com/webpack/webpack-sources#readme",
"keywords": [
"webpack",
"source-map"
],
"license": "MIT",
"main": "./lib/index.js",
"maintainers": [
{
"name": "bebraw",
"email": "bebraw@gmail.com"
},
{
"name": "jhnns",
"email": "mail@johannesewald.de"
},
{
"name": "sokra",
"email": "tobias.koppers@googlemail.com"
},
{
"name": "spacek33z",
"email": "kees@webduck.nl"
},
{
"name": "thelarkinn",
"email": "sean.larkin@cuw.edu"
}
],
"name": "webpack-sources",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/webpack/webpack-sources.git"
},
"scripts": {
"beautify": "beautify-rewrite lib/**.js test/**.js",
"beautify-lint": "beautify-lint lib/**.js test/**.js",
"cover": "istanbul cover node_modules/mocha/bin/_mocha",
"lint": "eslint lib test",
"precover": "npm run lint && npm run beautify-lint",
"pretest": "npm run lint && npm run beautify-lint",
"publish-patch": "npm test && npm version patch && git push && git push --tags && npm publish",
"test": "mocha --full-trace --check-leaks",
"travis": "npm run cover -- --report lcovonly"
},
"version": "1.0.1"
}