aboutsummaryrefslogtreecommitdiff
path: root/node_modules/source-list-map/lib/SingleLineNode.js
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:43:05 +0800
committerruki <waruqi@gmail.com>2018-11-07 22:18:30 +0800
commit89e95b3f143682ed9a006991bacf45c9dcba4818 (patch)
tree4f44cf41b828577d583890bdd5a1c31e8491a6ba /node_modules/source-list-map/lib/SingleLineNode.js
parentaa7f0199255277949790b41c56e8ec97dd4f0da4 (diff)
downloadxmake-docs-89e95b3f143682ed9a006991bacf45c9dcba4818.tar.gz
xmake-docs-89e95b3f143682ed9a006991bacf45c9dcba4818.zip
remove node_modulesvuepress
Diffstat (limited to 'node_modules/source-list-map/lib/SingleLineNode.js')
-rw-r--r--node_modules/source-list-map/lib/SingleLineNode.js93
1 files changed, 0 insertions, 93 deletions
diff --git a/node_modules/source-list-map/lib/SingleLineNode.js b/node_modules/source-list-map/lib/SingleLineNode.js
deleted file mode 100644
index bbc1b5db..00000000
--- a/node_modules/source-list-map/lib/SingleLineNode.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- 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