mirror of
https://github.com/Azure/setup-helm.git
synced 2025-10-25 20:16:31 +00:00
committed by
GitHub
parent
20d2b4f98d
commit
e4f3964f67
125
node_modules/@babel/generator/lib/buffer.js
generated
vendored
125
node_modules/@babel/generator/lib/buffer.js
generated
vendored
@@ -4,6 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function SourcePos() {
|
||||
return {
|
||||
identifierName: undefined,
|
||||
line: undefined,
|
||||
column: undefined,
|
||||
filename: undefined
|
||||
};
|
||||
}
|
||||
|
||||
const SPACES_RE = /^[ \t]+$/;
|
||||
|
||||
class Buffer {
|
||||
@@ -16,12 +26,7 @@ class Buffer {
|
||||
line: 1,
|
||||
column: 0
|
||||
};
|
||||
this._sourcePosition = {
|
||||
identifierName: null,
|
||||
line: null,
|
||||
column: null,
|
||||
filename: null
|
||||
};
|
||||
this._sourcePosition = SourcePos();
|
||||
this._disallowedPop = null;
|
||||
this._map = map;
|
||||
}
|
||||
@@ -32,29 +37,35 @@ class Buffer {
|
||||
const map = this._map;
|
||||
const result = {
|
||||
code: this._buf.trimRight(),
|
||||
map: null,
|
||||
rawMappings: map == null ? void 0 : map.getRawMappings()
|
||||
decodedMap: map == null ? void 0 : map.getDecoded(),
|
||||
|
||||
get map() {
|
||||
const resultMap = map ? map.get() : null;
|
||||
result.map = resultMap;
|
||||
return resultMap;
|
||||
},
|
||||
|
||||
set map(value) {
|
||||
Object.defineProperty(result, "map", {
|
||||
value,
|
||||
writable: true
|
||||
});
|
||||
},
|
||||
|
||||
get rawMappings() {
|
||||
const mappings = map == null ? void 0 : map.getRawMappings();
|
||||
result.rawMappings = mappings;
|
||||
return mappings;
|
||||
},
|
||||
|
||||
set rawMappings(value) {
|
||||
Object.defineProperty(result, "rawMappings", {
|
||||
value,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if (map) {
|
||||
Object.defineProperty(result, "map", {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
|
||||
get() {
|
||||
return this.map = map.get();
|
||||
},
|
||||
|
||||
set(value) {
|
||||
Object.defineProperty(this, "map", {
|
||||
value,
|
||||
writable: true
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -65,11 +76,10 @@ class Buffer {
|
||||
line,
|
||||
column,
|
||||
filename,
|
||||
identifierName,
|
||||
force
|
||||
identifierName
|
||||
} = this._sourcePosition;
|
||||
|
||||
this._append(str, line, column, identifierName, filename, force);
|
||||
this._append(str, line, column, identifierName, filename);
|
||||
}
|
||||
|
||||
queue(str) {
|
||||
@@ -83,11 +93,14 @@ class Buffer {
|
||||
line,
|
||||
column,
|
||||
filename,
|
||||
identifierName,
|
||||
force
|
||||
identifierName
|
||||
} = this._sourcePosition;
|
||||
|
||||
this._queue.unshift([str, line, column, identifierName, filename, force]);
|
||||
this._queue.unshift([str, line, column, identifierName, filename]);
|
||||
}
|
||||
|
||||
queueIndentation(str) {
|
||||
this._queue.unshift([str, undefined, undefined, undefined, undefined]);
|
||||
}
|
||||
|
||||
_flush() {
|
||||
@@ -98,14 +111,14 @@ class Buffer {
|
||||
}
|
||||
}
|
||||
|
||||
_append(str, line, column, identifierName, filename, force) {
|
||||
_append(str, line, column, identifierName, filename) {
|
||||
this._buf += str;
|
||||
this._last = str.charCodeAt(str.length - 1);
|
||||
let i = str.indexOf("\n");
|
||||
let last = 0;
|
||||
|
||||
if (i !== 0) {
|
||||
this._mark(line, column, identifierName, filename, force);
|
||||
this._mark(line, column, identifierName, filename);
|
||||
}
|
||||
|
||||
while (i !== -1) {
|
||||
@@ -114,7 +127,7 @@ class Buffer {
|
||||
last = i + 1;
|
||||
|
||||
if (last < str.length) {
|
||||
this._mark(++line, 0, identifierName, filename, force);
|
||||
this._mark(++line, 0, identifierName, filename);
|
||||
}
|
||||
|
||||
i = str.indexOf("\n", last);
|
||||
@@ -123,10 +136,10 @@ class Buffer {
|
||||
this._position.column += str.length - last;
|
||||
}
|
||||
|
||||
_mark(line, column, identifierName, filename, force) {
|
||||
_mark(line, column, identifierName, filename) {
|
||||
var _this$_map;
|
||||
|
||||
(_this$_map = this._map) == null ? void 0 : _this$_map.mark(this._position.line, this._position.column, line, column, identifierName, filename, force);
|
||||
(_this$_map = this._map) == null ? void 0 : _this$_map.mark(this._position, line, column, identifierName, filename);
|
||||
}
|
||||
|
||||
removeTrailingNewline() {
|
||||
@@ -176,17 +189,17 @@ class Buffer {
|
||||
}
|
||||
|
||||
exactSource(loc, cb) {
|
||||
this.source("start", loc, true);
|
||||
this.source("start", loc);
|
||||
cb();
|
||||
this.source("end", loc);
|
||||
|
||||
this._disallowPop("start", loc);
|
||||
}
|
||||
|
||||
source(prop, loc, force) {
|
||||
source(prop, loc) {
|
||||
if (prop && !loc) return;
|
||||
|
||||
this._normalizePosition(prop, loc, this._sourcePosition, force);
|
||||
this._normalizePosition(prop, loc, this._sourcePosition);
|
||||
}
|
||||
|
||||
withSource(prop, loc, cb) {
|
||||
@@ -198,46 +211,26 @@ class Buffer {
|
||||
this.source(prop, loc);
|
||||
cb();
|
||||
|
||||
if ((!this._sourcePosition.force || this._sourcePosition.line !== originalLine || this._sourcePosition.column !== originalColumn || this._sourcePosition.filename !== originalFilename) && (!this._disallowedPop || this._disallowedPop.line !== originalLine || this._disallowedPop.column !== originalColumn || this._disallowedPop.filename !== originalFilename)) {
|
||||
if (!this._disallowedPop || this._disallowedPop.line !== originalLine || this._disallowedPop.column !== originalColumn || this._disallowedPop.filename !== originalFilename) {
|
||||
this._sourcePosition.line = originalLine;
|
||||
this._sourcePosition.column = originalColumn;
|
||||
this._sourcePosition.filename = originalFilename;
|
||||
this._sourcePosition.identifierName = originalIdentifierName;
|
||||
this._sourcePosition.force = false;
|
||||
this._disallowedPop = null;
|
||||
}
|
||||
}
|
||||
|
||||
_disallowPop(prop, loc) {
|
||||
if (prop && !loc) return;
|
||||
this._disallowedPop = this._normalizePosition(prop, loc);
|
||||
this._disallowedPop = this._normalizePosition(prop, loc, SourcePos());
|
||||
}
|
||||
|
||||
_normalizePosition(prop, loc, targetObj, force) {
|
||||
_normalizePosition(prop, loc, targetObj) {
|
||||
const pos = loc ? loc[prop] : null;
|
||||
|
||||
if (targetObj === undefined) {
|
||||
targetObj = {
|
||||
identifierName: null,
|
||||
line: null,
|
||||
column: null,
|
||||
filename: null,
|
||||
force: false
|
||||
};
|
||||
}
|
||||
|
||||
const origLine = targetObj.line;
|
||||
const origColumn = targetObj.column;
|
||||
const origFilename = targetObj.filename;
|
||||
targetObj.identifierName = prop === "start" && (loc == null ? void 0 : loc.identifierName) || null;
|
||||
targetObj.identifierName = prop === "start" && (loc == null ? void 0 : loc.identifierName) || undefined;
|
||||
targetObj.line = pos == null ? void 0 : pos.line;
|
||||
targetObj.column = pos == null ? void 0 : pos.column;
|
||||
targetObj.filename = loc == null ? void 0 : loc.filename;
|
||||
|
||||
if (force || targetObj.line !== origLine || targetObj.column !== origColumn || targetObj.filename !== origFilename) {
|
||||
targetObj.force = force;
|
||||
}
|
||||
|
||||
return targetObj;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user