progress on migrating to heex templates and font-icons
This commit is contained in:
parent
d43daafdb7
commit
3eff955672
21793 changed files with 2161968 additions and 16895 deletions
assets_old/node_modules/source-list-map
7
assets_old/node_modules/source-list-map/LICENSE
generated
vendored
Normal file
7
assets_old/node_modules/source-list-map/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
Copyright 2017 JS Foundation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
91
assets_old/node_modules/source-list-map/README.md
generated
vendored
Normal file
91
assets_old/node_modules/source-list-map/README.md
generated
vendored
Normal 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
|
||||
|
||||
[](https://travis-ci.org/webpack/source-list-map)
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2017 JS Foundation
|
||||
|
||||
MIT (http://www.opensource.org/licenses/mit-license.php)
|
66
assets_old/node_modules/source-list-map/lib/CodeNode.js
generated
vendored
Normal file
66
assets_old/node_modules/source-list-map/lib/CodeNode.js
generated
vendored
Normal file
|
@ -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;
|
45
assets_old/node_modules/source-list-map/lib/MappingsContext.js
generated
vendored
Normal file
45
assets_old/node_modules/source-list-map/lib/MappingsContext.js
generated
vendored
Normal file
|
@ -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;
|
93
assets_old/node_modules/source-list-map/lib/SingleLineNode.js
generated
vendored
Normal file
93
assets_old/node_modules/source-list-map/lib/SingleLineNode.js
generated
vendored
Normal file
|
@ -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
|
117
assets_old/node_modules/source-list-map/lib/SourceListMap.js
generated
vendored
Normal file
117
assets_old/node_modules/source-list-map/lib/SourceListMap.js
generated
vendored
Normal file
|
@ -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,
|
||||
map: {
|
||||
version: 3,
|
||||
file: options && options.file,
|
||||
sources: arrays.sources,
|
||||
sourcesContent: mappingsContext.hasSourceContent ? arrays.sourcesContent : undefined,
|
||||
mappings: mappings
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SourceListMap;
|
129
assets_old/node_modules/source-list-map/lib/SourceNode.js
generated
vendored
Normal file
129
assets_old/node_modules/source-list-map/lib/SourceNode.js
generated
vendored
Normal file
|
@ -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
|
169
assets_old/node_modules/source-list-map/lib/base64-vlq.js
generated
vendored
Normal file
169
assets_old/node_modules/source-list-map/lib/base64-vlq.js
generated
vendored
Normal file
|
@ -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);
|
||||
};
|
102
assets_old/node_modules/source-list-map/lib/fromStringWithSourceMap.js
generated
vendored
Normal file
102
assets_old/node_modules/source-list-map/lib/fromStringWithSourceMap.js
generated
vendored
Normal file
|
@ -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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
};
|
23
assets_old/node_modules/source-list-map/lib/helpers.js
generated
vendored
Normal file
23
assets_old/node_modules/source-list-map/lib/helpers.js
generated
vendored
Normal file
|
@ -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;
|
||||
};
|
6
assets_old/node_modules/source-list-map/lib/index.js
generated
vendored
Normal file
6
assets_old/node_modules/source-list-map/lib/index.js
generated
vendored
Normal file
|
@ -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");
|
29
assets_old/node_modules/source-list-map/package.json
generated
vendored
Normal file
29
assets_old/node_modules/source-list-map/package.json
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "source-list-map",
|
||||
"version": "2.0.1",
|
||||
"description": "Fast line to line SourceMap generator.",
|
||||
"author": "Tobias Koppers @sokra",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"test": "mocha -R spec"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webpack/source-list-map.git"
|
||||
},
|
||||
"keywords": [
|
||||
"source-map"
|
||||
],
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/webpack/source-list-map/issues"
|
||||
},
|
||||
"homepage": "https://github.com/webpack/source-list-map",
|
||||
"devDependencies": {
|
||||
"mocha": "^2.2.1",
|
||||
"should": "^5.2.0"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue