11434 lines
317 KiB
JavaScript
Generated
11434 lines
317 KiB
JavaScript
Generated
module.exports =
|
||
/******/ (() => { // webpackBootstrap
|
||
/******/ var __webpack_modules__ = ({
|
||
|
||
/***/ 7351:
|
||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importStar = (this && this.__importStar) || function (mod) {
|
||
if (mod && mod.__esModule) return mod;
|
||
var result = {};
|
||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||
result["default"] = mod;
|
||
return result;
|
||
};
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
const os = __importStar(__nccwpck_require__(2087));
|
||
const utils_1 = __nccwpck_require__(5278);
|
||
/**
|
||
* Commands
|
||
*
|
||
* Command Format:
|
||
* ::name key=value,key=value::message
|
||
*
|
||
* Examples:
|
||
* ::warning::This is the message
|
||
* ::set-env name=MY_VAR::some value
|
||
*/
|
||
function issueCommand(command, properties, message) {
|
||
const cmd = new Command(command, properties, message);
|
||
process.stdout.write(cmd.toString() + os.EOL);
|
||
}
|
||
exports.issueCommand = issueCommand;
|
||
function issue(name, message = '') {
|
||
issueCommand(name, {}, message);
|
||
}
|
||
exports.issue = issue;
|
||
const CMD_STRING = '::';
|
||
class Command {
|
||
constructor(command, properties, message) {
|
||
if (!command) {
|
||
command = 'missing.command';
|
||
}
|
||
this.command = command;
|
||
this.properties = properties;
|
||
this.message = message;
|
||
}
|
||
toString() {
|
||
let cmdStr = CMD_STRING + this.command;
|
||
if (this.properties && Object.keys(this.properties).length > 0) {
|
||
cmdStr += ' ';
|
||
let first = true;
|
||
for (const key in this.properties) {
|
||
if (this.properties.hasOwnProperty(key)) {
|
||
const val = this.properties[key];
|
||
if (val) {
|
||
if (first) {
|
||
first = false;
|
||
}
|
||
else {
|
||
cmdStr += ',';
|
||
}
|
||
cmdStr += `${key}=${escapeProperty(val)}`;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
||
return cmdStr;
|
||
}
|
||
}
|
||
function escapeData(s) {
|
||
return utils_1.toCommandValue(s)
|
||
.replace(/%/g, '%25')
|
||
.replace(/\r/g, '%0D')
|
||
.replace(/\n/g, '%0A');
|
||
}
|
||
function escapeProperty(s) {
|
||
return utils_1.toCommandValue(s)
|
||
.replace(/%/g, '%25')
|
||
.replace(/\r/g, '%0D')
|
||
.replace(/\n/g, '%0A')
|
||
.replace(/:/g, '%3A')
|
||
.replace(/,/g, '%2C');
|
||
}
|
||
//# sourceMappingURL=command.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2186:
|
||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
return new (P || (P = Promise))(function (resolve, reject) {
|
||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
});
|
||
};
|
||
var __importStar = (this && this.__importStar) || function (mod) {
|
||
if (mod && mod.__esModule) return mod;
|
||
var result = {};
|
||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||
result["default"] = mod;
|
||
return result;
|
||
};
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
const command_1 = __nccwpck_require__(7351);
|
||
const file_command_1 = __nccwpck_require__(717);
|
||
const utils_1 = __nccwpck_require__(5278);
|
||
const os = __importStar(__nccwpck_require__(2087));
|
||
const path = __importStar(__nccwpck_require__(5622));
|
||
/**
|
||
* The code to exit an action
|
||
*/
|
||
var ExitCode;
|
||
(function (ExitCode) {
|
||
/**
|
||
* A code indicating that the action was successful
|
||
*/
|
||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||
/**
|
||
* A code indicating that the action was a failure
|
||
*/
|
||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||
//-----------------------------------------------------------------------
|
||
// Variables
|
||
//-----------------------------------------------------------------------
|
||
/**
|
||
* Sets env variable for this action and future actions in the job
|
||
* @param name the name of the variable to set
|
||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||
*/
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||
function exportVariable(name, val) {
|
||
const convertedVal = utils_1.toCommandValue(val);
|
||
process.env[name] = convertedVal;
|
||
const filePath = process.env['GITHUB_ENV'] || '';
|
||
if (filePath) {
|
||
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||
file_command_1.issueCommand('ENV', commandValue);
|
||
}
|
||
else {
|
||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||
}
|
||
}
|
||
exports.exportVariable = exportVariable;
|
||
/**
|
||
* Registers a secret which will get masked from logs
|
||
* @param secret value of the secret
|
||
*/
|
||
function setSecret(secret) {
|
||
command_1.issueCommand('add-mask', {}, secret);
|
||
}
|
||
exports.setSecret = setSecret;
|
||
/**
|
||
* Prepends inputPath to the PATH (for this action and future actions)
|
||
* @param inputPath
|
||
*/
|
||
function addPath(inputPath) {
|
||
const filePath = process.env['GITHUB_PATH'] || '';
|
||
if (filePath) {
|
||
file_command_1.issueCommand('PATH', inputPath);
|
||
}
|
||
else {
|
||
command_1.issueCommand('add-path', {}, inputPath);
|
||
}
|
||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||
}
|
||
exports.addPath = addPath;
|
||
/**
|
||
* Gets the value of an input. The value is also trimmed.
|
||
*
|
||
* @param name name of the input to get
|
||
* @param options optional. See InputOptions.
|
||
* @returns string
|
||
*/
|
||
function getInput(name, options) {
|
||
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
||
if (options && options.required && !val) {
|
||
throw new Error(`Input required and not supplied: ${name}`);
|
||
}
|
||
return val.trim();
|
||
}
|
||
exports.getInput = getInput;
|
||
/**
|
||
* Sets the value of an output.
|
||
*
|
||
* @param name name of the output to set
|
||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||
*/
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||
function setOutput(name, value) {
|
||
process.stdout.write(os.EOL);
|
||
command_1.issueCommand('set-output', { name }, value);
|
||
}
|
||
exports.setOutput = setOutput;
|
||
/**
|
||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||
*
|
||
*/
|
||
function setCommandEcho(enabled) {
|
||
command_1.issue('echo', enabled ? 'on' : 'off');
|
||
}
|
||
exports.setCommandEcho = setCommandEcho;
|
||
//-----------------------------------------------------------------------
|
||
// Results
|
||
//-----------------------------------------------------------------------
|
||
/**
|
||
* Sets the action status to failed.
|
||
* When the action exits it will be with an exit code of 1
|
||
* @param message add error issue message
|
||
*/
|
||
function setFailed(message) {
|
||
process.exitCode = ExitCode.Failure;
|
||
error(message);
|
||
}
|
||
exports.setFailed = setFailed;
|
||
//-----------------------------------------------------------------------
|
||
// Logging Commands
|
||
//-----------------------------------------------------------------------
|
||
/**
|
||
* Gets whether Actions Step Debug is on or not
|
||
*/
|
||
function isDebug() {
|
||
return process.env['RUNNER_DEBUG'] === '1';
|
||
}
|
||
exports.isDebug = isDebug;
|
||
/**
|
||
* Writes debug message to user log
|
||
* @param message debug message
|
||
*/
|
||
function debug(message) {
|
||
command_1.issueCommand('debug', {}, message);
|
||
}
|
||
exports.debug = debug;
|
||
/**
|
||
* Adds an error issue
|
||
* @param message error issue message. Errors will be converted to string via toString()
|
||
*/
|
||
function error(message) {
|
||
command_1.issue('error', message instanceof Error ? message.toString() : message);
|
||
}
|
||
exports.error = error;
|
||
/**
|
||
* Adds an warning issue
|
||
* @param message warning issue message. Errors will be converted to string via toString()
|
||
*/
|
||
function warning(message) {
|
||
command_1.issue('warning', message instanceof Error ? message.toString() : message);
|
||
}
|
||
exports.warning = warning;
|
||
/**
|
||
* Writes info to log with console.log.
|
||
* @param message info message
|
||
*/
|
||
function info(message) {
|
||
process.stdout.write(message + os.EOL);
|
||
}
|
||
exports.info = info;
|
||
/**
|
||
* Begin an output group.
|
||
*
|
||
* Output until the next `groupEnd` will be foldable in this group
|
||
*
|
||
* @param name The name of the output group
|
||
*/
|
||
function startGroup(name) {
|
||
command_1.issue('group', name);
|
||
}
|
||
exports.startGroup = startGroup;
|
||
/**
|
||
* End an output group.
|
||
*/
|
||
function endGroup() {
|
||
command_1.issue('endgroup');
|
||
}
|
||
exports.endGroup = endGroup;
|
||
/**
|
||
* Wrap an asynchronous function call in a group.
|
||
*
|
||
* Returns the same type as the function itself.
|
||
*
|
||
* @param name The name of the group
|
||
* @param fn The function to wrap in the group
|
||
*/
|
||
function group(name, fn) {
|
||
return __awaiter(this, void 0, void 0, function* () {
|
||
startGroup(name);
|
||
let result;
|
||
try {
|
||
result = yield fn();
|
||
}
|
||
finally {
|
||
endGroup();
|
||
}
|
||
return result;
|
||
});
|
||
}
|
||
exports.group = group;
|
||
//-----------------------------------------------------------------------
|
||
// Wrapper action state
|
||
//-----------------------------------------------------------------------
|
||
/**
|
||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
||
*
|
||
* @param name name of the state to store
|
||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||
*/
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||
function saveState(name, value) {
|
||
command_1.issueCommand('save-state', { name }, value);
|
||
}
|
||
exports.saveState = saveState;
|
||
/**
|
||
* Gets the value of an state set by this action's main execution.
|
||
*
|
||
* @param name name of the state to get
|
||
* @returns string
|
||
*/
|
||
function getState(name) {
|
||
return process.env[`STATE_${name}`] || '';
|
||
}
|
||
exports.getState = getState;
|
||
//# sourceMappingURL=core.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 717:
|
||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||
|
||
"use strict";
|
||
|
||
// For internal use, subject to change.
|
||
var __importStar = (this && this.__importStar) || function (mod) {
|
||
if (mod && mod.__esModule) return mod;
|
||
var result = {};
|
||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||
result["default"] = mod;
|
||
return result;
|
||
};
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
// We use any as a valid input type
|
||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||
const fs = __importStar(__nccwpck_require__(5747));
|
||
const os = __importStar(__nccwpck_require__(2087));
|
||
const utils_1 = __nccwpck_require__(5278);
|
||
function issueCommand(command, message) {
|
||
const filePath = process.env[`GITHUB_${command}`];
|
||
if (!filePath) {
|
||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||
}
|
||
if (!fs.existsSync(filePath)) {
|
||
throw new Error(`Missing file at path: ${filePath}`);
|
||
}
|
||
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||
encoding: 'utf8'
|
||
});
|
||
}
|
||
exports.issueCommand = issueCommand;
|
||
//# sourceMappingURL=file-command.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 5278:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
// We use any as a valid input type
|
||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
/**
|
||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||
* @param input input to sanitize into a string
|
||
*/
|
||
function toCommandValue(input) {
|
||
if (input === null || input === undefined) {
|
||
return '';
|
||
}
|
||
else if (typeof input === 'string' || input instanceof String) {
|
||
return input;
|
||
}
|
||
return JSON.stringify(input);
|
||
}
|
||
exports.toCommandValue = toCommandValue;
|
||
//# sourceMappingURL=utils.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4751:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
function __export(m) {
|
||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||
}
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
__export(__nccwpck_require__(2825));
|
||
//# sourceMappingURL=index.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2825:
|
||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
const fs_1 = __nccwpck_require__(5747);
|
||
const debug_1 = __importDefault(__nccwpck_require__(8231));
|
||
const log = debug_1.default('@kwsites/file-exists');
|
||
function check(path, isFile, isDirectory) {
|
||
log(`checking %s`, path);
|
||
try {
|
||
const stat = fs_1.statSync(path);
|
||
if (stat.isFile() && isFile) {
|
||
log(`[OK] path represents a file`);
|
||
return true;
|
||
}
|
||
if (stat.isDirectory() && isDirectory) {
|
||
log(`[OK] path represents a directory`);
|
||
return true;
|
||
}
|
||
log(`[FAIL] path represents something other than a file or directory`);
|
||
return false;
|
||
}
|
||
catch (e) {
|
||
if (e.code === 'ENOENT') {
|
||
log(`[FAIL] path is not accessible: %o`, e);
|
||
return false;
|
||
}
|
||
log(`[FATAL] %o`, e);
|
||
throw e;
|
||
}
|
||
}
|
||
/**
|
||
* Synchronous validation of a path existing either as a file or as a directory.
|
||
*
|
||
* @param {string} path The path to check
|
||
* @param {number} type One or both of the exported numeric constants
|
||
*/
|
||
function exists(path, type = exports.READABLE) {
|
||
return check(path, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
|
||
}
|
||
exports.exists = exists;
|
||
/**
|
||
* Constant representing a file
|
||
*/
|
||
exports.FILE = 1;
|
||
/**
|
||
* Constant representing a folder
|
||
*/
|
||
exports.FOLDER = 2;
|
||
/**
|
||
* Constant representing either a file or a folder
|
||
*/
|
||
exports.READABLE = exports.FILE + exports.FOLDER;
|
||
//# sourceMappingURL=index.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9819:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.createDeferred = exports.deferred = void 0;
|
||
/**
|
||
* Creates a new `DeferredPromise`
|
||
*
|
||
* ```typescript
|
||
import {deferred} from '@kwsites/promise-deferred`;
|
||
```
|
||
*/
|
||
function deferred() {
|
||
let done;
|
||
let fail;
|
||
let status = 'pending';
|
||
const promise = new Promise((_done, _fail) => {
|
||
done = _done;
|
||
fail = _fail;
|
||
});
|
||
return {
|
||
promise,
|
||
done(result) {
|
||
if (status === 'pending') {
|
||
status = 'resolved';
|
||
done(result);
|
||
}
|
||
},
|
||
fail(error) {
|
||
if (status === 'pending') {
|
||
status = 'rejected';
|
||
fail(error);
|
||
}
|
||
},
|
||
get fulfilled() {
|
||
return status !== 'pending';
|
||
},
|
||
get status() {
|
||
return status;
|
||
},
|
||
};
|
||
}
|
||
exports.deferred = deferred;
|
||
/**
|
||
* Alias of the exported `deferred` function, to help consumers wanting to use `deferred` as the
|
||
* local variable name rather than the factory import name, without needing to rename on import.
|
||
*
|
||
* ```typescript
|
||
import {createDeferred} from '@kwsites/promise-deferred`;
|
||
```
|
||
*/
|
||
exports.createDeferred = deferred;
|
||
/**
|
||
* Default export allows use as:
|
||
*
|
||
* ```typescript
|
||
import deferred from '@kwsites/promise-deferred`;
|
||
```
|
||
*/
|
||
exports.default = deferred;
|
||
//# sourceMappingURL=index.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8222:
|
||
/***/ ((module, exports, __nccwpck_require__) => {
|
||
|
||
/* eslint-env browser */
|
||
|
||
/**
|
||
* This is the web browser implementation of `debug()`.
|
||
*/
|
||
|
||
exports.log = log;
|
||
exports.formatArgs = formatArgs;
|
||
exports.save = save;
|
||
exports.load = load;
|
||
exports.useColors = useColors;
|
||
exports.storage = localstorage();
|
||
|
||
/**
|
||
* Colors.
|
||
*/
|
||
|
||
exports.colors = [
|
||
'#0000CC',
|
||
'#0000FF',
|
||
'#0033CC',
|
||
'#0033FF',
|
||
'#0066CC',
|
||
'#0066FF',
|
||
'#0099CC',
|
||
'#0099FF',
|
||
'#00CC00',
|
||
'#00CC33',
|
||
'#00CC66',
|
||
'#00CC99',
|
||
'#00CCCC',
|
||
'#00CCFF',
|
||
'#3300CC',
|
||
'#3300FF',
|
||
'#3333CC',
|
||
'#3333FF',
|
||
'#3366CC',
|
||
'#3366FF',
|
||
'#3399CC',
|
||
'#3399FF',
|
||
'#33CC00',
|
||
'#33CC33',
|
||
'#33CC66',
|
||
'#33CC99',
|
||
'#33CCCC',
|
||
'#33CCFF',
|
||
'#6600CC',
|
||
'#6600FF',
|
||
'#6633CC',
|
||
'#6633FF',
|
||
'#66CC00',
|
||
'#66CC33',
|
||
'#9900CC',
|
||
'#9900FF',
|
||
'#9933CC',
|
||
'#9933FF',
|
||
'#99CC00',
|
||
'#99CC33',
|
||
'#CC0000',
|
||
'#CC0033',
|
||
'#CC0066',
|
||
'#CC0099',
|
||
'#CC00CC',
|
||
'#CC00FF',
|
||
'#CC3300',
|
||
'#CC3333',
|
||
'#CC3366',
|
||
'#CC3399',
|
||
'#CC33CC',
|
||
'#CC33FF',
|
||
'#CC6600',
|
||
'#CC6633',
|
||
'#CC9900',
|
||
'#CC9933',
|
||
'#CCCC00',
|
||
'#CCCC33',
|
||
'#FF0000',
|
||
'#FF0033',
|
||
'#FF0066',
|
||
'#FF0099',
|
||
'#FF00CC',
|
||
'#FF00FF',
|
||
'#FF3300',
|
||
'#FF3333',
|
||
'#FF3366',
|
||
'#FF3399',
|
||
'#FF33CC',
|
||
'#FF33FF',
|
||
'#FF6600',
|
||
'#FF6633',
|
||
'#FF9900',
|
||
'#FF9933',
|
||
'#FFCC00',
|
||
'#FFCC33'
|
||
];
|
||
|
||
/**
|
||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||
* and the Firebug extension (any Firefox version) are known
|
||
* to support "%c" CSS customizations.
|
||
*
|
||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||
*/
|
||
|
||
// eslint-disable-next-line complexity
|
||
function useColors() {
|
||
// NB: In an Electron preload script, document will be defined but not fully
|
||
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||
// explicitly
|
||
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
||
return true;
|
||
}
|
||
|
||
// Internet Explorer and Edge do not support colors.
|
||
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
||
return false;
|
||
}
|
||
|
||
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||
// Is firebug? http://stackoverflow.com/a/398120/376773
|
||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||
// Is firefox >= v31?
|
||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
||
// Double check webkit in userAgent just in case we are in a worker
|
||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||
}
|
||
|
||
/**
|
||
* Colorize log arguments if enabled.
|
||
*
|
||
* @api public
|
||
*/
|
||
|
||
function formatArgs(args) {
|
||
args[0] = (this.useColors ? '%c' : '') +
|
||
this.namespace +
|
||
(this.useColors ? ' %c' : ' ') +
|
||
args[0] +
|
||
(this.useColors ? '%c ' : ' ') +
|
||
'+' + module.exports.humanize(this.diff);
|
||
|
||
if (!this.useColors) {
|
||
return;
|
||
}
|
||
|
||
const c = 'color: ' + this.color;
|
||
args.splice(1, 0, c, 'color: inherit');
|
||
|
||
// The final "%c" is somewhat tricky, because there could be other
|
||
// arguments passed either before or after the %c, so we need to
|
||
// figure out the correct index to insert the CSS into
|
||
let index = 0;
|
||
let lastC = 0;
|
||
args[0].replace(/%[a-zA-Z%]/g, match => {
|
||
if (match === '%%') {
|
||
return;
|
||
}
|
||
index++;
|
||
if (match === '%c') {
|
||
// We only are interested in the *last* %c
|
||
// (the user may have provided their own)
|
||
lastC = index;
|
||
}
|
||
});
|
||
|
||
args.splice(lastC, 0, c);
|
||
}
|
||
|
||
/**
|
||
* Invokes `console.log()` when available.
|
||
* No-op when `console.log` is not a "function".
|
||
*
|
||
* @api public
|
||
*/
|
||
function log(...args) {
|
||
// This hackery is required for IE8/9, where
|
||
// the `console.log` function doesn't have 'apply'
|
||
return typeof console === 'object' &&
|
||
console.log &&
|
||
console.log(...args);
|
||
}
|
||
|
||
/**
|
||
* Save `namespaces`.
|
||
*
|
||
* @param {String} namespaces
|
||
* @api private
|
||
*/
|
||
function save(namespaces) {
|
||
try {
|
||
if (namespaces) {
|
||
exports.storage.setItem('debug', namespaces);
|
||
} else {
|
||
exports.storage.removeItem('debug');
|
||
}
|
||
} catch (error) {
|
||
// Swallow
|
||
// XXX (@Qix-) should we be logging these?
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Load `namespaces`.
|
||
*
|
||
* @return {String} returns the previously persisted debug modes
|
||
* @api private
|
||
*/
|
||
function load() {
|
||
let r;
|
||
try {
|
||
r = exports.storage.getItem('debug');
|
||
} catch (error) {
|
||
// Swallow
|
||
// XXX (@Qix-) should we be logging these?
|
||
}
|
||
|
||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||
r = process.env.DEBUG;
|
||
}
|
||
|
||
return r;
|
||
}
|
||
|
||
/**
|
||
* Localstorage attempts to return the localstorage.
|
||
*
|
||
* This is necessary because safari throws
|
||
* when a user disables cookies/localstorage
|
||
* and you attempt to access it.
|
||
*
|
||
* @return {LocalStorage}
|
||
* @api private
|
||
*/
|
||
|
||
function localstorage() {
|
||
try {
|
||
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
||
// The Browser also has localStorage in the global context.
|
||
return localStorage;
|
||
} catch (error) {
|
||
// Swallow
|
||
// XXX (@Qix-) should we be logging these?
|
||
}
|
||
}
|
||
|
||
module.exports = __nccwpck_require__(6243)(exports);
|
||
|
||
const {formatters} = module.exports;
|
||
|
||
/**
|
||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||
*/
|
||
|
||
formatters.j = function (v) {
|
||
try {
|
||
return JSON.stringify(v);
|
||
} catch (error) {
|
||
return '[UnexpectedJSONParseError]: ' + error.message;
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6243:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
|
||
/**
|
||
* This is the common logic for both the Node.js and web browser
|
||
* implementations of `debug()`.
|
||
*/
|
||
|
||
function setup(env) {
|
||
createDebug.debug = createDebug;
|
||
createDebug.default = createDebug;
|
||
createDebug.coerce = coerce;
|
||
createDebug.disable = disable;
|
||
createDebug.enable = enable;
|
||
createDebug.enabled = enabled;
|
||
createDebug.humanize = __nccwpck_require__(900);
|
||
|
||
Object.keys(env).forEach(key => {
|
||
createDebug[key] = env[key];
|
||
});
|
||
|
||
/**
|
||
* Active `debug` instances.
|
||
*/
|
||
createDebug.instances = [];
|
||
|
||
/**
|
||
* The currently active debug mode names, and names to skip.
|
||
*/
|
||
|
||
createDebug.names = [];
|
||
createDebug.skips = [];
|
||
|
||
/**
|
||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||
*
|
||
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||
*/
|
||
createDebug.formatters = {};
|
||
|
||
/**
|
||
* Selects a color for a debug namespace
|
||
* @param {String} namespace The namespace string for the for the debug instance to be colored
|
||
* @return {Number|String} An ANSI color code for the given namespace
|
||
* @api private
|
||
*/
|
||
function selectColor(namespace) {
|
||
let hash = 0;
|
||
|
||
for (let i = 0; i < namespace.length; i++) {
|
||
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||
hash |= 0; // Convert to 32bit integer
|
||
}
|
||
|
||
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
||
}
|
||
createDebug.selectColor = selectColor;
|
||
|
||
/**
|
||
* Create a debugger with the given `namespace`.
|
||
*
|
||
* @param {String} namespace
|
||
* @return {Function}
|
||
* @api public
|
||
*/
|
||
function createDebug(namespace) {
|
||
let prevTime;
|
||
|
||
function debug(...args) {
|
||
// Disabled?
|
||
if (!debug.enabled) {
|
||
return;
|
||
}
|
||
|
||
const self = debug;
|
||
|
||
// Set `diff` timestamp
|
||
const curr = Number(new Date());
|
||
const ms = curr - (prevTime || curr);
|
||
self.diff = ms;
|
||
self.prev = prevTime;
|
||
self.curr = curr;
|
||
prevTime = curr;
|
||
|
||
args[0] = createDebug.coerce(args[0]);
|
||
|
||
if (typeof args[0] !== 'string') {
|
||
// Anything else let's inspect with %O
|
||
args.unshift('%O');
|
||
}
|
||
|
||
// Apply any `formatters` transformations
|
||
let index = 0;
|
||
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
||
// If we encounter an escaped % then don't increase the array index
|
||
if (match === '%%') {
|
||
return match;
|
||
}
|
||
index++;
|
||
const formatter = createDebug.formatters[format];
|
||
if (typeof formatter === 'function') {
|
||
const val = args[index];
|
||
match = formatter.call(self, val);
|
||
|
||
// Now we need to remove `args[index]` since it's inlined in the `format`
|
||
args.splice(index, 1);
|
||
index--;
|
||
}
|
||
return match;
|
||
});
|
||
|
||
// Apply env-specific formatting (colors, etc.)
|
||
createDebug.formatArgs.call(self, args);
|
||
|
||
const logFn = self.log || createDebug.log;
|
||
logFn.apply(self, args);
|
||
}
|
||
|
||
debug.namespace = namespace;
|
||
debug.enabled = createDebug.enabled(namespace);
|
||
debug.useColors = createDebug.useColors();
|
||
debug.color = selectColor(namespace);
|
||
debug.destroy = destroy;
|
||
debug.extend = extend;
|
||
// Debug.formatArgs = formatArgs;
|
||
// debug.rawLog = rawLog;
|
||
|
||
// env-specific initialization logic for debug instances
|
||
if (typeof createDebug.init === 'function') {
|
||
createDebug.init(debug);
|
||
}
|
||
|
||
createDebug.instances.push(debug);
|
||
|
||
return debug;
|
||
}
|
||
|
||
function destroy() {
|
||
const index = createDebug.instances.indexOf(this);
|
||
if (index !== -1) {
|
||
createDebug.instances.splice(index, 1);
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
function extend(namespace, delimiter) {
|
||
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||
newDebug.log = this.log;
|
||
return newDebug;
|
||
}
|
||
|
||
/**
|
||
* Enables a debug mode by namespaces. This can include modes
|
||
* separated by a colon and wildcards.
|
||
*
|
||
* @param {String} namespaces
|
||
* @api public
|
||
*/
|
||
function enable(namespaces) {
|
||
createDebug.save(namespaces);
|
||
|
||
createDebug.names = [];
|
||
createDebug.skips = [];
|
||
|
||
let i;
|
||
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||
const len = split.length;
|
||
|
||
for (i = 0; i < len; i++) {
|
||
if (!split[i]) {
|
||
// ignore empty strings
|
||
continue;
|
||
}
|
||
|
||
namespaces = split[i].replace(/\*/g, '.*?');
|
||
|
||
if (namespaces[0] === '-') {
|
||
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||
} else {
|
||
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
||
}
|
||
}
|
||
|
||
for (i = 0; i < createDebug.instances.length; i++) {
|
||
const instance = createDebug.instances[i];
|
||
instance.enabled = createDebug.enabled(instance.namespace);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Disable debug output.
|
||
*
|
||
* @return {String} namespaces
|
||
* @api public
|
||
*/
|
||
function disable() {
|
||
const namespaces = [
|
||
...createDebug.names.map(toNamespace),
|
||
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
||
].join(',');
|
||
createDebug.enable('');
|
||
return namespaces;
|
||
}
|
||
|
||
/**
|
||
* Returns true if the given mode name is enabled, false otherwise.
|
||
*
|
||
* @param {String} name
|
||
* @return {Boolean}
|
||
* @api public
|
||
*/
|
||
function enabled(name) {
|
||
if (name[name.length - 1] === '*') {
|
||
return true;
|
||
}
|
||
|
||
let i;
|
||
let len;
|
||
|
||
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
||
if (createDebug.skips[i].test(name)) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
||
if (createDebug.names[i].test(name)) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
/**
|
||
* Convert regexp to namespace
|
||
*
|
||
* @param {RegExp} regxep
|
||
* @return {String} namespace
|
||
* @api private
|
||
*/
|
||
function toNamespace(regexp) {
|
||
return regexp.toString()
|
||
.substring(2, regexp.toString().length - 2)
|
||
.replace(/\.\*\?$/, '*');
|
||
}
|
||
|
||
/**
|
||
* Coerce `val`.
|
||
*
|
||
* @param {Mixed} val
|
||
* @return {Mixed}
|
||
* @api private
|
||
*/
|
||
function coerce(val) {
|
||
if (val instanceof Error) {
|
||
return val.stack || val.message;
|
||
}
|
||
return val;
|
||
}
|
||
|
||
createDebug.enable(createDebug.load());
|
||
|
||
return createDebug;
|
||
}
|
||
|
||
module.exports = setup;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8231:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
/**
|
||
* Detect Electron renderer / nwjs process, which is node, but we should
|
||
* treat as a browser.
|
||
*/
|
||
|
||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||
module.exports = __nccwpck_require__(8222);
|
||
} else {
|
||
module.exports = __nccwpck_require__(5332);
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 5332:
|
||
/***/ ((module, exports, __nccwpck_require__) => {
|
||
|
||
/**
|
||
* Module dependencies.
|
||
*/
|
||
|
||
const tty = __nccwpck_require__(3867);
|
||
const util = __nccwpck_require__(1669);
|
||
|
||
/**
|
||
* This is the Node.js implementation of `debug()`.
|
||
*/
|
||
|
||
exports.init = init;
|
||
exports.log = log;
|
||
exports.formatArgs = formatArgs;
|
||
exports.save = save;
|
||
exports.load = load;
|
||
exports.useColors = useColors;
|
||
|
||
/**
|
||
* Colors.
|
||
*/
|
||
|
||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||
|
||
try {
|
||
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||
const supportsColor = __nccwpck_require__(9318);
|
||
|
||
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
||
exports.colors = [
|
||
20,
|
||
21,
|
||
26,
|
||
27,
|
||
32,
|
||
33,
|
||
38,
|
||
39,
|
||
40,
|
||
41,
|
||
42,
|
||
43,
|
||
44,
|
||
45,
|
||
56,
|
||
57,
|
||
62,
|
||
63,
|
||
68,
|
||
69,
|
||
74,
|
||
75,
|
||
76,
|
||
77,
|
||
78,
|
||
79,
|
||
80,
|
||
81,
|
||
92,
|
||
93,
|
||
98,
|
||
99,
|
||
112,
|
||
113,
|
||
128,
|
||
129,
|
||
134,
|
||
135,
|
||
148,
|
||
149,
|
||
160,
|
||
161,
|
||
162,
|
||
163,
|
||
164,
|
||
165,
|
||
166,
|
||
167,
|
||
168,
|
||
169,
|
||
170,
|
||
171,
|
||
172,
|
||
173,
|
||
178,
|
||
179,
|
||
184,
|
||
185,
|
||
196,
|
||
197,
|
||
198,
|
||
199,
|
||
200,
|
||
201,
|
||
202,
|
||
203,
|
||
204,
|
||
205,
|
||
206,
|
||
207,
|
||
208,
|
||
209,
|
||
214,
|
||
215,
|
||
220,
|
||
221
|
||
];
|
||
}
|
||
} catch (error) {
|
||
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
||
}
|
||
|
||
/**
|
||
* Build up the default `inspectOpts` object from the environment variables.
|
||
*
|
||
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||
*/
|
||
|
||
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
||
return /^debug_/i.test(key);
|
||
}).reduce((obj, key) => {
|
||
// Camel-case
|
||
const prop = key
|
||
.substring(6)
|
||
.toLowerCase()
|
||
.replace(/_([a-z])/g, (_, k) => {
|
||
return k.toUpperCase();
|
||
});
|
||
|
||
// Coerce string value into JS value
|
||
let val = process.env[key];
|
||
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
||
val = true;
|
||
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
||
val = false;
|
||
} else if (val === 'null') {
|
||
val = null;
|
||
} else {
|
||
val = Number(val);
|
||
}
|
||
|
||
obj[prop] = val;
|
||
return obj;
|
||
}, {});
|
||
|
||
/**
|
||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||
*/
|
||
|
||
function useColors() {
|
||
return 'colors' in exports.inspectOpts ?
|
||
Boolean(exports.inspectOpts.colors) :
|
||
tty.isatty(process.stderr.fd);
|
||
}
|
||
|
||
/**
|
||
* Adds ANSI color escape codes if enabled.
|
||
*
|
||
* @api public
|
||
*/
|
||
|
||
function formatArgs(args) {
|
||
const {namespace: name, useColors} = this;
|
||
|
||
if (useColors) {
|
||
const c = this.color;
|
||
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
||
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
||
|
||
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
||
} else {
|
||
args[0] = getDate() + name + ' ' + args[0];
|
||
}
|
||
}
|
||
|
||
function getDate() {
|
||
if (exports.inspectOpts.hideDate) {
|
||
return '';
|
||
}
|
||
return new Date().toISOString() + ' ';
|
||
}
|
||
|
||
/**
|
||
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
||
*/
|
||
|
||
function log(...args) {
|
||
return process.stderr.write(util.format(...args) + '\n');
|
||
}
|
||
|
||
/**
|
||
* Save `namespaces`.
|
||
*
|
||
* @param {String} namespaces
|
||
* @api private
|
||
*/
|
||
function save(namespaces) {
|
||
if (namespaces) {
|
||
process.env.DEBUG = namespaces;
|
||
} else {
|
||
// If you set a process.env field to null or undefined, it gets cast to the
|
||
// string 'null' or 'undefined'. Just delete instead.
|
||
delete process.env.DEBUG;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Load `namespaces`.
|
||
*
|
||
* @return {String} returns the previously persisted debug modes
|
||
* @api private
|
||
*/
|
||
|
||
function load() {
|
||
return process.env.DEBUG;
|
||
}
|
||
|
||
/**
|
||
* Init logic for `debug` instances.
|
||
*
|
||
* Create a new `inspectOpts` object in case `useColors` is set
|
||
* differently for a particular `debug` instance.
|
||
*/
|
||
|
||
function init(debug) {
|
||
debug.inspectOpts = {};
|
||
|
||
const keys = Object.keys(exports.inspectOpts);
|
||
for (let i = 0; i < keys.length; i++) {
|
||
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||
}
|
||
}
|
||
|
||
module.exports = __nccwpck_require__(6243)(exports);
|
||
|
||
const {formatters} = module.exports;
|
||
|
||
/**
|
||
* Map %o to `util.inspect()`, all on a single line.
|
||
*/
|
||
|
||
formatters.o = function (v) {
|
||
this.inspectOpts.colors = this.useColors;
|
||
return util.inspect(v, this.inspectOpts)
|
||
.replace(/\s*\n\s*/g, ' ');
|
||
};
|
||
|
||
/**
|
||
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
||
*/
|
||
|
||
formatters.O = function (v) {
|
||
this.inspectOpts.colors = this.useColors;
|
||
return util.inspect(v, this.inspectOpts);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1621:
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
module.exports = (flag, argv = process.argv) => {
|
||
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
||
const position = argv.indexOf(prefix + flag);
|
||
const terminatorPosition = argv.indexOf('--');
|
||
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1917:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
|
||
var loader = __nccwpck_require__(1161);
|
||
var dumper = __nccwpck_require__(8866);
|
||
|
||
|
||
function renamed(from, to) {
|
||
return function () {
|
||
throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +
|
||
'Use yaml.' + to + ' instead, which is now safe by default.');
|
||
};
|
||
}
|
||
|
||
|
||
module.exports.Type = __nccwpck_require__(6073);
|
||
module.exports.Schema = __nccwpck_require__(1082);
|
||
module.exports.FAILSAFE_SCHEMA = __nccwpck_require__(8562);
|
||
module.exports.JSON_SCHEMA = __nccwpck_require__(1035);
|
||
module.exports.CORE_SCHEMA = __nccwpck_require__(2011);
|
||
module.exports.DEFAULT_SCHEMA = __nccwpck_require__(8759);
|
||
module.exports.load = loader.load;
|
||
module.exports.loadAll = loader.loadAll;
|
||
module.exports.dump = dumper.dump;
|
||
module.exports.YAMLException = __nccwpck_require__(8179);
|
||
|
||
// Removed functions from JS-YAML 3.0.x
|
||
module.exports.safeLoad = renamed('safeLoad', 'load');
|
||
module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll');
|
||
module.exports.safeDump = renamed('safeDump', 'dump');
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6829:
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
|
||
function isNothing(subject) {
|
||
return (typeof subject === 'undefined') || (subject === null);
|
||
}
|
||
|
||
|
||
function isObject(subject) {
|
||
return (typeof subject === 'object') && (subject !== null);
|
||
}
|
||
|
||
|
||
function toArray(sequence) {
|
||
if (Array.isArray(sequence)) return sequence;
|
||
else if (isNothing(sequence)) return [];
|
||
|
||
return [ sequence ];
|
||
}
|
||
|
||
|
||
function extend(target, source) {
|
||
var index, length, key, sourceKeys;
|
||
|
||
if (source) {
|
||
sourceKeys = Object.keys(source);
|
||
|
||
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
||
key = sourceKeys[index];
|
||
target[key] = source[key];
|
||
}
|
||
}
|
||
|
||
return target;
|
||
}
|
||
|
||
|
||
function repeat(string, count) {
|
||
var result = '', cycle;
|
||
|
||
for (cycle = 0; cycle < count; cycle += 1) {
|
||
result += string;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
|
||
function isNegativeZero(number) {
|
||
return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
|
||
}
|
||
|
||
|
||
module.exports.isNothing = isNothing;
|
||
module.exports.isObject = isObject;
|
||
module.exports.toArray = toArray;
|
||
module.exports.repeat = repeat;
|
||
module.exports.isNegativeZero = isNegativeZero;
|
||
module.exports.extend = extend;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8866:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
/*eslint-disable no-use-before-define*/
|
||
|
||
var common = __nccwpck_require__(6829);
|
||
var YAMLException = __nccwpck_require__(8179);
|
||
var DEFAULT_SCHEMA = __nccwpck_require__(8759);
|
||
|
||
var _toString = Object.prototype.toString;
|
||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
|
||
var CHAR_BOM = 0xFEFF;
|
||
var CHAR_TAB = 0x09; /* Tab */
|
||
var CHAR_LINE_FEED = 0x0A; /* LF */
|
||
var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
|
||
var CHAR_SPACE = 0x20; /* Space */
|
||
var CHAR_EXCLAMATION = 0x21; /* ! */
|
||
var CHAR_DOUBLE_QUOTE = 0x22; /* " */
|
||
var CHAR_SHARP = 0x23; /* # */
|
||
var CHAR_PERCENT = 0x25; /* % */
|
||
var CHAR_AMPERSAND = 0x26; /* & */
|
||
var CHAR_SINGLE_QUOTE = 0x27; /* ' */
|
||
var CHAR_ASTERISK = 0x2A; /* * */
|
||
var CHAR_COMMA = 0x2C; /* , */
|
||
var CHAR_MINUS = 0x2D; /* - */
|
||
var CHAR_COLON = 0x3A; /* : */
|
||
var CHAR_EQUALS = 0x3D; /* = */
|
||
var CHAR_GREATER_THAN = 0x3E; /* > */
|
||
var CHAR_QUESTION = 0x3F; /* ? */
|
||
var CHAR_COMMERCIAL_AT = 0x40; /* @ */
|
||
var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
|
||
var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
|
||
var CHAR_GRAVE_ACCENT = 0x60; /* ` */
|
||
var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
|
||
var CHAR_VERTICAL_LINE = 0x7C; /* | */
|
||
var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
|
||
|
||
var ESCAPE_SEQUENCES = {};
|
||
|
||
ESCAPE_SEQUENCES[0x00] = '\\0';
|
||
ESCAPE_SEQUENCES[0x07] = '\\a';
|
||
ESCAPE_SEQUENCES[0x08] = '\\b';
|
||
ESCAPE_SEQUENCES[0x09] = '\\t';
|
||
ESCAPE_SEQUENCES[0x0A] = '\\n';
|
||
ESCAPE_SEQUENCES[0x0B] = '\\v';
|
||
ESCAPE_SEQUENCES[0x0C] = '\\f';
|
||
ESCAPE_SEQUENCES[0x0D] = '\\r';
|
||
ESCAPE_SEQUENCES[0x1B] = '\\e';
|
||
ESCAPE_SEQUENCES[0x22] = '\\"';
|
||
ESCAPE_SEQUENCES[0x5C] = '\\\\';
|
||
ESCAPE_SEQUENCES[0x85] = '\\N';
|
||
ESCAPE_SEQUENCES[0xA0] = '\\_';
|
||
ESCAPE_SEQUENCES[0x2028] = '\\L';
|
||
ESCAPE_SEQUENCES[0x2029] = '\\P';
|
||
|
||
var DEPRECATED_BOOLEANS_SYNTAX = [
|
||
'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
|
||
'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
|
||
];
|
||
|
||
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
||
|
||
function compileStyleMap(schema, map) {
|
||
var result, keys, index, length, tag, style, type;
|
||
|
||
if (map === null) return {};
|
||
|
||
result = {};
|
||
keys = Object.keys(map);
|
||
|
||
for (index = 0, length = keys.length; index < length; index += 1) {
|
||
tag = keys[index];
|
||
style = String(map[tag]);
|
||
|
||
if (tag.slice(0, 2) === '!!') {
|
||
tag = 'tag:yaml.org,2002:' + tag.slice(2);
|
||
}
|
||
type = schema.compiledTypeMap['fallback'][tag];
|
||
|
||
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
||
style = type.styleAliases[style];
|
||
}
|
||
|
||
result[tag] = style;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function encodeHex(character) {
|
||
var string, handle, length;
|
||
|
||
string = character.toString(16).toUpperCase();
|
||
|
||
if (character <= 0xFF) {
|
||
handle = 'x';
|
||
length = 2;
|
||
} else if (character <= 0xFFFF) {
|
||
handle = 'u';
|
||
length = 4;
|
||
} else if (character <= 0xFFFFFFFF) {
|
||
handle = 'U';
|
||
length = 8;
|
||
} else {
|
||
throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
|
||
}
|
||
|
||
return '\\' + handle + common.repeat('0', length - string.length) + string;
|
||
}
|
||
|
||
|
||
var QUOTING_TYPE_SINGLE = 1,
|
||
QUOTING_TYPE_DOUBLE = 2;
|
||
|
||
function State(options) {
|
||
this.schema = options['schema'] || DEFAULT_SCHEMA;
|
||
this.indent = Math.max(1, (options['indent'] || 2));
|
||
this.noArrayIndent = options['noArrayIndent'] || false;
|
||
this.skipInvalid = options['skipInvalid'] || false;
|
||
this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
|
||
this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
|
||
this.sortKeys = options['sortKeys'] || false;
|
||
this.lineWidth = options['lineWidth'] || 80;
|
||
this.noRefs = options['noRefs'] || false;
|
||
this.noCompatMode = options['noCompatMode'] || false;
|
||
this.condenseFlow = options['condenseFlow'] || false;
|
||
this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
||
this.forceQuotes = options['forceQuotes'] || false;
|
||
this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null;
|
||
|
||
this.implicitTypes = this.schema.compiledImplicit;
|
||
this.explicitTypes = this.schema.compiledExplicit;
|
||
|
||
this.tag = null;
|
||
this.result = '';
|
||
|
||
this.duplicates = [];
|
||
this.usedDuplicates = null;
|
||
}
|
||
|
||
// Indents every line in a string. Empty lines (\n only) are not indented.
|
||
function indentString(string, spaces) {
|
||
var ind = common.repeat(' ', spaces),
|
||
position = 0,
|
||
next = -1,
|
||
result = '',
|
||
line,
|
||
length = string.length;
|
||
|
||
while (position < length) {
|
||
next = string.indexOf('\n', position);
|
||
if (next === -1) {
|
||
line = string.slice(position);
|
||
position = length;
|
||
} else {
|
||
line = string.slice(position, next + 1);
|
||
position = next + 1;
|
||
}
|
||
|
||
if (line.length && line !== '\n') result += ind;
|
||
|
||
result += line;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function generateNextLine(state, level) {
|
||
return '\n' + common.repeat(' ', state.indent * level);
|
||
}
|
||
|
||
function testImplicitResolving(state, str) {
|
||
var index, length, type;
|
||
|
||
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
||
type = state.implicitTypes[index];
|
||
|
||
if (type.resolve(str)) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
// [33] s-white ::= s-space | s-tab
|
||
function isWhitespace(c) {
|
||
return c === CHAR_SPACE || c === CHAR_TAB;
|
||
}
|
||
|
||
// Returns true if the character can be printed without escaping.
|
||
// From YAML 1.2: "any allowed characters known to be non-printable
|
||
// should also be escaped. [However,] This isn’t mandatory"
|
||
// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
|
||
function isPrintable(c) {
|
||
return (0x00020 <= c && c <= 0x00007E)
|
||
|| ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
|
||
|| ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM)
|
||
|| (0x10000 <= c && c <= 0x10FFFF);
|
||
}
|
||
|
||
// [34] ns-char ::= nb-char - s-white
|
||
// [27] nb-char ::= c-printable - b-char - c-byte-order-mark
|
||
// [26] b-char ::= b-line-feed | b-carriage-return
|
||
// Including s-white (for some reason, examples doesn't match specs in this aspect)
|
||
// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark
|
||
function isNsCharOrWhitespace(c) {
|
||
return isPrintable(c)
|
||
&& c !== CHAR_BOM
|
||
// - b-char
|
||
&& c !== CHAR_CARRIAGE_RETURN
|
||
&& c !== CHAR_LINE_FEED;
|
||
}
|
||
|
||
// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out
|
||
// c = flow-in ⇒ ns-plain-safe-in
|
||
// c = block-key ⇒ ns-plain-safe-out
|
||
// c = flow-key ⇒ ns-plain-safe-in
|
||
// [128] ns-plain-safe-out ::= ns-char
|
||
// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator
|
||
// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” )
|
||
// | ( /* An ns-char preceding */ “#” )
|
||
// | ( “:” /* Followed by an ns-plain-safe(c) */ )
|
||
function isPlainSafe(c, prev, inblock) {
|
||
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
||
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
||
return (
|
||
// ns-plain-safe
|
||
inblock ? // c = flow-in
|
||
cIsNsCharOrWhitespace
|
||
: cIsNsCharOrWhitespace
|
||
// - c-flow-indicator
|
||
&& c !== CHAR_COMMA
|
||
&& c !== CHAR_LEFT_SQUARE_BRACKET
|
||
&& c !== CHAR_RIGHT_SQUARE_BRACKET
|
||
&& c !== CHAR_LEFT_CURLY_BRACKET
|
||
&& c !== CHAR_RIGHT_CURLY_BRACKET
|
||
)
|
||
// ns-plain-char
|
||
&& c !== CHAR_SHARP // false on '#'
|
||
&& !(prev === CHAR_COLON && !cIsNsChar) // false on ': '
|
||
|| (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#'
|
||
|| (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]'
|
||
}
|
||
|
||
// Simplified test for values allowed as the first character in plain style.
|
||
function isPlainSafeFirst(c) {
|
||
// Uses a subset of ns-char - c-indicator
|
||
// where ns-char = nb-char - s-white.
|
||
// No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part
|
||
return isPrintable(c) && c !== CHAR_BOM
|
||
&& !isWhitespace(c) // - s-white
|
||
// - (c-indicator ::=
|
||
// “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
|
||
&& c !== CHAR_MINUS
|
||
&& c !== CHAR_QUESTION
|
||
&& c !== CHAR_COLON
|
||
&& c !== CHAR_COMMA
|
||
&& c !== CHAR_LEFT_SQUARE_BRACKET
|
||
&& c !== CHAR_RIGHT_SQUARE_BRACKET
|
||
&& c !== CHAR_LEFT_CURLY_BRACKET
|
||
&& c !== CHAR_RIGHT_CURLY_BRACKET
|
||
// | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
|
||
&& c !== CHAR_SHARP
|
||
&& c !== CHAR_AMPERSAND
|
||
&& c !== CHAR_ASTERISK
|
||
&& c !== CHAR_EXCLAMATION
|
||
&& c !== CHAR_VERTICAL_LINE
|
||
&& c !== CHAR_EQUALS
|
||
&& c !== CHAR_GREATER_THAN
|
||
&& c !== CHAR_SINGLE_QUOTE
|
||
&& c !== CHAR_DOUBLE_QUOTE
|
||
// | “%” | “@” | “`”)
|
||
&& c !== CHAR_PERCENT
|
||
&& c !== CHAR_COMMERCIAL_AT
|
||
&& c !== CHAR_GRAVE_ACCENT;
|
||
}
|
||
|
||
// Simplified test for values allowed as the last character in plain style.
|
||
function isPlainSafeLast(c) {
|
||
// just not whitespace or colon, it will be checked to be plain character later
|
||
return !isWhitespace(c) && c !== CHAR_COLON;
|
||
}
|
||
|
||
// Same as 'string'.codePointAt(pos), but works in older browsers.
|
||
function codePointAt(string, pos) {
|
||
var first = string.charCodeAt(pos), second;
|
||
if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {
|
||
second = string.charCodeAt(pos + 1);
|
||
if (second >= 0xDC00 && second <= 0xDFFF) {
|
||
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
|
||
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
|
||
}
|
||
}
|
||
return first;
|
||
}
|
||
|
||
// Determines whether block indentation indicator is required.
|
||
function needIndentIndicator(string) {
|
||
var leadingSpaceRe = /^\n* /;
|
||
return leadingSpaceRe.test(string);
|
||
}
|
||
|
||
var STYLE_PLAIN = 1,
|
||
STYLE_SINGLE = 2,
|
||
STYLE_LITERAL = 3,
|
||
STYLE_FOLDED = 4,
|
||
STYLE_DOUBLE = 5;
|
||
|
||
// Determines which scalar styles are possible and returns the preferred style.
|
||
// lineWidth = -1 => no limit.
|
||
// Pre-conditions: str.length > 0.
|
||
// Post-conditions:
|
||
// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
|
||
// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
|
||
// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
|
||
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,
|
||
testAmbiguousType, quotingType, forceQuotes, inblock) {
|
||
|
||
var i;
|
||
var char = 0;
|
||
var prevChar = null;
|
||
var hasLineBreak = false;
|
||
var hasFoldableLine = false; // only checked if shouldTrackWidth
|
||
var shouldTrackWidth = lineWidth !== -1;
|
||
var previousLineBreak = -1; // count the first line correctly
|
||
var plain = isPlainSafeFirst(codePointAt(string, 0))
|
||
&& isPlainSafeLast(codePointAt(string, string.length - 1));
|
||
|
||
if (singleLineOnly || forceQuotes) {
|
||
// Case: no block styles.
|
||
// Check for disallowed characters to rule out plain and single.
|
||
for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
|
||
char = codePointAt(string, i);
|
||
if (!isPrintable(char)) {
|
||
return STYLE_DOUBLE;
|
||
}
|
||
plain = plain && isPlainSafe(char, prevChar, inblock);
|
||
prevChar = char;
|
||
}
|
||
} else {
|
||
// Case: block styles permitted.
|
||
for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
|
||
char = codePointAt(string, i);
|
||
if (char === CHAR_LINE_FEED) {
|
||
hasLineBreak = true;
|
||
// Check if any line can be folded.
|
||
if (shouldTrackWidth) {
|
||
hasFoldableLine = hasFoldableLine ||
|
||
// Foldable line = too long, and not more-indented.
|
||
(i - previousLineBreak - 1 > lineWidth &&
|
||
string[previousLineBreak + 1] !== ' ');
|
||
previousLineBreak = i;
|
||
}
|
||
} else if (!isPrintable(char)) {
|
||
return STYLE_DOUBLE;
|
||
}
|
||
plain = plain && isPlainSafe(char, prevChar, inblock);
|
||
prevChar = char;
|
||
}
|
||
// in case the end is missing a \n
|
||
hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
|
||
(i - previousLineBreak - 1 > lineWidth &&
|
||
string[previousLineBreak + 1] !== ' '));
|
||
}
|
||
// Although every style can represent \n without escaping, prefer block styles
|
||
// for multiline, since they're more readable and they don't add empty lines.
|
||
// Also prefer folding a super-long line.
|
||
if (!hasLineBreak && !hasFoldableLine) {
|
||
// Strings interpretable as another type have to be quoted;
|
||
// e.g. the string 'true' vs. the boolean true.
|
||
if (plain && !forceQuotes && !testAmbiguousType(string)) {
|
||
return STYLE_PLAIN;
|
||
}
|
||
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
||
}
|
||
// Edge case: block indentation indicator can only have one digit.
|
||
if (indentPerLevel > 9 && needIndentIndicator(string)) {
|
||
return STYLE_DOUBLE;
|
||
}
|
||
// At this point we know block styles are valid.
|
||
// Prefer literal style unless we want to fold.
|
||
if (!forceQuotes) {
|
||
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
||
}
|
||
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
||
}
|
||
|
||
// Note: line breaking/folding is implemented for only the folded style.
|
||
// NB. We drop the last trailing newline (if any) of a returned block scalar
|
||
// since the dumper adds its own newline. This always works:
|
||
// • No ending newline => unaffected; already using strip "-" chomping.
|
||
// • Ending newline => removed then restored.
|
||
// Importantly, this keeps the "+" chomp indicator from gaining an extra line.
|
||
function writeScalar(state, string, level, iskey, inblock) {
|
||
state.dump = (function () {
|
||
if (string.length === 0) {
|
||
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
||
}
|
||
if (!state.noCompatMode) {
|
||
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
|
||
return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'");
|
||
}
|
||
}
|
||
|
||
var indent = state.indent * Math.max(1, level); // no 0-indent scalars
|
||
// As indentation gets deeper, let the width decrease monotonically
|
||
// to the lower bound min(state.lineWidth, 40).
|
||
// Note that this implies
|
||
// state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
|
||
// state.lineWidth > 40 + state.indent: width decreases until the lower bound.
|
||
// This behaves better than a constant minimum width which disallows narrower options,
|
||
// or an indent threshold which causes the width to suddenly increase.
|
||
var lineWidth = state.lineWidth === -1
|
||
? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
||
|
||
// Without knowing if keys are implicit/explicit, assume implicit for safety.
|
||
var singleLineOnly = iskey
|
||
// No block styles in flow mode.
|
||
|| (state.flowLevel > -1 && level >= state.flowLevel);
|
||
function testAmbiguity(string) {
|
||
return testImplicitResolving(state, string);
|
||
}
|
||
|
||
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth,
|
||
testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
|
||
|
||
case STYLE_PLAIN:
|
||
return string;
|
||
case STYLE_SINGLE:
|
||
return "'" + string.replace(/'/g, "''") + "'";
|
||
case STYLE_LITERAL:
|
||
return '|' + blockHeader(string, state.indent)
|
||
+ dropEndingNewline(indentString(string, indent));
|
||
case STYLE_FOLDED:
|
||
return '>' + blockHeader(string, state.indent)
|
||
+ dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
||
case STYLE_DOUBLE:
|
||
return '"' + escapeString(string, lineWidth) + '"';
|
||
default:
|
||
throw new YAMLException('impossible error: invalid scalar style');
|
||
}
|
||
}());
|
||
}
|
||
|
||
// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
|
||
function blockHeader(string, indentPerLevel) {
|
||
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
|
||
|
||
// note the special case: the string '\n' counts as a "trailing" empty line.
|
||
var clip = string[string.length - 1] === '\n';
|
||
var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
|
||
var chomp = keep ? '+' : (clip ? '' : '-');
|
||
|
||
return indentIndicator + chomp + '\n';
|
||
}
|
||
|
||
// (See the note for writeScalar.)
|
||
function dropEndingNewline(string) {
|
||
return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
|
||
}
|
||
|
||
// Note: a long line without a suitable break point will exceed the width limit.
|
||
// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
|
||
function foldString(string, width) {
|
||
// In folded style, $k$ consecutive newlines output as $k+1$ newlines—
|
||
// unless they're before or after a more-indented line, or at the very
|
||
// beginning or end, in which case $k$ maps to $k$.
|
||
// Therefore, parse each chunk as newline(s) followed by a content line.
|
||
var lineRe = /(\n+)([^\n]*)/g;
|
||
|
||
// first line (possibly an empty line)
|
||
var result = (function () {
|
||
var nextLF = string.indexOf('\n');
|
||
nextLF = nextLF !== -1 ? nextLF : string.length;
|
||
lineRe.lastIndex = nextLF;
|
||
return foldLine(string.slice(0, nextLF), width);
|
||
}());
|
||
// If we haven't reached the first content line yet, don't add an extra \n.
|
||
var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
|
||
var moreIndented;
|
||
|
||
// rest of the lines
|
||
var match;
|
||
while ((match = lineRe.exec(string))) {
|
||
var prefix = match[1], line = match[2];
|
||
moreIndented = (line[0] === ' ');
|
||
result += prefix
|
||
+ (!prevMoreIndented && !moreIndented && line !== ''
|
||
? '\n' : '')
|
||
+ foldLine(line, width);
|
||
prevMoreIndented = moreIndented;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
// Greedy line breaking.
|
||
// Picks the longest line under the limit each time,
|
||
// otherwise settles for the shortest line over the limit.
|
||
// NB. More-indented lines *cannot* be folded, as that would add an extra \n.
|
||
function foldLine(line, width) {
|
||
if (line === '' || line[0] === ' ') return line;
|
||
|
||
// Since a more-indented line adds a \n, breaks can't be followed by a space.
|
||
var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
|
||
var match;
|
||
// start is an inclusive index. end, curr, and next are exclusive.
|
||
var start = 0, end, curr = 0, next = 0;
|
||
var result = '';
|
||
|
||
// Invariants: 0 <= start <= length-1.
|
||
// 0 <= curr <= next <= max(0, length-2). curr - start <= width.
|
||
// Inside the loop:
|
||
// A match implies length >= 2, so curr and next are <= length-2.
|
||
while ((match = breakRe.exec(line))) {
|
||
next = match.index;
|
||
// maintain invariant: curr - start <= width
|
||
if (next - start > width) {
|
||
end = (curr > start) ? curr : next; // derive end <= length-2
|
||
result += '\n' + line.slice(start, end);
|
||
// skip the space that was output as \n
|
||
start = end + 1; // derive start <= length-1
|
||
}
|
||
curr = next;
|
||
}
|
||
|
||
// By the invariants, start <= length-1, so there is something left over.
|
||
// It is either the whole string or a part starting from non-whitespace.
|
||
result += '\n';
|
||
// Insert a break if the remainder is too long and there is a break available.
|
||
if (line.length - start > width && curr > start) {
|
||
result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
|
||
} else {
|
||
result += line.slice(start);
|
||
}
|
||
|
||
return result.slice(1); // drop extra \n joiner
|
||
}
|
||
|
||
// Escapes a double-quoted string.
|
||
function escapeString(string) {
|
||
var result = '';
|
||
var char = 0;
|
||
var escapeSeq;
|
||
|
||
for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
|
||
char = codePointAt(string, i);
|
||
escapeSeq = ESCAPE_SEQUENCES[char];
|
||
|
||
if (!escapeSeq && isPrintable(char)) {
|
||
result += string[i];
|
||
if (char >= 0x10000) result += string[i + 1];
|
||
} else {
|
||
result += escapeSeq || encodeHex(char);
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function writeFlowSequence(state, level, object) {
|
||
var _result = '',
|
||
_tag = state.tag,
|
||
index,
|
||
length,
|
||
value;
|
||
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
value = object[index];
|
||
|
||
if (state.replacer) {
|
||
value = state.replacer.call(object, String(index), value);
|
||
}
|
||
|
||
// Write only valid elements, put null instead of invalid elements.
|
||
if (writeNode(state, level, value, false, false) ||
|
||
(typeof value === 'undefined' &&
|
||
writeNode(state, level, null, false, false))) {
|
||
|
||
if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '');
|
||
_result += state.dump;
|
||
}
|
||
}
|
||
|
||
state.tag = _tag;
|
||
state.dump = '[' + _result + ']';
|
||
}
|
||
|
||
function writeBlockSequence(state, level, object, compact) {
|
||
var _result = '',
|
||
_tag = state.tag,
|
||
index,
|
||
length,
|
||
value;
|
||
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
value = object[index];
|
||
|
||
if (state.replacer) {
|
||
value = state.replacer.call(object, String(index), value);
|
||
}
|
||
|
||
// Write only valid elements, put null instead of invalid elements.
|
||
if (writeNode(state, level + 1, value, true, true, false, true) ||
|
||
(typeof value === 'undefined' &&
|
||
writeNode(state, level + 1, null, true, true, false, true))) {
|
||
|
||
if (!compact || _result !== '') {
|
||
_result += generateNextLine(state, level);
|
||
}
|
||
|
||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||
_result += '-';
|
||
} else {
|
||
_result += '- ';
|
||
}
|
||
|
||
_result += state.dump;
|
||
}
|
||
}
|
||
|
||
state.tag = _tag;
|
||
state.dump = _result || '[]'; // Empty sequence if no valid values.
|
||
}
|
||
|
||
function writeFlowMapping(state, level, object) {
|
||
var _result = '',
|
||
_tag = state.tag,
|
||
objectKeyList = Object.keys(object),
|
||
index,
|
||
length,
|
||
objectKey,
|
||
objectValue,
|
||
pairBuffer;
|
||
|
||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||
|
||
pairBuffer = '';
|
||
if (_result !== '') pairBuffer += ', ';
|
||
|
||
if (state.condenseFlow) pairBuffer += '"';
|
||
|
||
objectKey = objectKeyList[index];
|
||
objectValue = object[objectKey];
|
||
|
||
if (state.replacer) {
|
||
objectValue = state.replacer.call(object, objectKey, objectValue);
|
||
}
|
||
|
||
if (!writeNode(state, level, objectKey, false, false)) {
|
||
continue; // Skip this pair because of invalid key;
|
||
}
|
||
|
||
if (state.dump.length > 1024) pairBuffer += '? ';
|
||
|
||
pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
|
||
|
||
if (!writeNode(state, level, objectValue, false, false)) {
|
||
continue; // Skip this pair because of invalid value.
|
||
}
|
||
|
||
pairBuffer += state.dump;
|
||
|
||
// Both key and value are valid.
|
||
_result += pairBuffer;
|
||
}
|
||
|
||
state.tag = _tag;
|
||
state.dump = '{' + _result + '}';
|
||
}
|
||
|
||
function writeBlockMapping(state, level, object, compact) {
|
||
var _result = '',
|
||
_tag = state.tag,
|
||
objectKeyList = Object.keys(object),
|
||
index,
|
||
length,
|
||
objectKey,
|
||
objectValue,
|
||
explicitPair,
|
||
pairBuffer;
|
||
|
||
// Allow sorting keys so that the output file is deterministic
|
||
if (state.sortKeys === true) {
|
||
// Default sorting
|
||
objectKeyList.sort();
|
||
} else if (typeof state.sortKeys === 'function') {
|
||
// Custom sort function
|
||
objectKeyList.sort(state.sortKeys);
|
||
} else if (state.sortKeys) {
|
||
// Something is wrong
|
||
throw new YAMLException('sortKeys must be a boolean or a function');
|
||
}
|
||
|
||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||
pairBuffer = '';
|
||
|
||
if (!compact || _result !== '') {
|
||
pairBuffer += generateNextLine(state, level);
|
||
}
|
||
|
||
objectKey = objectKeyList[index];
|
||
objectValue = object[objectKey];
|
||
|
||
if (state.replacer) {
|
||
objectValue = state.replacer.call(object, objectKey, objectValue);
|
||
}
|
||
|
||
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
||
continue; // Skip this pair because of invalid key.
|
||
}
|
||
|
||
explicitPair = (state.tag !== null && state.tag !== '?') ||
|
||
(state.dump && state.dump.length > 1024);
|
||
|
||
if (explicitPair) {
|
||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||
pairBuffer += '?';
|
||
} else {
|
||
pairBuffer += '? ';
|
||
}
|
||
}
|
||
|
||
pairBuffer += state.dump;
|
||
|
||
if (explicitPair) {
|
||
pairBuffer += generateNextLine(state, level);
|
||
}
|
||
|
||
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
||
continue; // Skip this pair because of invalid value.
|
||
}
|
||
|
||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
||
pairBuffer += ':';
|
||
} else {
|
||
pairBuffer += ': ';
|
||
}
|
||
|
||
pairBuffer += state.dump;
|
||
|
||
// Both key and value are valid.
|
||
_result += pairBuffer;
|
||
}
|
||
|
||
state.tag = _tag;
|
||
state.dump = _result || '{}'; // Empty mapping if no valid pairs.
|
||
}
|
||
|
||
function detectType(state, object, explicit) {
|
||
var _result, typeList, index, length, type, style;
|
||
|
||
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
||
|
||
for (index = 0, length = typeList.length; index < length; index += 1) {
|
||
type = typeList[index];
|
||
|
||
if ((type.instanceOf || type.predicate) &&
|
||
(!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
|
||
(!type.predicate || type.predicate(object))) {
|
||
|
||
if (explicit) {
|
||
if (type.multi && type.representName) {
|
||
state.tag = type.representName(object);
|
||
} else {
|
||
state.tag = type.tag;
|
||
}
|
||
} else {
|
||
state.tag = '?';
|
||
}
|
||
|
||
if (type.represent) {
|
||
style = state.styleMap[type.tag] || type.defaultStyle;
|
||
|
||
if (_toString.call(type.represent) === '[object Function]') {
|
||
_result = type.represent(object, style);
|
||
} else if (_hasOwnProperty.call(type.represent, style)) {
|
||
_result = type.represent[style](object, style);
|
||
} else {
|
||
throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
|
||
}
|
||
|
||
state.dump = _result;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
// Serializes `object` and writes it to global `result`.
|
||
// Returns true on success, or false on invalid object.
|
||
//
|
||
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
|
||
state.tag = null;
|
||
state.dump = object;
|
||
|
||
if (!detectType(state, object, false)) {
|
||
detectType(state, object, true);
|
||
}
|
||
|
||
var type = _toString.call(state.dump);
|
||
var inblock = block;
|
||
var tagStr;
|
||
|
||
if (block) {
|
||
block = (state.flowLevel < 0 || state.flowLevel > level);
|
||
}
|
||
|
||
var objectOrArray = type === '[object Object]' || type === '[object Array]',
|
||
duplicateIndex,
|
||
duplicate;
|
||
|
||
if (objectOrArray) {
|
||
duplicateIndex = state.duplicates.indexOf(object);
|
||
duplicate = duplicateIndex !== -1;
|
||
}
|
||
|
||
if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
|
||
compact = false;
|
||
}
|
||
|
||
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
||
state.dump = '*ref_' + duplicateIndex;
|
||
} else {
|
||
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
||
state.usedDuplicates[duplicateIndex] = true;
|
||
}
|
||
if (type === '[object Object]') {
|
||
if (block && (Object.keys(state.dump).length !== 0)) {
|
||
writeBlockMapping(state, level, state.dump, compact);
|
||
if (duplicate) {
|
||
state.dump = '&ref_' + duplicateIndex + state.dump;
|
||
}
|
||
} else {
|
||
writeFlowMapping(state, level, state.dump);
|
||
if (duplicate) {
|
||
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
|
||
}
|
||
}
|
||
} else if (type === '[object Array]') {
|
||
if (block && (state.dump.length !== 0)) {
|
||
if (state.noArrayIndent && !isblockseq && level > 0) {
|
||
writeBlockSequence(state, level - 1, state.dump, compact);
|
||
} else {
|
||
writeBlockSequence(state, level, state.dump, compact);
|
||
}
|
||
if (duplicate) {
|
||
state.dump = '&ref_' + duplicateIndex + state.dump;
|
||
}
|
||
} else {
|
||
writeFlowSequence(state, level, state.dump);
|
||
if (duplicate) {
|
||
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
|
||
}
|
||
}
|
||
} else if (type === '[object String]') {
|
||
if (state.tag !== '?') {
|
||
writeScalar(state, state.dump, level, iskey, inblock);
|
||
}
|
||
} else if (type === '[object Undefined]') {
|
||
return false;
|
||
} else {
|
||
if (state.skipInvalid) return false;
|
||
throw new YAMLException('unacceptable kind of an object to dump ' + type);
|
||
}
|
||
|
||
if (state.tag !== null && state.tag !== '?') {
|
||
// Need to encode all characters except those allowed by the spec:
|
||
//
|
||
// [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */
|
||
// [36] ns-hex-digit ::= ns-dec-digit
|
||
// | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */
|
||
// [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */
|
||
// [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-”
|
||
// [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#”
|
||
// | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,”
|
||
// | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]”
|
||
//
|
||
// Also need to encode '!' because it has special meaning (end of tag prefix).
|
||
//
|
||
tagStr = encodeURI(
|
||
state.tag[0] === '!' ? state.tag.slice(1) : state.tag
|
||
).replace(/!/g, '%21');
|
||
|
||
if (state.tag[0] === '!') {
|
||
tagStr = '!' + tagStr;
|
||
} else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') {
|
||
tagStr = '!!' + tagStr.slice(18);
|
||
} else {
|
||
tagStr = '!<' + tagStr + '>';
|
||
}
|
||
|
||
state.dump = tagStr + ' ' + state.dump;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
function getDuplicateReferences(object, state) {
|
||
var objects = [],
|
||
duplicatesIndexes = [],
|
||
index,
|
||
length;
|
||
|
||
inspectNode(object, objects, duplicatesIndexes);
|
||
|
||
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
||
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
||
}
|
||
state.usedDuplicates = new Array(length);
|
||
}
|
||
|
||
function inspectNode(object, objects, duplicatesIndexes) {
|
||
var objectKeyList,
|
||
index,
|
||
length;
|
||
|
||
if (object !== null && typeof object === 'object') {
|
||
index = objects.indexOf(object);
|
||
if (index !== -1) {
|
||
if (duplicatesIndexes.indexOf(index) === -1) {
|
||
duplicatesIndexes.push(index);
|
||
}
|
||
} else {
|
||
objects.push(object);
|
||
|
||
if (Array.isArray(object)) {
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
inspectNode(object[index], objects, duplicatesIndexes);
|
||
}
|
||
} else {
|
||
objectKeyList = Object.keys(object);
|
||
|
||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
||
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function dump(input, options) {
|
||
options = options || {};
|
||
|
||
var state = new State(options);
|
||
|
||
if (!state.noRefs) getDuplicateReferences(input, state);
|
||
|
||
var value = input;
|
||
|
||
if (state.replacer) {
|
||
value = state.replacer.call({ '': value }, '', value);
|
||
}
|
||
|
||
if (writeNode(state, 0, value, true, true)) return state.dump + '\n';
|
||
|
||
return '';
|
||
}
|
||
|
||
module.exports.dump = dump;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8179:
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
// YAML error class. http://stackoverflow.com/questions/8458984
|
||
//
|
||
|
||
|
||
|
||
function formatError(exception, compact) {
|
||
var where = '', message = exception.reason || '(unknown reason)';
|
||
|
||
if (!exception.mark) return message;
|
||
|
||
if (exception.mark.name) {
|
||
where += 'in "' + exception.mark.name + '" ';
|
||
}
|
||
|
||
where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';
|
||
|
||
if (!compact && exception.mark.snippet) {
|
||
where += '\n\n' + exception.mark.snippet;
|
||
}
|
||
|
||
return message + ' ' + where;
|
||
}
|
||
|
||
|
||
function YAMLException(reason, mark) {
|
||
// Super constructor
|
||
Error.call(this);
|
||
|
||
this.name = 'YAMLException';
|
||
this.reason = reason;
|
||
this.mark = mark;
|
||
this.message = formatError(this, false);
|
||
|
||
// Include stack trace in error object
|
||
if (Error.captureStackTrace) {
|
||
// Chrome and NodeJS
|
||
Error.captureStackTrace(this, this.constructor);
|
||
} else {
|
||
// FF, IE 10+ and Safari 6+. Fallback for others
|
||
this.stack = (new Error()).stack || '';
|
||
}
|
||
}
|
||
|
||
|
||
// Inherit from Error
|
||
YAMLException.prototype = Object.create(Error.prototype);
|
||
YAMLException.prototype.constructor = YAMLException;
|
||
|
||
|
||
YAMLException.prototype.toString = function toString(compact) {
|
||
return this.name + ': ' + formatError(this, compact);
|
||
};
|
||
|
||
|
||
module.exports = YAMLException;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1161:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
/*eslint-disable max-len,no-use-before-define*/
|
||
|
||
var common = __nccwpck_require__(6829);
|
||
var YAMLException = __nccwpck_require__(8179);
|
||
var makeSnippet = __nccwpck_require__(6975);
|
||
var DEFAULT_SCHEMA = __nccwpck_require__(8759);
|
||
|
||
|
||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
|
||
|
||
var CONTEXT_FLOW_IN = 1;
|
||
var CONTEXT_FLOW_OUT = 2;
|
||
var CONTEXT_BLOCK_IN = 3;
|
||
var CONTEXT_BLOCK_OUT = 4;
|
||
|
||
|
||
var CHOMPING_CLIP = 1;
|
||
var CHOMPING_STRIP = 2;
|
||
var CHOMPING_KEEP = 3;
|
||
|
||
|
||
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
||
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
||
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
||
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
||
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
||
|
||
|
||
function _class(obj) { return Object.prototype.toString.call(obj); }
|
||
|
||
function is_EOL(c) {
|
||
return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
|
||
}
|
||
|
||
function is_WHITE_SPACE(c) {
|
||
return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
|
||
}
|
||
|
||
function is_WS_OR_EOL(c) {
|
||
return (c === 0x09/* Tab */) ||
|
||
(c === 0x20/* Space */) ||
|
||
(c === 0x0A/* LF */) ||
|
||
(c === 0x0D/* CR */);
|
||
}
|
||
|
||
function is_FLOW_INDICATOR(c) {
|
||
return c === 0x2C/* , */ ||
|
||
c === 0x5B/* [ */ ||
|
||
c === 0x5D/* ] */ ||
|
||
c === 0x7B/* { */ ||
|
||
c === 0x7D/* } */;
|
||
}
|
||
|
||
function fromHexCode(c) {
|
||
var lc;
|
||
|
||
if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
|
||
return c - 0x30;
|
||
}
|
||
|
||
/*eslint-disable no-bitwise*/
|
||
lc = c | 0x20;
|
||
|
||
if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
|
||
return lc - 0x61 + 10;
|
||
}
|
||
|
||
return -1;
|
||
}
|
||
|
||
function escapedHexLen(c) {
|
||
if (c === 0x78/* x */) { return 2; }
|
||
if (c === 0x75/* u */) { return 4; }
|
||
if (c === 0x55/* U */) { return 8; }
|
||
return 0;
|
||
}
|
||
|
||
function fromDecimalCode(c) {
|
||
if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
|
||
return c - 0x30;
|
||
}
|
||
|
||
return -1;
|
||
}
|
||
|
||
function simpleEscapeSequence(c) {
|
||
/* eslint-disable indent */
|
||
return (c === 0x30/* 0 */) ? '\x00' :
|
||
(c === 0x61/* a */) ? '\x07' :
|
||
(c === 0x62/* b */) ? '\x08' :
|
||
(c === 0x74/* t */) ? '\x09' :
|
||
(c === 0x09/* Tab */) ? '\x09' :
|
||
(c === 0x6E/* n */) ? '\x0A' :
|
||
(c === 0x76/* v */) ? '\x0B' :
|
||
(c === 0x66/* f */) ? '\x0C' :
|
||
(c === 0x72/* r */) ? '\x0D' :
|
||
(c === 0x65/* e */) ? '\x1B' :
|
||
(c === 0x20/* Space */) ? ' ' :
|
||
(c === 0x22/* " */) ? '\x22' :
|
||
(c === 0x2F/* / */) ? '/' :
|
||
(c === 0x5C/* \ */) ? '\x5C' :
|
||
(c === 0x4E/* N */) ? '\x85' :
|
||
(c === 0x5F/* _ */) ? '\xA0' :
|
||
(c === 0x4C/* L */) ? '\u2028' :
|
||
(c === 0x50/* P */) ? '\u2029' : '';
|
||
}
|
||
|
||
function charFromCodepoint(c) {
|
||
if (c <= 0xFFFF) {
|
||
return String.fromCharCode(c);
|
||
}
|
||
// Encode UTF-16 surrogate pair
|
||
// https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
|
||
return String.fromCharCode(
|
||
((c - 0x010000) >> 10) + 0xD800,
|
||
((c - 0x010000) & 0x03FF) + 0xDC00
|
||
);
|
||
}
|
||
|
||
var simpleEscapeCheck = new Array(256); // integer, for fast access
|
||
var simpleEscapeMap = new Array(256);
|
||
for (var i = 0; i < 256; i++) {
|
||
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
||
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
||
}
|
||
|
||
|
||
function State(input, options) {
|
||
this.input = input;
|
||
|
||
this.filename = options['filename'] || null;
|
||
this.schema = options['schema'] || DEFAULT_SCHEMA;
|
||
this.onWarning = options['onWarning'] || null;
|
||
// (Hidden) Remove? makes the loader to expect YAML 1.1 documents
|
||
// if such documents have no explicit %YAML directive
|
||
this.legacy = options['legacy'] || false;
|
||
|
||
this.json = options['json'] || false;
|
||
this.listener = options['listener'] || null;
|
||
|
||
this.implicitTypes = this.schema.compiledImplicit;
|
||
this.typeMap = this.schema.compiledTypeMap;
|
||
|
||
this.length = input.length;
|
||
this.position = 0;
|
||
this.line = 0;
|
||
this.lineStart = 0;
|
||
this.lineIndent = 0;
|
||
|
||
// position of first leading tab in the current line,
|
||
// used to make sure there are no tabs in the indentation
|
||
this.firstTabInLine = -1;
|
||
|
||
this.documents = [];
|
||
|
||
/*
|
||
this.version;
|
||
this.checkLineBreaks;
|
||
this.tagMap;
|
||
this.anchorMap;
|
||
this.tag;
|
||
this.anchor;
|
||
this.kind;
|
||
this.result;*/
|
||
|
||
}
|
||
|
||
|
||
function generateError(state, message) {
|
||
var mark = {
|
||
name: state.filename,
|
||
buffer: state.input.slice(0, -1), // omit trailing \0
|
||
position: state.position,
|
||
line: state.line,
|
||
column: state.position - state.lineStart
|
||
};
|
||
|
||
mark.snippet = makeSnippet(mark);
|
||
|
||
return new YAMLException(message, mark);
|
||
}
|
||
|
||
function throwError(state, message) {
|
||
throw generateError(state, message);
|
||
}
|
||
|
||
function throwWarning(state, message) {
|
||
if (state.onWarning) {
|
||
state.onWarning.call(null, generateError(state, message));
|
||
}
|
||
}
|
||
|
||
|
||
var directiveHandlers = {
|
||
|
||
YAML: function handleYamlDirective(state, name, args) {
|
||
|
||
var match, major, minor;
|
||
|
||
if (state.version !== null) {
|
||
throwError(state, 'duplication of %YAML directive');
|
||
}
|
||
|
||
if (args.length !== 1) {
|
||
throwError(state, 'YAML directive accepts exactly one argument');
|
||
}
|
||
|
||
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
||
|
||
if (match === null) {
|
||
throwError(state, 'ill-formed argument of the YAML directive');
|
||
}
|
||
|
||
major = parseInt(match[1], 10);
|
||
minor = parseInt(match[2], 10);
|
||
|
||
if (major !== 1) {
|
||
throwError(state, 'unacceptable YAML version of the document');
|
||
}
|
||
|
||
state.version = args[0];
|
||
state.checkLineBreaks = (minor < 2);
|
||
|
||
if (minor !== 1 && minor !== 2) {
|
||
throwWarning(state, 'unsupported YAML version of the document');
|
||
}
|
||
},
|
||
|
||
TAG: function handleTagDirective(state, name, args) {
|
||
|
||
var handle, prefix;
|
||
|
||
if (args.length !== 2) {
|
||
throwError(state, 'TAG directive accepts exactly two arguments');
|
||
}
|
||
|
||
handle = args[0];
|
||
prefix = args[1];
|
||
|
||
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
||
throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
|
||
}
|
||
|
||
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
||
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
||
}
|
||
|
||
if (!PATTERN_TAG_URI.test(prefix)) {
|
||
throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
|
||
}
|
||
|
||
try {
|
||
prefix = decodeURIComponent(prefix);
|
||
} catch (err) {
|
||
throwError(state, 'tag prefix is malformed: ' + prefix);
|
||
}
|
||
|
||
state.tagMap[handle] = prefix;
|
||
}
|
||
};
|
||
|
||
|
||
function captureSegment(state, start, end, checkJson) {
|
||
var _position, _length, _character, _result;
|
||
|
||
if (start < end) {
|
||
_result = state.input.slice(start, end);
|
||
|
||
if (checkJson) {
|
||
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
||
_character = _result.charCodeAt(_position);
|
||
if (!(_character === 0x09 ||
|
||
(0x20 <= _character && _character <= 0x10FFFF))) {
|
||
throwError(state, 'expected valid JSON character');
|
||
}
|
||
}
|
||
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
||
throwError(state, 'the stream contains non-printable characters');
|
||
}
|
||
|
||
state.result += _result;
|
||
}
|
||
}
|
||
|
||
function mergeMappings(state, destination, source, overridableKeys) {
|
||
var sourceKeys, key, index, quantity;
|
||
|
||
if (!common.isObject(source)) {
|
||
throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
|
||
}
|
||
|
||
sourceKeys = Object.keys(source);
|
||
|
||
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
||
key = sourceKeys[index];
|
||
|
||
if (!_hasOwnProperty.call(destination, key)) {
|
||
destination[key] = source[key];
|
||
overridableKeys[key] = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode,
|
||
startLine, startLineStart, startPos) {
|
||
|
||
var index, quantity;
|
||
|
||
// The output is a plain object here, so keys can only be strings.
|
||
// We need to convert keyNode to a string, but doing so can hang the process
|
||
// (deeply nested arrays that explode exponentially using aliases).
|
||
if (Array.isArray(keyNode)) {
|
||
keyNode = Array.prototype.slice.call(keyNode);
|
||
|
||
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
||
if (Array.isArray(keyNode[index])) {
|
||
throwError(state, 'nested arrays are not supported inside keys');
|
||
}
|
||
|
||
if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
|
||
keyNode[index] = '[object Object]';
|
||
}
|
||
}
|
||
}
|
||
|
||
// Avoid code execution in load() via toString property
|
||
// (still use its own toString for arrays, timestamps,
|
||
// and whatever user schema extensions happen to have @@toStringTag)
|
||
if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
|
||
keyNode = '[object Object]';
|
||
}
|
||
|
||
|
||
keyNode = String(keyNode);
|
||
|
||
if (_result === null) {
|
||
_result = {};
|
||
}
|
||
|
||
if (keyTag === 'tag:yaml.org,2002:merge') {
|
||
if (Array.isArray(valueNode)) {
|
||
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
||
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
||
}
|
||
} else {
|
||
mergeMappings(state, _result, valueNode, overridableKeys);
|
||
}
|
||
} else {
|
||
if (!state.json &&
|
||
!_hasOwnProperty.call(overridableKeys, keyNode) &&
|
||
_hasOwnProperty.call(_result, keyNode)) {
|
||
state.line = startLine || state.line;
|
||
state.lineStart = startLineStart || state.lineStart;
|
||
state.position = startPos || state.position;
|
||
throwError(state, 'duplicated mapping key');
|
||
}
|
||
|
||
// used for this specific key only because Object.defineProperty is slow
|
||
if (keyNode === '__proto__') {
|
||
Object.defineProperty(_result, keyNode, {
|
||
configurable: true,
|
||
enumerable: true,
|
||
writable: true,
|
||
value: valueNode
|
||
});
|
||
} else {
|
||
_result[keyNode] = valueNode;
|
||
}
|
||
delete overridableKeys[keyNode];
|
||
}
|
||
|
||
return _result;
|
||
}
|
||
|
||
function readLineBreak(state) {
|
||
var ch;
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (ch === 0x0A/* LF */) {
|
||
state.position++;
|
||
} else if (ch === 0x0D/* CR */) {
|
||
state.position++;
|
||
if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
|
||
state.position++;
|
||
}
|
||
} else {
|
||
throwError(state, 'a line break is expected');
|
||
}
|
||
|
||
state.line += 1;
|
||
state.lineStart = state.position;
|
||
state.firstTabInLine = -1;
|
||
}
|
||
|
||
function skipSeparationSpace(state, allowComments, checkIndent) {
|
||
var lineBreaks = 0,
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
while (ch !== 0) {
|
||
while (is_WHITE_SPACE(ch)) {
|
||
if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {
|
||
state.firstTabInLine = state.position;
|
||
}
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
|
||
if (allowComments && ch === 0x23/* # */) {
|
||
do {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
|
||
}
|
||
|
||
if (is_EOL(ch)) {
|
||
readLineBreak(state);
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
lineBreaks++;
|
||
state.lineIndent = 0;
|
||
|
||
while (ch === 0x20/* Space */) {
|
||
state.lineIndent++;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
||
throwWarning(state, 'deficient indentation');
|
||
}
|
||
|
||
return lineBreaks;
|
||
}
|
||
|
||
function testDocumentSeparator(state) {
|
||
var _position = state.position,
|
||
ch;
|
||
|
||
ch = state.input.charCodeAt(_position);
|
||
|
||
// Condition state.position === state.lineStart is tested
|
||
// in parent on each call, for efficiency. No needs to test here again.
|
||
if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
|
||
ch === state.input.charCodeAt(_position + 1) &&
|
||
ch === state.input.charCodeAt(_position + 2)) {
|
||
|
||
_position += 3;
|
||
|
||
ch = state.input.charCodeAt(_position);
|
||
|
||
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
function writeFoldedLines(state, count) {
|
||
if (count === 1) {
|
||
state.result += ' ';
|
||
} else if (count > 1) {
|
||
state.result += common.repeat('\n', count - 1);
|
||
}
|
||
}
|
||
|
||
|
||
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
||
var preceding,
|
||
following,
|
||
captureStart,
|
||
captureEnd,
|
||
hasPendingContent,
|
||
_line,
|
||
_lineStart,
|
||
_lineIndent,
|
||
_kind = state.kind,
|
||
_result = state.result,
|
||
ch;
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (is_WS_OR_EOL(ch) ||
|
||
is_FLOW_INDICATOR(ch) ||
|
||
ch === 0x23/* # */ ||
|
||
ch === 0x26/* & */ ||
|
||
ch === 0x2A/* * */ ||
|
||
ch === 0x21/* ! */ ||
|
||
ch === 0x7C/* | */ ||
|
||
ch === 0x3E/* > */ ||
|
||
ch === 0x27/* ' */ ||
|
||
ch === 0x22/* " */ ||
|
||
ch === 0x25/* % */ ||
|
||
ch === 0x40/* @ */ ||
|
||
ch === 0x60/* ` */) {
|
||
return false;
|
||
}
|
||
|
||
if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
|
||
if (is_WS_OR_EOL(following) ||
|
||
withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
state.kind = 'scalar';
|
||
state.result = '';
|
||
captureStart = captureEnd = state.position;
|
||
hasPendingContent = false;
|
||
|
||
while (ch !== 0) {
|
||
if (ch === 0x3A/* : */) {
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
|
||
if (is_WS_OR_EOL(following) ||
|
||
withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
||
break;
|
||
}
|
||
|
||
} else if (ch === 0x23/* # */) {
|
||
preceding = state.input.charCodeAt(state.position - 1);
|
||
|
||
if (is_WS_OR_EOL(preceding)) {
|
||
break;
|
||
}
|
||
|
||
} else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
|
||
withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
||
break;
|
||
|
||
} else if (is_EOL(ch)) {
|
||
_line = state.line;
|
||
_lineStart = state.lineStart;
|
||
_lineIndent = state.lineIndent;
|
||
skipSeparationSpace(state, false, -1);
|
||
|
||
if (state.lineIndent >= nodeIndent) {
|
||
hasPendingContent = true;
|
||
ch = state.input.charCodeAt(state.position);
|
||
continue;
|
||
} else {
|
||
state.position = captureEnd;
|
||
state.line = _line;
|
||
state.lineStart = _lineStart;
|
||
state.lineIndent = _lineIndent;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (hasPendingContent) {
|
||
captureSegment(state, captureStart, captureEnd, false);
|
||
writeFoldedLines(state, state.line - _line);
|
||
captureStart = captureEnd = state.position;
|
||
hasPendingContent = false;
|
||
}
|
||
|
||
if (!is_WHITE_SPACE(ch)) {
|
||
captureEnd = state.position + 1;
|
||
}
|
||
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
|
||
captureSegment(state, captureStart, captureEnd, false);
|
||
|
||
if (state.result) {
|
||
return true;
|
||
}
|
||
|
||
state.kind = _kind;
|
||
state.result = _result;
|
||
return false;
|
||
}
|
||
|
||
function readSingleQuotedScalar(state, nodeIndent) {
|
||
var ch,
|
||
captureStart, captureEnd;
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (ch !== 0x27/* ' */) {
|
||
return false;
|
||
}
|
||
|
||
state.kind = 'scalar';
|
||
state.result = '';
|
||
state.position++;
|
||
captureStart = captureEnd = state.position;
|
||
|
||
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
||
if (ch === 0x27/* ' */) {
|
||
captureSegment(state, captureStart, state.position, true);
|
||
ch = state.input.charCodeAt(++state.position);
|
||
|
||
if (ch === 0x27/* ' */) {
|
||
captureStart = state.position;
|
||
state.position++;
|
||
captureEnd = state.position;
|
||
} else {
|
||
return true;
|
||
}
|
||
|
||
} else if (is_EOL(ch)) {
|
||
captureSegment(state, captureStart, captureEnd, true);
|
||
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
||
captureStart = captureEnd = state.position;
|
||
|
||
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
||
throwError(state, 'unexpected end of the document within a single quoted scalar');
|
||
|
||
} else {
|
||
state.position++;
|
||
captureEnd = state.position;
|
||
}
|
||
}
|
||
|
||
throwError(state, 'unexpected end of the stream within a single quoted scalar');
|
||
}
|
||
|
||
function readDoubleQuotedScalar(state, nodeIndent) {
|
||
var captureStart,
|
||
captureEnd,
|
||
hexLength,
|
||
hexResult,
|
||
tmp,
|
||
ch;
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (ch !== 0x22/* " */) {
|
||
return false;
|
||
}
|
||
|
||
state.kind = 'scalar';
|
||
state.result = '';
|
||
state.position++;
|
||
captureStart = captureEnd = state.position;
|
||
|
||
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
||
if (ch === 0x22/* " */) {
|
||
captureSegment(state, captureStart, state.position, true);
|
||
state.position++;
|
||
return true;
|
||
|
||
} else if (ch === 0x5C/* \ */) {
|
||
captureSegment(state, captureStart, state.position, true);
|
||
ch = state.input.charCodeAt(++state.position);
|
||
|
||
if (is_EOL(ch)) {
|
||
skipSeparationSpace(state, false, nodeIndent);
|
||
|
||
// TODO: rework to inline fn with no type cast?
|
||
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
||
state.result += simpleEscapeMap[ch];
|
||
state.position++;
|
||
|
||
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
||
hexLength = tmp;
|
||
hexResult = 0;
|
||
|
||
for (; hexLength > 0; hexLength--) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
|
||
if ((tmp = fromHexCode(ch)) >= 0) {
|
||
hexResult = (hexResult << 4) + tmp;
|
||
|
||
} else {
|
||
throwError(state, 'expected hexadecimal character');
|
||
}
|
||
}
|
||
|
||
state.result += charFromCodepoint(hexResult);
|
||
|
||
state.position++;
|
||
|
||
} else {
|
||
throwError(state, 'unknown escape sequence');
|
||
}
|
||
|
||
captureStart = captureEnd = state.position;
|
||
|
||
} else if (is_EOL(ch)) {
|
||
captureSegment(state, captureStart, captureEnd, true);
|
||
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
||
captureStart = captureEnd = state.position;
|
||
|
||
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
||
throwError(state, 'unexpected end of the document within a double quoted scalar');
|
||
|
||
} else {
|
||
state.position++;
|
||
captureEnd = state.position;
|
||
}
|
||
}
|
||
|
||
throwError(state, 'unexpected end of the stream within a double quoted scalar');
|
||
}
|
||
|
||
function readFlowCollection(state, nodeIndent) {
|
||
var readNext = true,
|
||
_line,
|
||
_lineStart,
|
||
_pos,
|
||
_tag = state.tag,
|
||
_result,
|
||
_anchor = state.anchor,
|
||
following,
|
||
terminator,
|
||
isPair,
|
||
isExplicitPair,
|
||
isMapping,
|
||
overridableKeys = Object.create(null),
|
||
keyNode,
|
||
keyTag,
|
||
valueNode,
|
||
ch;
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (ch === 0x5B/* [ */) {
|
||
terminator = 0x5D;/* ] */
|
||
isMapping = false;
|
||
_result = [];
|
||
} else if (ch === 0x7B/* { */) {
|
||
terminator = 0x7D;/* } */
|
||
isMapping = true;
|
||
_result = {};
|
||
} else {
|
||
return false;
|
||
}
|
||
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = _result;
|
||
}
|
||
|
||
ch = state.input.charCodeAt(++state.position);
|
||
|
||
while (ch !== 0) {
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (ch === terminator) {
|
||
state.position++;
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
state.kind = isMapping ? 'mapping' : 'sequence';
|
||
state.result = _result;
|
||
return true;
|
||
} else if (!readNext) {
|
||
throwError(state, 'missed comma between flow collection entries');
|
||
} else if (ch === 0x2C/* , */) {
|
||
// "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4
|
||
throwError(state, "expected the node content, but found ','");
|
||
}
|
||
|
||
keyTag = keyNode = valueNode = null;
|
||
isPair = isExplicitPair = false;
|
||
|
||
if (ch === 0x3F/* ? */) {
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
|
||
if (is_WS_OR_EOL(following)) {
|
||
isPair = isExplicitPair = true;
|
||
state.position++;
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
}
|
||
}
|
||
|
||
_line = state.line; // Save the current line.
|
||
_lineStart = state.lineStart;
|
||
_pos = state.position;
|
||
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
||
keyTag = state.tag;
|
||
keyNode = state.result;
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
|
||
isPair = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
||
valueNode = state.result;
|
||
}
|
||
|
||
if (isMapping) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
||
} else if (isPair) {
|
||
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
||
} else {
|
||
_result.push(keyNode);
|
||
}
|
||
|
||
skipSeparationSpace(state, true, nodeIndent);
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (ch === 0x2C/* , */) {
|
||
readNext = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} else {
|
||
readNext = false;
|
||
}
|
||
}
|
||
|
||
throwError(state, 'unexpected end of the stream within a flow collection');
|
||
}
|
||
|
||
function readBlockScalar(state, nodeIndent) {
|
||
var captureStart,
|
||
folding,
|
||
chomping = CHOMPING_CLIP,
|
||
didReadContent = false,
|
||
detectedIndent = false,
|
||
textIndent = nodeIndent,
|
||
emptyLines = 0,
|
||
atMoreIndented = false,
|
||
tmp,
|
||
ch;
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (ch === 0x7C/* | */) {
|
||
folding = false;
|
||
} else if (ch === 0x3E/* > */) {
|
||
folding = true;
|
||
} else {
|
||
return false;
|
||
}
|
||
|
||
state.kind = 'scalar';
|
||
state.result = '';
|
||
|
||
while (ch !== 0) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
|
||
if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
|
||
if (CHOMPING_CLIP === chomping) {
|
||
chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
|
||
} else {
|
||
throwError(state, 'repeat of a chomping mode identifier');
|
||
}
|
||
|
||
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
||
if (tmp === 0) {
|
||
throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
|
||
} else if (!detectedIndent) {
|
||
textIndent = nodeIndent + tmp - 1;
|
||
detectedIndent = true;
|
||
} else {
|
||
throwError(state, 'repeat of an indentation width identifier');
|
||
}
|
||
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (is_WHITE_SPACE(ch)) {
|
||
do { ch = state.input.charCodeAt(++state.position); }
|
||
while (is_WHITE_SPACE(ch));
|
||
|
||
if (ch === 0x23/* # */) {
|
||
do { ch = state.input.charCodeAt(++state.position); }
|
||
while (!is_EOL(ch) && (ch !== 0));
|
||
}
|
||
}
|
||
|
||
while (ch !== 0) {
|
||
readLineBreak(state);
|
||
state.lineIndent = 0;
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
while ((!detectedIndent || state.lineIndent < textIndent) &&
|
||
(ch === 0x20/* Space */)) {
|
||
state.lineIndent++;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
|
||
if (!detectedIndent && state.lineIndent > textIndent) {
|
||
textIndent = state.lineIndent;
|
||
}
|
||
|
||
if (is_EOL(ch)) {
|
||
emptyLines++;
|
||
continue;
|
||
}
|
||
|
||
// End of the scalar.
|
||
if (state.lineIndent < textIndent) {
|
||
|
||
// Perform the chomping.
|
||
if (chomping === CHOMPING_KEEP) {
|
||
state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
|
||
} else if (chomping === CHOMPING_CLIP) {
|
||
if (didReadContent) { // i.e. only if the scalar is not empty.
|
||
state.result += '\n';
|
||
}
|
||
}
|
||
|
||
// Break this `while` cycle and go to the funciton's epilogue.
|
||
break;
|
||
}
|
||
|
||
// Folded style: use fancy rules to handle line breaks.
|
||
if (folding) {
|
||
|
||
// Lines starting with white space characters (more-indented lines) are not folded.
|
||
if (is_WHITE_SPACE(ch)) {
|
||
atMoreIndented = true;
|
||
// except for the first content line (cf. Example 8.1)
|
||
state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
|
||
|
||
// End of more-indented block.
|
||
} else if (atMoreIndented) {
|
||
atMoreIndented = false;
|
||
state.result += common.repeat('\n', emptyLines + 1);
|
||
|
||
// Just one line break - perceive as the same line.
|
||
} else if (emptyLines === 0) {
|
||
if (didReadContent) { // i.e. only if we have already read some scalar content.
|
||
state.result += ' ';
|
||
}
|
||
|
||
// Several line breaks - perceive as different lines.
|
||
} else {
|
||
state.result += common.repeat('\n', emptyLines);
|
||
}
|
||
|
||
// Literal style: just add exact number of line breaks between content lines.
|
||
} else {
|
||
// Keep all line breaks except the header line break.
|
||
state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
|
||
}
|
||
|
||
didReadContent = true;
|
||
detectedIndent = true;
|
||
emptyLines = 0;
|
||
captureStart = state.position;
|
||
|
||
while (!is_EOL(ch) && (ch !== 0)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
|
||
captureSegment(state, captureStart, state.position, false);
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
function readBlockSequence(state, nodeIndent) {
|
||
var _line,
|
||
_tag = state.tag,
|
||
_anchor = state.anchor,
|
||
_result = [],
|
||
following,
|
||
detected = false,
|
||
ch;
|
||
|
||
// there is a leading tab before this token, so it can't be a block sequence/mapping;
|
||
// it can still be flow sequence/mapping or a scalar
|
||
if (state.firstTabInLine !== -1) return false;
|
||
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = _result;
|
||
}
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
while (ch !== 0) {
|
||
if (state.firstTabInLine !== -1) {
|
||
state.position = state.firstTabInLine;
|
||
throwError(state, 'tab characters must not be used in indentation');
|
||
}
|
||
|
||
if (ch !== 0x2D/* - */) {
|
||
break;
|
||
}
|
||
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
|
||
if (!is_WS_OR_EOL(following)) {
|
||
break;
|
||
}
|
||
|
||
detected = true;
|
||
state.position++;
|
||
|
||
if (skipSeparationSpace(state, true, -1)) {
|
||
if (state.lineIndent <= nodeIndent) {
|
||
_result.push(null);
|
||
ch = state.input.charCodeAt(state.position);
|
||
continue;
|
||
}
|
||
}
|
||
|
||
_line = state.line;
|
||
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
||
_result.push(state.result);
|
||
skipSeparationSpace(state, true, -1);
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
|
||
throwError(state, 'bad indentation of a sequence entry');
|
||
} else if (state.lineIndent < nodeIndent) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (detected) {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
state.kind = 'sequence';
|
||
state.result = _result;
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
function readBlockMapping(state, nodeIndent, flowIndent) {
|
||
var following,
|
||
allowCompact,
|
||
_line,
|
||
_keyLine,
|
||
_keyLineStart,
|
||
_keyPos,
|
||
_tag = state.tag,
|
||
_anchor = state.anchor,
|
||
_result = {},
|
||
overridableKeys = Object.create(null),
|
||
keyTag = null,
|
||
keyNode = null,
|
||
valueNode = null,
|
||
atExplicitKey = false,
|
||
detected = false,
|
||
ch;
|
||
|
||
// there is a leading tab before this token, so it can't be a block sequence/mapping;
|
||
// it can still be flow sequence/mapping or a scalar
|
||
if (state.firstTabInLine !== -1) return false;
|
||
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = _result;
|
||
}
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
while (ch !== 0) {
|
||
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
||
state.position = state.firstTabInLine;
|
||
throwError(state, 'tab characters must not be used in indentation');
|
||
}
|
||
|
||
following = state.input.charCodeAt(state.position + 1);
|
||
_line = state.line; // Save the current line.
|
||
|
||
//
|
||
// Explicit notation case. There are two separate blocks:
|
||
// first for the key (denoted by "?") and second for the value (denoted by ":")
|
||
//
|
||
if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
|
||
|
||
if (ch === 0x3F/* ? */) {
|
||
if (atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
||
keyTag = keyNode = valueNode = null;
|
||
}
|
||
|
||
detected = true;
|
||
atExplicitKey = true;
|
||
allowCompact = true;
|
||
|
||
} else if (atExplicitKey) {
|
||
// i.e. 0x3A/* : */ === character after the explicit key.
|
||
atExplicitKey = false;
|
||
allowCompact = true;
|
||
|
||
} else {
|
||
throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
|
||
}
|
||
|
||
state.position += 1;
|
||
ch = following;
|
||
|
||
//
|
||
// Implicit notation case. Flow-style node as the key first, then ":", and the value.
|
||
//
|
||
} else {
|
||
_keyLine = state.line;
|
||
_keyLineStart = state.lineStart;
|
||
_keyPos = state.position;
|
||
|
||
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
||
// Neither implicit nor explicit notation.
|
||
// Reading is done. Go to the epilogue.
|
||
break;
|
||
}
|
||
|
||
if (state.line === _line) {
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
while (is_WHITE_SPACE(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
|
||
if (ch === 0x3A/* : */) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
|
||
if (!is_WS_OR_EOL(ch)) {
|
||
throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
|
||
}
|
||
|
||
if (atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
||
keyTag = keyNode = valueNode = null;
|
||
}
|
||
|
||
detected = true;
|
||
atExplicitKey = false;
|
||
allowCompact = false;
|
||
keyTag = state.tag;
|
||
keyNode = state.result;
|
||
|
||
} else if (detected) {
|
||
throwError(state, 'can not read an implicit mapping pair; a colon is missed');
|
||
|
||
} else {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
return true; // Keep the result of `composeNode`.
|
||
}
|
||
|
||
} else if (detected) {
|
||
throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
|
||
|
||
} else {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
return true; // Keep the result of `composeNode`.
|
||
}
|
||
}
|
||
|
||
//
|
||
// Common reading code for both explicit and implicit notations.
|
||
//
|
||
if (state.line === _line || state.lineIndent > nodeIndent) {
|
||
if (atExplicitKey) {
|
||
_keyLine = state.line;
|
||
_keyLineStart = state.lineStart;
|
||
_keyPos = state.position;
|
||
}
|
||
|
||
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
||
if (atExplicitKey) {
|
||
keyNode = state.result;
|
||
} else {
|
||
valueNode = state.result;
|
||
}
|
||
}
|
||
|
||
if (!atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
||
keyTag = keyNode = valueNode = null;
|
||
}
|
||
|
||
skipSeparationSpace(state, true, -1);
|
||
ch = state.input.charCodeAt(state.position);
|
||
}
|
||
|
||
if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
|
||
throwError(state, 'bad indentation of a mapping entry');
|
||
} else if (state.lineIndent < nodeIndent) {
|
||
break;
|
||
}
|
||
}
|
||
|
||
//
|
||
// Epilogue.
|
||
//
|
||
|
||
// Special case: last mapping's node contains only the key in explicit notation.
|
||
if (atExplicitKey) {
|
||
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
||
}
|
||
|
||
// Expose the resulting mapping.
|
||
if (detected) {
|
||
state.tag = _tag;
|
||
state.anchor = _anchor;
|
||
state.kind = 'mapping';
|
||
state.result = _result;
|
||
}
|
||
|
||
return detected;
|
||
}
|
||
|
||
function readTagProperty(state) {
|
||
var _position,
|
||
isVerbatim = false,
|
||
isNamed = false,
|
||
tagHandle,
|
||
tagName,
|
||
ch;
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (ch !== 0x21/* ! */) return false;
|
||
|
||
if (state.tag !== null) {
|
||
throwError(state, 'duplication of a tag property');
|
||
}
|
||
|
||
ch = state.input.charCodeAt(++state.position);
|
||
|
||
if (ch === 0x3C/* < */) {
|
||
isVerbatim = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
|
||
} else if (ch === 0x21/* ! */) {
|
||
isNamed = true;
|
||
tagHandle = '!!';
|
||
ch = state.input.charCodeAt(++state.position);
|
||
|
||
} else {
|
||
tagHandle = '!';
|
||
}
|
||
|
||
_position = state.position;
|
||
|
||
if (isVerbatim) {
|
||
do { ch = state.input.charCodeAt(++state.position); }
|
||
while (ch !== 0 && ch !== 0x3E/* > */);
|
||
|
||
if (state.position < state.length) {
|
||
tagName = state.input.slice(_position, state.position);
|
||
ch = state.input.charCodeAt(++state.position);
|
||
} else {
|
||
throwError(state, 'unexpected end of the stream within a verbatim tag');
|
||
}
|
||
} else {
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
||
|
||
if (ch === 0x21/* ! */) {
|
||
if (!isNamed) {
|
||
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
||
|
||
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
||
throwError(state, 'named tag handle cannot contain such characters');
|
||
}
|
||
|
||
isNamed = true;
|
||
_position = state.position + 1;
|
||
} else {
|
||
throwError(state, 'tag suffix cannot contain exclamation marks');
|
||
}
|
||
}
|
||
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
|
||
tagName = state.input.slice(_position, state.position);
|
||
|
||
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
||
throwError(state, 'tag suffix cannot contain flow indicator characters');
|
||
}
|
||
}
|
||
|
||
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
||
throwError(state, 'tag name cannot contain such characters: ' + tagName);
|
||
}
|
||
|
||
try {
|
||
tagName = decodeURIComponent(tagName);
|
||
} catch (err) {
|
||
throwError(state, 'tag name is malformed: ' + tagName);
|
||
}
|
||
|
||
if (isVerbatim) {
|
||
state.tag = tagName;
|
||
|
||
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
||
state.tag = state.tagMap[tagHandle] + tagName;
|
||
|
||
} else if (tagHandle === '!') {
|
||
state.tag = '!' + tagName;
|
||
|
||
} else if (tagHandle === '!!') {
|
||
state.tag = 'tag:yaml.org,2002:' + tagName;
|
||
|
||
} else {
|
||
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
function readAnchorProperty(state) {
|
||
var _position,
|
||
ch;
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (ch !== 0x26/* & */) return false;
|
||
|
||
if (state.anchor !== null) {
|
||
throwError(state, 'duplication of an anchor property');
|
||
}
|
||
|
||
ch = state.input.charCodeAt(++state.position);
|
||
_position = state.position;
|
||
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
|
||
if (state.position === _position) {
|
||
throwError(state, 'name of an anchor node must contain at least one character');
|
||
}
|
||
|
||
state.anchor = state.input.slice(_position, state.position);
|
||
return true;
|
||
}
|
||
|
||
function readAlias(state) {
|
||
var _position, alias,
|
||
ch;
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (ch !== 0x2A/* * */) return false;
|
||
|
||
ch = state.input.charCodeAt(++state.position);
|
||
_position = state.position;
|
||
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
|
||
if (state.position === _position) {
|
||
throwError(state, 'name of an alias node must contain at least one character');
|
||
}
|
||
|
||
alias = state.input.slice(_position, state.position);
|
||
|
||
if (!_hasOwnProperty.call(state.anchorMap, alias)) {
|
||
throwError(state, 'unidentified alias "' + alias + '"');
|
||
}
|
||
|
||
state.result = state.anchorMap[alias];
|
||
skipSeparationSpace(state, true, -1);
|
||
return true;
|
||
}
|
||
|
||
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
||
var allowBlockStyles,
|
||
allowBlockScalars,
|
||
allowBlockCollections,
|
||
indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
|
||
atNewLine = false,
|
||
hasContent = false,
|
||
typeIndex,
|
||
typeQuantity,
|
||
typeList,
|
||
type,
|
||
flowIndent,
|
||
blockIndent;
|
||
|
||
if (state.listener !== null) {
|
||
state.listener('open', state);
|
||
}
|
||
|
||
state.tag = null;
|
||
state.anchor = null;
|
||
state.kind = null;
|
||
state.result = null;
|
||
|
||
allowBlockStyles = allowBlockScalars = allowBlockCollections =
|
||
CONTEXT_BLOCK_OUT === nodeContext ||
|
||
CONTEXT_BLOCK_IN === nodeContext;
|
||
|
||
if (allowToSeek) {
|
||
if (skipSeparationSpace(state, true, -1)) {
|
||
atNewLine = true;
|
||
|
||
if (state.lineIndent > parentIndent) {
|
||
indentStatus = 1;
|
||
} else if (state.lineIndent === parentIndent) {
|
||
indentStatus = 0;
|
||
} else if (state.lineIndent < parentIndent) {
|
||
indentStatus = -1;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (indentStatus === 1) {
|
||
while (readTagProperty(state) || readAnchorProperty(state)) {
|
||
if (skipSeparationSpace(state, true, -1)) {
|
||
atNewLine = true;
|
||
allowBlockCollections = allowBlockStyles;
|
||
|
||
if (state.lineIndent > parentIndent) {
|
||
indentStatus = 1;
|
||
} else if (state.lineIndent === parentIndent) {
|
||
indentStatus = 0;
|
||
} else if (state.lineIndent < parentIndent) {
|
||
indentStatus = -1;
|
||
}
|
||
} else {
|
||
allowBlockCollections = false;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (allowBlockCollections) {
|
||
allowBlockCollections = atNewLine || allowCompact;
|
||
}
|
||
|
||
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
||
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
||
flowIndent = parentIndent;
|
||
} else {
|
||
flowIndent = parentIndent + 1;
|
||
}
|
||
|
||
blockIndent = state.position - state.lineStart;
|
||
|
||
if (indentStatus === 1) {
|
||
if (allowBlockCollections &&
|
||
(readBlockSequence(state, blockIndent) ||
|
||
readBlockMapping(state, blockIndent, flowIndent)) ||
|
||
readFlowCollection(state, flowIndent)) {
|
||
hasContent = true;
|
||
} else {
|
||
if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
|
||
readSingleQuotedScalar(state, flowIndent) ||
|
||
readDoubleQuotedScalar(state, flowIndent)) {
|
||
hasContent = true;
|
||
|
||
} else if (readAlias(state)) {
|
||
hasContent = true;
|
||
|
||
if (state.tag !== null || state.anchor !== null) {
|
||
throwError(state, 'alias node should not have any properties');
|
||
}
|
||
|
||
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
||
hasContent = true;
|
||
|
||
if (state.tag === null) {
|
||
state.tag = '?';
|
||
}
|
||
}
|
||
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = state.result;
|
||
}
|
||
}
|
||
} else if (indentStatus === 0) {
|
||
// Special case: block sequences are allowed to have same indentation level as the parent.
|
||
// http://www.yaml.org/spec/1.2/spec.html#id2799784
|
||
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
||
}
|
||
}
|
||
|
||
if (state.tag === null) {
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = state.result;
|
||
}
|
||
|
||
} else if (state.tag === '?') {
|
||
// Implicit resolving is not allowed for non-scalar types, and '?'
|
||
// non-specific tag is only automatically assigned to plain scalars.
|
||
//
|
||
// We only need to check kind conformity in case user explicitly assigns '?'
|
||
// tag, for example like this: "!<?> [0]"
|
||
//
|
||
if (state.result !== null && state.kind !== 'scalar') {
|
||
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
||
}
|
||
|
||
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
||
type = state.implicitTypes[typeIndex];
|
||
|
||
if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
|
||
state.result = type.construct(state.result);
|
||
state.tag = type.tag;
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = state.result;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
} else if (state.tag !== '!') {
|
||
if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
|
||
type = state.typeMap[state.kind || 'fallback'][state.tag];
|
||
} else {
|
||
// looking for multi type
|
||
type = null;
|
||
typeList = state.typeMap.multi[state.kind || 'fallback'];
|
||
|
||
for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
|
||
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
||
type = typeList[typeIndex];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (!type) {
|
||
throwError(state, 'unknown tag !<' + state.tag + '>');
|
||
}
|
||
|
||
if (state.result !== null && type.kind !== state.kind) {
|
||
throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
|
||
}
|
||
|
||
if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched
|
||
throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
|
||
} else {
|
||
state.result = type.construct(state.result, state.tag);
|
||
if (state.anchor !== null) {
|
||
state.anchorMap[state.anchor] = state.result;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (state.listener !== null) {
|
||
state.listener('close', state);
|
||
}
|
||
return state.tag !== null || state.anchor !== null || hasContent;
|
||
}
|
||
|
||
function readDocument(state) {
|
||
var documentStart = state.position,
|
||
_position,
|
||
directiveName,
|
||
directiveArgs,
|
||
hasDirectives = false,
|
||
ch;
|
||
|
||
state.version = null;
|
||
state.checkLineBreaks = state.legacy;
|
||
state.tagMap = Object.create(null);
|
||
state.anchorMap = Object.create(null);
|
||
|
||
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
||
skipSeparationSpace(state, true, -1);
|
||
|
||
ch = state.input.charCodeAt(state.position);
|
||
|
||
if (state.lineIndent > 0 || ch !== 0x25/* % */) {
|
||
break;
|
||
}
|
||
|
||
hasDirectives = true;
|
||
ch = state.input.charCodeAt(++state.position);
|
||
_position = state.position;
|
||
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
|
||
directiveName = state.input.slice(_position, state.position);
|
||
directiveArgs = [];
|
||
|
||
if (directiveName.length < 1) {
|
||
throwError(state, 'directive name must not be less than one character in length');
|
||
}
|
||
|
||
while (ch !== 0) {
|
||
while (is_WHITE_SPACE(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
|
||
if (ch === 0x23/* # */) {
|
||
do { ch = state.input.charCodeAt(++state.position); }
|
||
while (ch !== 0 && !is_EOL(ch));
|
||
break;
|
||
}
|
||
|
||
if (is_EOL(ch)) break;
|
||
|
||
_position = state.position;
|
||
|
||
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
||
ch = state.input.charCodeAt(++state.position);
|
||
}
|
||
|
||
directiveArgs.push(state.input.slice(_position, state.position));
|
||
}
|
||
|
||
if (ch !== 0) readLineBreak(state);
|
||
|
||
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
|
||
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
||
} else {
|
||
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
||
}
|
||
}
|
||
|
||
skipSeparationSpace(state, true, -1);
|
||
|
||
if (state.lineIndent === 0 &&
|
||
state.input.charCodeAt(state.position) === 0x2D/* - */ &&
|
||
state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
|
||
state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
|
||
state.position += 3;
|
||
skipSeparationSpace(state, true, -1);
|
||
|
||
} else if (hasDirectives) {
|
||
throwError(state, 'directives end mark is expected');
|
||
}
|
||
|
||
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
||
skipSeparationSpace(state, true, -1);
|
||
|
||
if (state.checkLineBreaks &&
|
||
PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
||
throwWarning(state, 'non-ASCII line breaks are interpreted as content');
|
||
}
|
||
|
||
state.documents.push(state.result);
|
||
|
||
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
||
|
||
if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
|
||
state.position += 3;
|
||
skipSeparationSpace(state, true, -1);
|
||
}
|
||
return;
|
||
}
|
||
|
||
if (state.position < (state.length - 1)) {
|
||
throwError(state, 'end of the stream or a document separator is expected');
|
||
} else {
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
function loadDocuments(input, options) {
|
||
input = String(input);
|
||
options = options || {};
|
||
|
||
if (input.length !== 0) {
|
||
|
||
// Add tailing `\n` if not exists
|
||
if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
|
||
input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
|
||
input += '\n';
|
||
}
|
||
|
||
// Strip BOM
|
||
if (input.charCodeAt(0) === 0xFEFF) {
|
||
input = input.slice(1);
|
||
}
|
||
}
|
||
|
||
var state = new State(input, options);
|
||
|
||
var nullpos = input.indexOf('\0');
|
||
|
||
if (nullpos !== -1) {
|
||
state.position = nullpos;
|
||
throwError(state, 'null byte is not allowed in input');
|
||
}
|
||
|
||
// Use 0 as string terminator. That significantly simplifies bounds check.
|
||
state.input += '\0';
|
||
|
||
while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
|
||
state.lineIndent += 1;
|
||
state.position += 1;
|
||
}
|
||
|
||
while (state.position < (state.length - 1)) {
|
||
readDocument(state);
|
||
}
|
||
|
||
return state.documents;
|
||
}
|
||
|
||
|
||
function loadAll(input, iterator, options) {
|
||
if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
|
||
options = iterator;
|
||
iterator = null;
|
||
}
|
||
|
||
var documents = loadDocuments(input, options);
|
||
|
||
if (typeof iterator !== 'function') {
|
||
return documents;
|
||
}
|
||
|
||
for (var index = 0, length = documents.length; index < length; index += 1) {
|
||
iterator(documents[index]);
|
||
}
|
||
}
|
||
|
||
|
||
function load(input, options) {
|
||
var documents = loadDocuments(input, options);
|
||
|
||
if (documents.length === 0) {
|
||
/*eslint-disable no-undefined*/
|
||
return undefined;
|
||
} else if (documents.length === 1) {
|
||
return documents[0];
|
||
}
|
||
throw new YAMLException('expected a single document in the stream, but found more');
|
||
}
|
||
|
||
|
||
module.exports.loadAll = loadAll;
|
||
module.exports.load = load;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1082:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
/*eslint-disable max-len*/
|
||
|
||
var YAMLException = __nccwpck_require__(8179);
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
|
||
function compileList(schema, name, result) {
|
||
var exclude = [];
|
||
|
||
schema[name].forEach(function (currentType) {
|
||
result.forEach(function (previousType, previousIndex) {
|
||
if (previousType.tag === currentType.tag &&
|
||
previousType.kind === currentType.kind &&
|
||
previousType.multi === currentType.multi) {
|
||
|
||
exclude.push(previousIndex);
|
||
}
|
||
});
|
||
|
||
result.push(currentType);
|
||
});
|
||
|
||
return result.filter(function (type, index) {
|
||
return exclude.indexOf(index) === -1;
|
||
});
|
||
}
|
||
|
||
|
||
function compileMap(/* lists... */) {
|
||
var result = {
|
||
scalar: {},
|
||
sequence: {},
|
||
mapping: {},
|
||
fallback: {},
|
||
multi: {
|
||
scalar: [],
|
||
sequence: [],
|
||
mapping: [],
|
||
fallback: []
|
||
}
|
||
}, index, length;
|
||
|
||
function collectType(type) {
|
||
if (type.multi) {
|
||
result.multi[type.kind].push(type);
|
||
result.multi['fallback'].push(type);
|
||
} else {
|
||
result[type.kind][type.tag] = result['fallback'][type.tag] = type;
|
||
}
|
||
}
|
||
|
||
for (index = 0, length = arguments.length; index < length; index += 1) {
|
||
arguments[index].forEach(collectType);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
|
||
function Schema(definition) {
|
||
return this.extend(definition);
|
||
}
|
||
|
||
|
||
Schema.prototype.extend = function extend(definition) {
|
||
var implicit = [];
|
||
var explicit = [];
|
||
|
||
if (definition instanceof Type) {
|
||
// Schema.extend(type)
|
||
explicit.push(definition);
|
||
|
||
} else if (Array.isArray(definition)) {
|
||
// Schema.extend([ type1, type2, ... ])
|
||
explicit = explicit.concat(definition);
|
||
|
||
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
||
// Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })
|
||
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
||
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
||
|
||
} else {
|
||
throw new YAMLException('Schema.extend argument should be a Type, [ Type ], ' +
|
||
'or a schema definition ({ implicit: [...], explicit: [...] })');
|
||
}
|
||
|
||
implicit.forEach(function (type) {
|
||
if (!(type instanceof Type)) {
|
||
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
|
||
}
|
||
|
||
if (type.loadKind && type.loadKind !== 'scalar') {
|
||
throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
|
||
}
|
||
|
||
if (type.multi) {
|
||
throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');
|
||
}
|
||
});
|
||
|
||
explicit.forEach(function (type) {
|
||
if (!(type instanceof Type)) {
|
||
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
|
||
}
|
||
});
|
||
|
||
var result = Object.create(Schema.prototype);
|
||
|
||
result.implicit = (this.implicit || []).concat(implicit);
|
||
result.explicit = (this.explicit || []).concat(explicit);
|
||
|
||
result.compiledImplicit = compileList(result, 'implicit', []);
|
||
result.compiledExplicit = compileList(result, 'explicit', []);
|
||
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
||
|
||
return result;
|
||
};
|
||
|
||
|
||
module.exports = Schema;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2011:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
// Standard YAML's Core schema.
|
||
// http://www.yaml.org/spec/1.2/spec.html#id2804923
|
||
//
|
||
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
||
// So, Core schema has no distinctions from JSON schema is JS-YAML.
|
||
|
||
|
||
|
||
|
||
|
||
module.exports = __nccwpck_require__(1035);
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8759:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
// JS-YAML's default schema for `safeLoad` function.
|
||
// It is not described in the YAML specification.
|
||
//
|
||
// This schema is based on standard YAML's Core schema and includes most of
|
||
// extra types described at YAML tag repository. (http://yaml.org/type/)
|
||
|
||
|
||
|
||
|
||
|
||
module.exports = __nccwpck_require__(2011).extend({
|
||
implicit: [
|
||
__nccwpck_require__(9212),
|
||
__nccwpck_require__(6104)
|
||
],
|
||
explicit: [
|
||
__nccwpck_require__(7900),
|
||
__nccwpck_require__(9046),
|
||
__nccwpck_require__(6860),
|
||
__nccwpck_require__(9548)
|
||
]
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8562:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
// Standard YAML's Failsafe schema.
|
||
// http://www.yaml.org/spec/1.2/spec.html#id2802346
|
||
|
||
|
||
|
||
|
||
|
||
var Schema = __nccwpck_require__(1082);
|
||
|
||
|
||
module.exports = new Schema({
|
||
explicit: [
|
||
__nccwpck_require__(3619),
|
||
__nccwpck_require__(7283),
|
||
__nccwpck_require__(6150)
|
||
]
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1035:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
// Standard YAML's JSON schema.
|
||
// http://www.yaml.org/spec/1.2/spec.html#id2803231
|
||
//
|
||
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
||
// So, this schema is not such strict as defined in the YAML specification.
|
||
// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
|
||
|
||
|
||
|
||
|
||
|
||
module.exports = __nccwpck_require__(8562).extend({
|
||
implicit: [
|
||
__nccwpck_require__(721),
|
||
__nccwpck_require__(4993),
|
||
__nccwpck_require__(1615),
|
||
__nccwpck_require__(2705)
|
||
]
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6975:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
|
||
var common = __nccwpck_require__(6829);
|
||
|
||
|
||
// get snippet for a single line, respecting maxLength
|
||
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
||
var head = '';
|
||
var tail = '';
|
||
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
||
|
||
if (position - lineStart > maxHalfLength) {
|
||
head = ' ... ';
|
||
lineStart = position - maxHalfLength + head.length;
|
||
}
|
||
|
||
if (lineEnd - position > maxHalfLength) {
|
||
tail = ' ...';
|
||
lineEnd = position + maxHalfLength - tail.length;
|
||
}
|
||
|
||
return {
|
||
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail,
|
||
pos: position - lineStart + head.length // relative position
|
||
};
|
||
}
|
||
|
||
|
||
function padStart(string, max) {
|
||
return common.repeat(' ', max - string.length) + string;
|
||
}
|
||
|
||
|
||
function makeSnippet(mark, options) {
|
||
options = Object.create(options || null);
|
||
|
||
if (!mark.buffer) return null;
|
||
|
||
if (!options.maxLength) options.maxLength = 79;
|
||
if (typeof options.indent !== 'number') options.indent = 1;
|
||
if (typeof options.linesBefore !== 'number') options.linesBefore = 3;
|
||
if (typeof options.linesAfter !== 'number') options.linesAfter = 2;
|
||
|
||
var re = /\r?\n|\r|\0/g;
|
||
var lineStarts = [ 0 ];
|
||
var lineEnds = [];
|
||
var match;
|
||
var foundLineNo = -1;
|
||
|
||
while ((match = re.exec(mark.buffer))) {
|
||
lineEnds.push(match.index);
|
||
lineStarts.push(match.index + match[0].length);
|
||
|
||
if (mark.position <= match.index && foundLineNo < 0) {
|
||
foundLineNo = lineStarts.length - 2;
|
||
}
|
||
}
|
||
|
||
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
||
|
||
var result = '', i, line;
|
||
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
||
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
||
|
||
for (i = 1; i <= options.linesBefore; i++) {
|
||
if (foundLineNo - i < 0) break;
|
||
line = getLine(
|
||
mark.buffer,
|
||
lineStarts[foundLineNo - i],
|
||
lineEnds[foundLineNo - i],
|
||
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
||
maxLineLength
|
||
);
|
||
result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +
|
||
' | ' + line.str + '\n' + result;
|
||
}
|
||
|
||
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
||
result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +
|
||
' | ' + line.str + '\n';
|
||
result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n';
|
||
|
||
for (i = 1; i <= options.linesAfter; i++) {
|
||
if (foundLineNo + i >= lineEnds.length) break;
|
||
line = getLine(
|
||
mark.buffer,
|
||
lineStarts[foundLineNo + i],
|
||
lineEnds[foundLineNo + i],
|
||
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
||
maxLineLength
|
||
);
|
||
result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +
|
||
' | ' + line.str + '\n';
|
||
}
|
||
|
||
return result.replace(/\n$/, '');
|
||
}
|
||
|
||
|
||
module.exports = makeSnippet;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6073:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var YAMLException = __nccwpck_require__(8179);
|
||
|
||
var TYPE_CONSTRUCTOR_OPTIONS = [
|
||
'kind',
|
||
'multi',
|
||
'resolve',
|
||
'construct',
|
||
'instanceOf',
|
||
'predicate',
|
||
'represent',
|
||
'representName',
|
||
'defaultStyle',
|
||
'styleAliases'
|
||
];
|
||
|
||
var YAML_NODE_KINDS = [
|
||
'scalar',
|
||
'sequence',
|
||
'mapping'
|
||
];
|
||
|
||
function compileStyleAliases(map) {
|
||
var result = {};
|
||
|
||
if (map !== null) {
|
||
Object.keys(map).forEach(function (style) {
|
||
map[style].forEach(function (alias) {
|
||
result[String(alias)] = style;
|
||
});
|
||
});
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function Type(tag, options) {
|
||
options = options || {};
|
||
|
||
Object.keys(options).forEach(function (name) {
|
||
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
||
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
||
}
|
||
});
|
||
|
||
// TODO: Add tag format check.
|
||
this.tag = tag;
|
||
this.kind = options['kind'] || null;
|
||
this.resolve = options['resolve'] || function () { return true; };
|
||
this.construct = options['construct'] || function (data) { return data; };
|
||
this.instanceOf = options['instanceOf'] || null;
|
||
this.predicate = options['predicate'] || null;
|
||
this.represent = options['represent'] || null;
|
||
this.representName = options['representName'] || null;
|
||
this.defaultStyle = options['defaultStyle'] || null;
|
||
this.multi = options['multi'] || false;
|
||
this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
|
||
|
||
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
||
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
||
}
|
||
}
|
||
|
||
module.exports = Type;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 7900:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
/*eslint-disable no-bitwise*/
|
||
|
||
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
|
||
// [ 64, 65, 66 ] -> [ padding, CR, LF ]
|
||
var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
|
||
|
||
|
||
function resolveYamlBinary(data) {
|
||
if (data === null) return false;
|
||
|
||
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
|
||
|
||
// Convert one by one.
|
||
for (idx = 0; idx < max; idx++) {
|
||
code = map.indexOf(data.charAt(idx));
|
||
|
||
// Skip CR/LF
|
||
if (code > 64) continue;
|
||
|
||
// Fail on illegal characters
|
||
if (code < 0) return false;
|
||
|
||
bitlen += 6;
|
||
}
|
||
|
||
// If there are any bits left, source was corrupted
|
||
return (bitlen % 8) === 0;
|
||
}
|
||
|
||
function constructYamlBinary(data) {
|
||
var idx, tailbits,
|
||
input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
|
||
max = input.length,
|
||
map = BASE64_MAP,
|
||
bits = 0,
|
||
result = [];
|
||
|
||
// Collect by 6*4 bits (3 bytes)
|
||
|
||
for (idx = 0; idx < max; idx++) {
|
||
if ((idx % 4 === 0) && idx) {
|
||
result.push((bits >> 16) & 0xFF);
|
||
result.push((bits >> 8) & 0xFF);
|
||
result.push(bits & 0xFF);
|
||
}
|
||
|
||
bits = (bits << 6) | map.indexOf(input.charAt(idx));
|
||
}
|
||
|
||
// Dump tail
|
||
|
||
tailbits = (max % 4) * 6;
|
||
|
||
if (tailbits === 0) {
|
||
result.push((bits >> 16) & 0xFF);
|
||
result.push((bits >> 8) & 0xFF);
|
||
result.push(bits & 0xFF);
|
||
} else if (tailbits === 18) {
|
||
result.push((bits >> 10) & 0xFF);
|
||
result.push((bits >> 2) & 0xFF);
|
||
} else if (tailbits === 12) {
|
||
result.push((bits >> 4) & 0xFF);
|
||
}
|
||
|
||
return new Uint8Array(result);
|
||
}
|
||
|
||
function representYamlBinary(object /*, style*/) {
|
||
var result = '', bits = 0, idx, tail,
|
||
max = object.length,
|
||
map = BASE64_MAP;
|
||
|
||
// Convert every three bytes to 4 ASCII characters.
|
||
|
||
for (idx = 0; idx < max; idx++) {
|
||
if ((idx % 3 === 0) && idx) {
|
||
result += map[(bits >> 18) & 0x3F];
|
||
result += map[(bits >> 12) & 0x3F];
|
||
result += map[(bits >> 6) & 0x3F];
|
||
result += map[bits & 0x3F];
|
||
}
|
||
|
||
bits = (bits << 8) + object[idx];
|
||
}
|
||
|
||
// Dump tail
|
||
|
||
tail = max % 3;
|
||
|
||
if (tail === 0) {
|
||
result += map[(bits >> 18) & 0x3F];
|
||
result += map[(bits >> 12) & 0x3F];
|
||
result += map[(bits >> 6) & 0x3F];
|
||
result += map[bits & 0x3F];
|
||
} else if (tail === 2) {
|
||
result += map[(bits >> 10) & 0x3F];
|
||
result += map[(bits >> 4) & 0x3F];
|
||
result += map[(bits << 2) & 0x3F];
|
||
result += map[64];
|
||
} else if (tail === 1) {
|
||
result += map[(bits >> 2) & 0x3F];
|
||
result += map[(bits << 4) & 0x3F];
|
||
result += map[64];
|
||
result += map[64];
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
function isBinary(obj) {
|
||
return Object.prototype.toString.call(obj) === '[object Uint8Array]';
|
||
}
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:binary', {
|
||
kind: 'scalar',
|
||
resolve: resolveYamlBinary,
|
||
construct: constructYamlBinary,
|
||
predicate: isBinary,
|
||
represent: representYamlBinary
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4993:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
function resolveYamlBoolean(data) {
|
||
if (data === null) return false;
|
||
|
||
var max = data.length;
|
||
|
||
return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
|
||
(max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
|
||
}
|
||
|
||
function constructYamlBoolean(data) {
|
||
return data === 'true' ||
|
||
data === 'True' ||
|
||
data === 'TRUE';
|
||
}
|
||
|
||
function isBoolean(object) {
|
||
return Object.prototype.toString.call(object) === '[object Boolean]';
|
||
}
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:bool', {
|
||
kind: 'scalar',
|
||
resolve: resolveYamlBoolean,
|
||
construct: constructYamlBoolean,
|
||
predicate: isBoolean,
|
||
represent: {
|
||
lowercase: function (object) { return object ? 'true' : 'false'; },
|
||
uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
|
||
camelcase: function (object) { return object ? 'True' : 'False'; }
|
||
},
|
||
defaultStyle: 'lowercase'
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2705:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var common = __nccwpck_require__(6829);
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
var YAML_FLOAT_PATTERN = new RegExp(
|
||
// 2.5e4, 2.5 and integers
|
||
'^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
|
||
// .2e4, .2
|
||
// special case, seems not from spec
|
||
'|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
|
||
// .inf
|
||
'|[-+]?\\.(?:inf|Inf|INF)' +
|
||
// .nan
|
||
'|\\.(?:nan|NaN|NAN))$');
|
||
|
||
function resolveYamlFloat(data) {
|
||
if (data === null) return false;
|
||
|
||
if (!YAML_FLOAT_PATTERN.test(data) ||
|
||
// Quick hack to not allow integers end with `_`
|
||
// Probably should update regexp & check speed
|
||
data[data.length - 1] === '_') {
|
||
return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
function constructYamlFloat(data) {
|
||
var value, sign;
|
||
|
||
value = data.replace(/_/g, '').toLowerCase();
|
||
sign = value[0] === '-' ? -1 : 1;
|
||
|
||
if ('+-'.indexOf(value[0]) >= 0) {
|
||
value = value.slice(1);
|
||
}
|
||
|
||
if (value === '.inf') {
|
||
return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
||
|
||
} else if (value === '.nan') {
|
||
return NaN;
|
||
}
|
||
return sign * parseFloat(value, 10);
|
||
}
|
||
|
||
|
||
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
||
|
||
function representYamlFloat(object, style) {
|
||
var res;
|
||
|
||
if (isNaN(object)) {
|
||
switch (style) {
|
||
case 'lowercase': return '.nan';
|
||
case 'uppercase': return '.NAN';
|
||
case 'camelcase': return '.NaN';
|
||
}
|
||
} else if (Number.POSITIVE_INFINITY === object) {
|
||
switch (style) {
|
||
case 'lowercase': return '.inf';
|
||
case 'uppercase': return '.INF';
|
||
case 'camelcase': return '.Inf';
|
||
}
|
||
} else if (Number.NEGATIVE_INFINITY === object) {
|
||
switch (style) {
|
||
case 'lowercase': return '-.inf';
|
||
case 'uppercase': return '-.INF';
|
||
case 'camelcase': return '-.Inf';
|
||
}
|
||
} else if (common.isNegativeZero(object)) {
|
||
return '-0.0';
|
||
}
|
||
|
||
res = object.toString(10);
|
||
|
||
// JS stringifier can build scientific format without dots: 5e-100,
|
||
// while YAML requres dot: 5.e-100. Fix it with simple hack
|
||
|
||
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
|
||
}
|
||
|
||
function isFloat(object) {
|
||
return (Object.prototype.toString.call(object) === '[object Number]') &&
|
||
(object % 1 !== 0 || common.isNegativeZero(object));
|
||
}
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:float', {
|
||
kind: 'scalar',
|
||
resolve: resolveYamlFloat,
|
||
construct: constructYamlFloat,
|
||
predicate: isFloat,
|
||
represent: representYamlFloat,
|
||
defaultStyle: 'lowercase'
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1615:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var common = __nccwpck_require__(6829);
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
function isHexCode(c) {
|
||
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
|
||
((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
|
||
((0x61/* a */ <= c) && (c <= 0x66/* f */));
|
||
}
|
||
|
||
function isOctCode(c) {
|
||
return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
|
||
}
|
||
|
||
function isDecCode(c) {
|
||
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
|
||
}
|
||
|
||
function resolveYamlInteger(data) {
|
||
if (data === null) return false;
|
||
|
||
var max = data.length,
|
||
index = 0,
|
||
hasDigits = false,
|
||
ch;
|
||
|
||
if (!max) return false;
|
||
|
||
ch = data[index];
|
||
|
||
// sign
|
||
if (ch === '-' || ch === '+') {
|
||
ch = data[++index];
|
||
}
|
||
|
||
if (ch === '0') {
|
||
// 0
|
||
if (index + 1 === max) return true;
|
||
ch = data[++index];
|
||
|
||
// base 2, base 8, base 16
|
||
|
||
if (ch === 'b') {
|
||
// base 2
|
||
index++;
|
||
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === '_') continue;
|
||
if (ch !== '0' && ch !== '1') return false;
|
||
hasDigits = true;
|
||
}
|
||
return hasDigits && ch !== '_';
|
||
}
|
||
|
||
|
||
if (ch === 'x') {
|
||
// base 16
|
||
index++;
|
||
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === '_') continue;
|
||
if (!isHexCode(data.charCodeAt(index))) return false;
|
||
hasDigits = true;
|
||
}
|
||
return hasDigits && ch !== '_';
|
||
}
|
||
|
||
|
||
if (ch === 'o') {
|
||
// base 8
|
||
index++;
|
||
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === '_') continue;
|
||
if (!isOctCode(data.charCodeAt(index))) return false;
|
||
hasDigits = true;
|
||
}
|
||
return hasDigits && ch !== '_';
|
||
}
|
||
}
|
||
|
||
// base 10 (except 0)
|
||
|
||
// value should not start with `_`;
|
||
if (ch === '_') return false;
|
||
|
||
for (; index < max; index++) {
|
||
ch = data[index];
|
||
if (ch === '_') continue;
|
||
if (!isDecCode(data.charCodeAt(index))) {
|
||
return false;
|
||
}
|
||
hasDigits = true;
|
||
}
|
||
|
||
// Should have digits and should not end with `_`
|
||
if (!hasDigits || ch === '_') return false;
|
||
|
||
return true;
|
||
}
|
||
|
||
function constructYamlInteger(data) {
|
||
var value = data, sign = 1, ch;
|
||
|
||
if (value.indexOf('_') !== -1) {
|
||
value = value.replace(/_/g, '');
|
||
}
|
||
|
||
ch = value[0];
|
||
|
||
if (ch === '-' || ch === '+') {
|
||
if (ch === '-') sign = -1;
|
||
value = value.slice(1);
|
||
ch = value[0];
|
||
}
|
||
|
||
if (value === '0') return 0;
|
||
|
||
if (ch === '0') {
|
||
if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
|
||
if (value[1] === 'x') return sign * parseInt(value.slice(2), 16);
|
||
if (value[1] === 'o') return sign * parseInt(value.slice(2), 8);
|
||
}
|
||
|
||
return sign * parseInt(value, 10);
|
||
}
|
||
|
||
function isInteger(object) {
|
||
return (Object.prototype.toString.call(object)) === '[object Number]' &&
|
||
(object % 1 === 0 && !common.isNegativeZero(object));
|
||
}
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:int', {
|
||
kind: 'scalar',
|
||
resolve: resolveYamlInteger,
|
||
construct: constructYamlInteger,
|
||
predicate: isInteger,
|
||
represent: {
|
||
binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
|
||
octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); },
|
||
decimal: function (obj) { return obj.toString(10); },
|
||
/* eslint-disable max-len */
|
||
hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
|
||
},
|
||
defaultStyle: 'decimal',
|
||
styleAliases: {
|
||
binary: [ 2, 'bin' ],
|
||
octal: [ 8, 'oct' ],
|
||
decimal: [ 10, 'dec' ],
|
||
hexadecimal: [ 16, 'hex' ]
|
||
}
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6150:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:map', {
|
||
kind: 'mapping',
|
||
construct: function (data) { return data !== null ? data : {}; }
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6104:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
function resolveYamlMerge(data) {
|
||
return data === '<<' || data === null;
|
||
}
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:merge', {
|
||
kind: 'scalar',
|
||
resolve: resolveYamlMerge
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 721:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
function resolveYamlNull(data) {
|
||
if (data === null) return true;
|
||
|
||
var max = data.length;
|
||
|
||
return (max === 1 && data === '~') ||
|
||
(max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
|
||
}
|
||
|
||
function constructYamlNull() {
|
||
return null;
|
||
}
|
||
|
||
function isNull(object) {
|
||
return object === null;
|
||
}
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:null', {
|
||
kind: 'scalar',
|
||
resolve: resolveYamlNull,
|
||
construct: constructYamlNull,
|
||
predicate: isNull,
|
||
represent: {
|
||
canonical: function () { return '~'; },
|
||
lowercase: function () { return 'null'; },
|
||
uppercase: function () { return 'NULL'; },
|
||
camelcase: function () { return 'Null'; },
|
||
empty: function () { return ''; }
|
||
},
|
||
defaultStyle: 'lowercase'
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9046:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
var _toString = Object.prototype.toString;
|
||
|
||
function resolveYamlOmap(data) {
|
||
if (data === null) return true;
|
||
|
||
var objectKeys = [], index, length, pair, pairKey, pairHasKey,
|
||
object = data;
|
||
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
pair = object[index];
|
||
pairHasKey = false;
|
||
|
||
if (_toString.call(pair) !== '[object Object]') return false;
|
||
|
||
for (pairKey in pair) {
|
||
if (_hasOwnProperty.call(pair, pairKey)) {
|
||
if (!pairHasKey) pairHasKey = true;
|
||
else return false;
|
||
}
|
||
}
|
||
|
||
if (!pairHasKey) return false;
|
||
|
||
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
||
else return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
function constructYamlOmap(data) {
|
||
return data !== null ? data : [];
|
||
}
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:omap', {
|
||
kind: 'sequence',
|
||
resolve: resolveYamlOmap,
|
||
construct: constructYamlOmap
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6860:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
var _toString = Object.prototype.toString;
|
||
|
||
function resolveYamlPairs(data) {
|
||
if (data === null) return true;
|
||
|
||
var index, length, pair, keys, result,
|
||
object = data;
|
||
|
||
result = new Array(object.length);
|
||
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
pair = object[index];
|
||
|
||
if (_toString.call(pair) !== '[object Object]') return false;
|
||
|
||
keys = Object.keys(pair);
|
||
|
||
if (keys.length !== 1) return false;
|
||
|
||
result[index] = [ keys[0], pair[keys[0]] ];
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
function constructYamlPairs(data) {
|
||
if (data === null) return [];
|
||
|
||
var index, length, pair, keys, result,
|
||
object = data;
|
||
|
||
result = new Array(object.length);
|
||
|
||
for (index = 0, length = object.length; index < length; index += 1) {
|
||
pair = object[index];
|
||
|
||
keys = Object.keys(pair);
|
||
|
||
result[index] = [ keys[0], pair[keys[0]] ];
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:pairs', {
|
||
kind: 'sequence',
|
||
resolve: resolveYamlPairs,
|
||
construct: constructYamlPairs
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 7283:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:seq', {
|
||
kind: 'sequence',
|
||
construct: function (data) { return data !== null ? data : []; }
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9548:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
||
|
||
function resolveYamlSet(data) {
|
||
if (data === null) return true;
|
||
|
||
var key, object = data;
|
||
|
||
for (key in object) {
|
||
if (_hasOwnProperty.call(object, key)) {
|
||
if (object[key] !== null) return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
function constructYamlSet(data) {
|
||
return data !== null ? data : {};
|
||
}
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:set', {
|
||
kind: 'mapping',
|
||
resolve: resolveYamlSet,
|
||
construct: constructYamlSet
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3619:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:str', {
|
||
kind: 'scalar',
|
||
construct: function (data) { return data !== null ? data : ''; }
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9212:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var Type = __nccwpck_require__(6073);
|
||
|
||
var YAML_DATE_REGEXP = new RegExp(
|
||
'^([0-9][0-9][0-9][0-9])' + // [1] year
|
||
'-([0-9][0-9])' + // [2] month
|
||
'-([0-9][0-9])$'); // [3] day
|
||
|
||
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
||
'^([0-9][0-9][0-9][0-9])' + // [1] year
|
||
'-([0-9][0-9]?)' + // [2] month
|
||
'-([0-9][0-9]?)' + // [3] day
|
||
'(?:[Tt]|[ \\t]+)' + // ...
|
||
'([0-9][0-9]?)' + // [4] hour
|
||
':([0-9][0-9])' + // [5] minute
|
||
':([0-9][0-9])' + // [6] second
|
||
'(?:\\.([0-9]*))?' + // [7] fraction
|
||
'(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
|
||
'(?::([0-9][0-9]))?))?$'); // [11] tz_minute
|
||
|
||
function resolveYamlTimestamp(data) {
|
||
if (data === null) return false;
|
||
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
||
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
||
return false;
|
||
}
|
||
|
||
function constructYamlTimestamp(data) {
|
||
var match, year, month, day, hour, minute, second, fraction = 0,
|
||
delta = null, tz_hour, tz_minute, date;
|
||
|
||
match = YAML_DATE_REGEXP.exec(data);
|
||
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
||
|
||
if (match === null) throw new Error('Date resolve error');
|
||
|
||
// match: [1] year [2] month [3] day
|
||
|
||
year = +(match[1]);
|
||
month = +(match[2]) - 1; // JS month starts with 0
|
||
day = +(match[3]);
|
||
|
||
if (!match[4]) { // no hour
|
||
return new Date(Date.UTC(year, month, day));
|
||
}
|
||
|
||
// match: [4] hour [5] minute [6] second [7] fraction
|
||
|
||
hour = +(match[4]);
|
||
minute = +(match[5]);
|
||
second = +(match[6]);
|
||
|
||
if (match[7]) {
|
||
fraction = match[7].slice(0, 3);
|
||
while (fraction.length < 3) { // milli-seconds
|
||
fraction += '0';
|
||
}
|
||
fraction = +fraction;
|
||
}
|
||
|
||
// match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
|
||
|
||
if (match[9]) {
|
||
tz_hour = +(match[10]);
|
||
tz_minute = +(match[11] || 0);
|
||
delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
|
||
if (match[9] === '-') delta = -delta;
|
||
}
|
||
|
||
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
||
|
||
if (delta) date.setTime(date.getTime() - delta);
|
||
|
||
return date;
|
||
}
|
||
|
||
function representYamlTimestamp(object /*, style*/) {
|
||
return object.toISOString();
|
||
}
|
||
|
||
module.exports = new Type('tag:yaml.org,2002:timestamp', {
|
||
kind: 'scalar',
|
||
resolve: resolveYamlTimestamp,
|
||
construct: constructYamlTimestamp,
|
||
instanceOf: Date,
|
||
represent: representYamlTimestamp
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 900:
|
||
/***/ ((module) => {
|
||
|
||
/**
|
||
* Helpers.
|
||
*/
|
||
|
||
var s = 1000;
|
||
var m = s * 60;
|
||
var h = m * 60;
|
||
var d = h * 24;
|
||
var w = d * 7;
|
||
var y = d * 365.25;
|
||
|
||
/**
|
||
* Parse or format the given `val`.
|
||
*
|
||
* Options:
|
||
*
|
||
* - `long` verbose formatting [false]
|
||
*
|
||
* @param {String|Number} val
|
||
* @param {Object} [options]
|
||
* @throws {Error} throw an error if val is not a non-empty string or a number
|
||
* @return {String|Number}
|
||
* @api public
|
||
*/
|
||
|
||
module.exports = function(val, options) {
|
||
options = options || {};
|
||
var type = typeof val;
|
||
if (type === 'string' && val.length > 0) {
|
||
return parse(val);
|
||
} else if (type === 'number' && isFinite(val)) {
|
||
return options.long ? fmtLong(val) : fmtShort(val);
|
||
}
|
||
throw new Error(
|
||
'val is not a non-empty string or a valid number. val=' +
|
||
JSON.stringify(val)
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Parse the given `str` and return milliseconds.
|
||
*
|
||
* @param {String} str
|
||
* @return {Number}
|
||
* @api private
|
||
*/
|
||
|
||
function parse(str) {
|
||
str = String(str);
|
||
if (str.length > 100) {
|
||
return;
|
||
}
|
||
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
||
str
|
||
);
|
||
if (!match) {
|
||
return;
|
||
}
|
||
var n = parseFloat(match[1]);
|
||
var type = (match[2] || 'ms').toLowerCase();
|
||
switch (type) {
|
||
case 'years':
|
||
case 'year':
|
||
case 'yrs':
|
||
case 'yr':
|
||
case 'y':
|
||
return n * y;
|
||
case 'weeks':
|
||
case 'week':
|
||
case 'w':
|
||
return n * w;
|
||
case 'days':
|
||
case 'day':
|
||
case 'd':
|
||
return n * d;
|
||
case 'hours':
|
||
case 'hour':
|
||
case 'hrs':
|
||
case 'hr':
|
||
case 'h':
|
||
return n * h;
|
||
case 'minutes':
|
||
case 'minute':
|
||
case 'mins':
|
||
case 'min':
|
||
case 'm':
|
||
return n * m;
|
||
case 'seconds':
|
||
case 'second':
|
||
case 'secs':
|
||
case 'sec':
|
||
case 's':
|
||
return n * s;
|
||
case 'milliseconds':
|
||
case 'millisecond':
|
||
case 'msecs':
|
||
case 'msec':
|
||
case 'ms':
|
||
return n;
|
||
default:
|
||
return undefined;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Short format for `ms`.
|
||
*
|
||
* @param {Number} ms
|
||
* @return {String}
|
||
* @api private
|
||
*/
|
||
|
||
function fmtShort(ms) {
|
||
var msAbs = Math.abs(ms);
|
||
if (msAbs >= d) {
|
||
return Math.round(ms / d) + 'd';
|
||
}
|
||
if (msAbs >= h) {
|
||
return Math.round(ms / h) + 'h';
|
||
}
|
||
if (msAbs >= m) {
|
||
return Math.round(ms / m) + 'm';
|
||
}
|
||
if (msAbs >= s) {
|
||
return Math.round(ms / s) + 's';
|
||
}
|
||
return ms + 'ms';
|
||
}
|
||
|
||
/**
|
||
* Long format for `ms`.
|
||
*
|
||
* @param {Number} ms
|
||
* @return {String}
|
||
* @api private
|
||
*/
|
||
|
||
function fmtLong(ms) {
|
||
var msAbs = Math.abs(ms);
|
||
if (msAbs >= d) {
|
||
return plural(ms, msAbs, d, 'day');
|
||
}
|
||
if (msAbs >= h) {
|
||
return plural(ms, msAbs, h, 'hour');
|
||
}
|
||
if (msAbs >= m) {
|
||
return plural(ms, msAbs, m, 'minute');
|
||
}
|
||
if (msAbs >= s) {
|
||
return plural(ms, msAbs, s, 'second');
|
||
}
|
||
return ms + ' ms';
|
||
}
|
||
|
||
/**
|
||
* Pluralization helper.
|
||
*/
|
||
|
||
function plural(ms, msAbs, n, name) {
|
||
var isPlural = msAbs >= n * 1.5;
|
||
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 254:
|
||
/***/ ((module, exports, __nccwpck_require__) => {
|
||
|
||
/* eslint-env browser */
|
||
|
||
/**
|
||
* This is the web browser implementation of `debug()`.
|
||
*/
|
||
|
||
exports.formatArgs = formatArgs;
|
||
exports.save = save;
|
||
exports.load = load;
|
||
exports.useColors = useColors;
|
||
exports.storage = localstorage();
|
||
exports.destroy = (() => {
|
||
let warned = false;
|
||
|
||
return () => {
|
||
if (!warned) {
|
||
warned = true;
|
||
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
||
}
|
||
};
|
||
})();
|
||
|
||
/**
|
||
* Colors.
|
||
*/
|
||
|
||
exports.colors = [
|
||
'#0000CC',
|
||
'#0000FF',
|
||
'#0033CC',
|
||
'#0033FF',
|
||
'#0066CC',
|
||
'#0066FF',
|
||
'#0099CC',
|
||
'#0099FF',
|
||
'#00CC00',
|
||
'#00CC33',
|
||
'#00CC66',
|
||
'#00CC99',
|
||
'#00CCCC',
|
||
'#00CCFF',
|
||
'#3300CC',
|
||
'#3300FF',
|
||
'#3333CC',
|
||
'#3333FF',
|
||
'#3366CC',
|
||
'#3366FF',
|
||
'#3399CC',
|
||
'#3399FF',
|
||
'#33CC00',
|
||
'#33CC33',
|
||
'#33CC66',
|
||
'#33CC99',
|
||
'#33CCCC',
|
||
'#33CCFF',
|
||
'#6600CC',
|
||
'#6600FF',
|
||
'#6633CC',
|
||
'#6633FF',
|
||
'#66CC00',
|
||
'#66CC33',
|
||
'#9900CC',
|
||
'#9900FF',
|
||
'#9933CC',
|
||
'#9933FF',
|
||
'#99CC00',
|
||
'#99CC33',
|
||
'#CC0000',
|
||
'#CC0033',
|
||
'#CC0066',
|
||
'#CC0099',
|
||
'#CC00CC',
|
||
'#CC00FF',
|
||
'#CC3300',
|
||
'#CC3333',
|
||
'#CC3366',
|
||
'#CC3399',
|
||
'#CC33CC',
|
||
'#CC33FF',
|
||
'#CC6600',
|
||
'#CC6633',
|
||
'#CC9900',
|
||
'#CC9933',
|
||
'#CCCC00',
|
||
'#CCCC33',
|
||
'#FF0000',
|
||
'#FF0033',
|
||
'#FF0066',
|
||
'#FF0099',
|
||
'#FF00CC',
|
||
'#FF00FF',
|
||
'#FF3300',
|
||
'#FF3333',
|
||
'#FF3366',
|
||
'#FF3399',
|
||
'#FF33CC',
|
||
'#FF33FF',
|
||
'#FF6600',
|
||
'#FF6633',
|
||
'#FF9900',
|
||
'#FF9933',
|
||
'#FFCC00',
|
||
'#FFCC33'
|
||
];
|
||
|
||
/**
|
||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||
* and the Firebug extension (any Firefox version) are known
|
||
* to support "%c" CSS customizations.
|
||
*
|
||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||
*/
|
||
|
||
// eslint-disable-next-line complexity
|
||
function useColors() {
|
||
// NB: In an Electron preload script, document will be defined but not fully
|
||
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||
// explicitly
|
||
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
||
return true;
|
||
}
|
||
|
||
// Internet Explorer and Edge do not support colors.
|
||
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
||
return false;
|
||
}
|
||
|
||
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||
// Is firebug? http://stackoverflow.com/a/398120/376773
|
||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||
// Is firefox >= v31?
|
||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
||
// Double check webkit in userAgent just in case we are in a worker
|
||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||
}
|
||
|
||
/**
|
||
* Colorize log arguments if enabled.
|
||
*
|
||
* @api public
|
||
*/
|
||
|
||
function formatArgs(args) {
|
||
args[0] = (this.useColors ? '%c' : '') +
|
||
this.namespace +
|
||
(this.useColors ? ' %c' : ' ') +
|
||
args[0] +
|
||
(this.useColors ? '%c ' : ' ') +
|
||
'+' + module.exports.humanize(this.diff);
|
||
|
||
if (!this.useColors) {
|
||
return;
|
||
}
|
||
|
||
const c = 'color: ' + this.color;
|
||
args.splice(1, 0, c, 'color: inherit');
|
||
|
||
// The final "%c" is somewhat tricky, because there could be other
|
||
// arguments passed either before or after the %c, so we need to
|
||
// figure out the correct index to insert the CSS into
|
||
let index = 0;
|
||
let lastC = 0;
|
||
args[0].replace(/%[a-zA-Z%]/g, match => {
|
||
if (match === '%%') {
|
||
return;
|
||
}
|
||
index++;
|
||
if (match === '%c') {
|
||
// We only are interested in the *last* %c
|
||
// (the user may have provided their own)
|
||
lastC = index;
|
||
}
|
||
});
|
||
|
||
args.splice(lastC, 0, c);
|
||
}
|
||
|
||
/**
|
||
* Invokes `console.debug()` when available.
|
||
* No-op when `console.debug` is not a "function".
|
||
* If `console.debug` is not available, falls back
|
||
* to `console.log`.
|
||
*
|
||
* @api public
|
||
*/
|
||
exports.log = console.debug || console.log || (() => {});
|
||
|
||
/**
|
||
* Save `namespaces`.
|
||
*
|
||
* @param {String} namespaces
|
||
* @api private
|
||
*/
|
||
function save(namespaces) {
|
||
try {
|
||
if (namespaces) {
|
||
exports.storage.setItem('debug', namespaces);
|
||
} else {
|
||
exports.storage.removeItem('debug');
|
||
}
|
||
} catch (error) {
|
||
// Swallow
|
||
// XXX (@Qix-) should we be logging these?
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Load `namespaces`.
|
||
*
|
||
* @return {String} returns the previously persisted debug modes
|
||
* @api private
|
||
*/
|
||
function load() {
|
||
let r;
|
||
try {
|
||
r = exports.storage.getItem('debug');
|
||
} catch (error) {
|
||
// Swallow
|
||
// XXX (@Qix-) should we be logging these?
|
||
}
|
||
|
||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||
r = process.env.DEBUG;
|
||
}
|
||
|
||
return r;
|
||
}
|
||
|
||
/**
|
||
* Localstorage attempts to return the localstorage.
|
||
*
|
||
* This is necessary because safari throws
|
||
* when a user disables cookies/localstorage
|
||
* and you attempt to access it.
|
||
*
|
||
* @return {LocalStorage}
|
||
* @api private
|
||
*/
|
||
|
||
function localstorage() {
|
||
try {
|
||
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
||
// The Browser also has localStorage in the global context.
|
||
return localStorage;
|
||
} catch (error) {
|
||
// Swallow
|
||
// XXX (@Qix-) should we be logging these?
|
||
}
|
||
}
|
||
|
||
module.exports = __nccwpck_require__(8867)(exports);
|
||
|
||
const {formatters} = module.exports;
|
||
|
||
/**
|
||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||
*/
|
||
|
||
formatters.j = function (v) {
|
||
try {
|
||
return JSON.stringify(v);
|
||
} catch (error) {
|
||
return '[UnexpectedJSONParseError]: ' + error.message;
|
||
}
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8867:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
|
||
/**
|
||
* This is the common logic for both the Node.js and web browser
|
||
* implementations of `debug()`.
|
||
*/
|
||
|
||
function setup(env) {
|
||
createDebug.debug = createDebug;
|
||
createDebug.default = createDebug;
|
||
createDebug.coerce = coerce;
|
||
createDebug.disable = disable;
|
||
createDebug.enable = enable;
|
||
createDebug.enabled = enabled;
|
||
createDebug.humanize = __nccwpck_require__(900);
|
||
createDebug.destroy = destroy;
|
||
|
||
Object.keys(env).forEach(key => {
|
||
createDebug[key] = env[key];
|
||
});
|
||
|
||
/**
|
||
* The currently active debug mode names, and names to skip.
|
||
*/
|
||
|
||
createDebug.names = [];
|
||
createDebug.skips = [];
|
||
|
||
/**
|
||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||
*
|
||
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||
*/
|
||
createDebug.formatters = {};
|
||
|
||
/**
|
||
* Selects a color for a debug namespace
|
||
* @param {String} namespace The namespace string for the for the debug instance to be colored
|
||
* @return {Number|String} An ANSI color code for the given namespace
|
||
* @api private
|
||
*/
|
||
function selectColor(namespace) {
|
||
let hash = 0;
|
||
|
||
for (let i = 0; i < namespace.length; i++) {
|
||
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||
hash |= 0; // Convert to 32bit integer
|
||
}
|
||
|
||
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
||
}
|
||
createDebug.selectColor = selectColor;
|
||
|
||
/**
|
||
* Create a debugger with the given `namespace`.
|
||
*
|
||
* @param {String} namespace
|
||
* @return {Function}
|
||
* @api public
|
||
*/
|
||
function createDebug(namespace) {
|
||
let prevTime;
|
||
let enableOverride = null;
|
||
|
||
function debug(...args) {
|
||
// Disabled?
|
||
if (!debug.enabled) {
|
||
return;
|
||
}
|
||
|
||
const self = debug;
|
||
|
||
// Set `diff` timestamp
|
||
const curr = Number(new Date());
|
||
const ms = curr - (prevTime || curr);
|
||
self.diff = ms;
|
||
self.prev = prevTime;
|
||
self.curr = curr;
|
||
prevTime = curr;
|
||
|
||
args[0] = createDebug.coerce(args[0]);
|
||
|
||
if (typeof args[0] !== 'string') {
|
||
// Anything else let's inspect with %O
|
||
args.unshift('%O');
|
||
}
|
||
|
||
// Apply any `formatters` transformations
|
||
let index = 0;
|
||
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
||
// If we encounter an escaped % then don't increase the array index
|
||
if (match === '%%') {
|
||
return '%';
|
||
}
|
||
index++;
|
||
const formatter = createDebug.formatters[format];
|
||
if (typeof formatter === 'function') {
|
||
const val = args[index];
|
||
match = formatter.call(self, val);
|
||
|
||
// Now we need to remove `args[index]` since it's inlined in the `format`
|
||
args.splice(index, 1);
|
||
index--;
|
||
}
|
||
return match;
|
||
});
|
||
|
||
// Apply env-specific formatting (colors, etc.)
|
||
createDebug.formatArgs.call(self, args);
|
||
|
||
const logFn = self.log || createDebug.log;
|
||
logFn.apply(self, args);
|
||
}
|
||
|
||
debug.namespace = namespace;
|
||
debug.useColors = createDebug.useColors();
|
||
debug.color = createDebug.selectColor(namespace);
|
||
debug.extend = extend;
|
||
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
||
|
||
Object.defineProperty(debug, 'enabled', {
|
||
enumerable: true,
|
||
configurable: false,
|
||
get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
|
||
set: v => {
|
||
enableOverride = v;
|
||
}
|
||
});
|
||
|
||
// Env-specific initialization logic for debug instances
|
||
if (typeof createDebug.init === 'function') {
|
||
createDebug.init(debug);
|
||
}
|
||
|
||
return debug;
|
||
}
|
||
|
||
function extend(namespace, delimiter) {
|
||
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||
newDebug.log = this.log;
|
||
return newDebug;
|
||
}
|
||
|
||
/**
|
||
* Enables a debug mode by namespaces. This can include modes
|
||
* separated by a colon and wildcards.
|
||
*
|
||
* @param {String} namespaces
|
||
* @api public
|
||
*/
|
||
function enable(namespaces) {
|
||
createDebug.save(namespaces);
|
||
|
||
createDebug.names = [];
|
||
createDebug.skips = [];
|
||
|
||
let i;
|
||
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||
const len = split.length;
|
||
|
||
for (i = 0; i < len; i++) {
|
||
if (!split[i]) {
|
||
// ignore empty strings
|
||
continue;
|
||
}
|
||
|
||
namespaces = split[i].replace(/\*/g, '.*?');
|
||
|
||
if (namespaces[0] === '-') {
|
||
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||
} else {
|
||
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Disable debug output.
|
||
*
|
||
* @return {String} namespaces
|
||
* @api public
|
||
*/
|
||
function disable() {
|
||
const namespaces = [
|
||
...createDebug.names.map(toNamespace),
|
||
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
||
].join(',');
|
||
createDebug.enable('');
|
||
return namespaces;
|
||
}
|
||
|
||
/**
|
||
* Returns true if the given mode name is enabled, false otherwise.
|
||
*
|
||
* @param {String} name
|
||
* @return {Boolean}
|
||
* @api public
|
||
*/
|
||
function enabled(name) {
|
||
if (name[name.length - 1] === '*') {
|
||
return true;
|
||
}
|
||
|
||
let i;
|
||
let len;
|
||
|
||
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
||
if (createDebug.skips[i].test(name)) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
||
if (createDebug.names[i].test(name)) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
/**
|
||
* Convert regexp to namespace
|
||
*
|
||
* @param {RegExp} regxep
|
||
* @return {String} namespace
|
||
* @api private
|
||
*/
|
||
function toNamespace(regexp) {
|
||
return regexp.toString()
|
||
.substring(2, regexp.toString().length - 2)
|
||
.replace(/\.\*\?$/, '*');
|
||
}
|
||
|
||
/**
|
||
* Coerce `val`.
|
||
*
|
||
* @param {Mixed} val
|
||
* @return {Mixed}
|
||
* @api private
|
||
*/
|
||
function coerce(val) {
|
||
if (val instanceof Error) {
|
||
return val.stack || val.message;
|
||
}
|
||
return val;
|
||
}
|
||
|
||
/**
|
||
* XXX DO NOT USE. This is a temporary stub function.
|
||
* XXX It WILL be removed in the next major release.
|
||
*/
|
||
function destroy() {
|
||
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
||
}
|
||
|
||
createDebug.enable(createDebug.load());
|
||
|
||
return createDebug;
|
||
}
|
||
|
||
module.exports = setup;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2179:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
/**
|
||
* Detect Electron renderer / nwjs process, which is node, but we should
|
||
* treat as a browser.
|
||
*/
|
||
|
||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||
module.exports = __nccwpck_require__(254);
|
||
} else {
|
||
module.exports = __nccwpck_require__(675);
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 675:
|
||
/***/ ((module, exports, __nccwpck_require__) => {
|
||
|
||
/**
|
||
* Module dependencies.
|
||
*/
|
||
|
||
const tty = __nccwpck_require__(3867);
|
||
const util = __nccwpck_require__(1669);
|
||
|
||
/**
|
||
* This is the Node.js implementation of `debug()`.
|
||
*/
|
||
|
||
exports.init = init;
|
||
exports.log = log;
|
||
exports.formatArgs = formatArgs;
|
||
exports.save = save;
|
||
exports.load = load;
|
||
exports.useColors = useColors;
|
||
exports.destroy = util.deprecate(
|
||
() => {},
|
||
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
||
);
|
||
|
||
/**
|
||
* Colors.
|
||
*/
|
||
|
||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||
|
||
try {
|
||
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||
const supportsColor = __nccwpck_require__(9318);
|
||
|
||
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
||
exports.colors = [
|
||
20,
|
||
21,
|
||
26,
|
||
27,
|
||
32,
|
||
33,
|
||
38,
|
||
39,
|
||
40,
|
||
41,
|
||
42,
|
||
43,
|
||
44,
|
||
45,
|
||
56,
|
||
57,
|
||
62,
|
||
63,
|
||
68,
|
||
69,
|
||
74,
|
||
75,
|
||
76,
|
||
77,
|
||
78,
|
||
79,
|
||
80,
|
||
81,
|
||
92,
|
||
93,
|
||
98,
|
||
99,
|
||
112,
|
||
113,
|
||
128,
|
||
129,
|
||
134,
|
||
135,
|
||
148,
|
||
149,
|
||
160,
|
||
161,
|
||
162,
|
||
163,
|
||
164,
|
||
165,
|
||
166,
|
||
167,
|
||
168,
|
||
169,
|
||
170,
|
||
171,
|
||
172,
|
||
173,
|
||
178,
|
||
179,
|
||
184,
|
||
185,
|
||
196,
|
||
197,
|
||
198,
|
||
199,
|
||
200,
|
||
201,
|
||
202,
|
||
203,
|
||
204,
|
||
205,
|
||
206,
|
||
207,
|
||
208,
|
||
209,
|
||
214,
|
||
215,
|
||
220,
|
||
221
|
||
];
|
||
}
|
||
} catch (error) {
|
||
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
||
}
|
||
|
||
/**
|
||
* Build up the default `inspectOpts` object from the environment variables.
|
||
*
|
||
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||
*/
|
||
|
||
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
||
return /^debug_/i.test(key);
|
||
}).reduce((obj, key) => {
|
||
// Camel-case
|
||
const prop = key
|
||
.substring(6)
|
||
.toLowerCase()
|
||
.replace(/_([a-z])/g, (_, k) => {
|
||
return k.toUpperCase();
|
||
});
|
||
|
||
// Coerce string value into JS value
|
||
let val = process.env[key];
|
||
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
||
val = true;
|
||
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
||
val = false;
|
||
} else if (val === 'null') {
|
||
val = null;
|
||
} else {
|
||
val = Number(val);
|
||
}
|
||
|
||
obj[prop] = val;
|
||
return obj;
|
||
}, {});
|
||
|
||
/**
|
||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||
*/
|
||
|
||
function useColors() {
|
||
return 'colors' in exports.inspectOpts ?
|
||
Boolean(exports.inspectOpts.colors) :
|
||
tty.isatty(process.stderr.fd);
|
||
}
|
||
|
||
/**
|
||
* Adds ANSI color escape codes if enabled.
|
||
*
|
||
* @api public
|
||
*/
|
||
|
||
function formatArgs(args) {
|
||
const {namespace: name, useColors} = this;
|
||
|
||
if (useColors) {
|
||
const c = this.color;
|
||
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
||
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
||
|
||
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
||
} else {
|
||
args[0] = getDate() + name + ' ' + args[0];
|
||
}
|
||
}
|
||
|
||
function getDate() {
|
||
if (exports.inspectOpts.hideDate) {
|
||
return '';
|
||
}
|
||
return new Date().toISOString() + ' ';
|
||
}
|
||
|
||
/**
|
||
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
||
*/
|
||
|
||
function log(...args) {
|
||
return process.stderr.write(util.format(...args) + '\n');
|
||
}
|
||
|
||
/**
|
||
* Save `namespaces`.
|
||
*
|
||
* @param {String} namespaces
|
||
* @api private
|
||
*/
|
||
function save(namespaces) {
|
||
if (namespaces) {
|
||
process.env.DEBUG = namespaces;
|
||
} else {
|
||
// If you set a process.env field to null or undefined, it gets cast to the
|
||
// string 'null' or 'undefined'. Just delete instead.
|
||
delete process.env.DEBUG;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Load `namespaces`.
|
||
*
|
||
* @return {String} returns the previously persisted debug modes
|
||
* @api private
|
||
*/
|
||
|
||
function load() {
|
||
return process.env.DEBUG;
|
||
}
|
||
|
||
/**
|
||
* Init logic for `debug` instances.
|
||
*
|
||
* Create a new `inspectOpts` object in case `useColors` is set
|
||
* differently for a particular `debug` instance.
|
||
*/
|
||
|
||
function init(debug) {
|
||
debug.inspectOpts = {};
|
||
|
||
const keys = Object.keys(exports.inspectOpts);
|
||
for (let i = 0; i < keys.length; i++) {
|
||
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||
}
|
||
}
|
||
|
||
module.exports = __nccwpck_require__(8867)(exports);
|
||
|
||
const {formatters} = module.exports;
|
||
|
||
/**
|
||
* Map %o to `util.inspect()`, all on a single line.
|
||
*/
|
||
|
||
formatters.o = function (v) {
|
||
this.inspectOpts.colors = this.useColors;
|
||
return util.inspect(v, this.inspectOpts)
|
||
.split('\n')
|
||
.map(str => str.trim())
|
||
.join(' ');
|
||
};
|
||
|
||
/**
|
||
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
||
*/
|
||
|
||
formatters.O = function (v) {
|
||
this.inspectOpts.colors = this.useColors;
|
||
return util.inspect(v, this.inspectOpts);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1949:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
const Git = __nccwpck_require__(4966);
|
||
const {GitConstructError} = __nccwpck_require__(4732);
|
||
const {createInstanceConfig, folderExists} = __nccwpck_require__(847);
|
||
|
||
const api = Object.create(null);
|
||
for (let imported = __nccwpck_require__(4732), keys = Object.keys(imported), i = 0; i < keys.length; i++) {
|
||
const name = keys[i];
|
||
if (/^[A-Z]/.test(name)) {
|
||
api[name] = imported[name];
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Adds the necessary properties to the supplied object to enable it for use as
|
||
* the default export of a module.
|
||
*
|
||
* Eg: `module.exports = esModuleFactory({ something () {} })`
|
||
*/
|
||
module.exports.esModuleFactory = function esModuleFactory (defaultExport) {
|
||
return Object.defineProperties(defaultExport, {
|
||
__esModule: {value: true},
|
||
default: {value: defaultExport},
|
||
});
|
||
}
|
||
|
||
module.exports.gitExportFactory = function gitExportFactory (factory, extra) {
|
||
return Object.assign(function () {
|
||
return factory.apply(null, arguments);
|
||
},
|
||
api,
|
||
extra || {},
|
||
);
|
||
};
|
||
|
||
module.exports.gitInstanceFactory = function gitInstanceFactory (baseDir, options) {
|
||
const config = createInstanceConfig(
|
||
baseDir && (typeof baseDir === 'string' ? {baseDir} : baseDir),
|
||
options
|
||
);
|
||
|
||
if (!folderExists(config.baseDir)) {
|
||
throw new GitConstructError(config, `Cannot use simple-git on a directory that does not exist`);
|
||
}
|
||
|
||
return new Git(config);
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4966:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
const {GitExecutor} = __nccwpck_require__(4701);
|
||
|
||
const {Scheduler} = __nccwpck_require__(3421);
|
||
const {GitLogger} = __nccwpck_require__(7178);
|
||
const {adhocExecTask, configurationErrorTask} = __nccwpck_require__(2815);
|
||
const {NOOP, appendTaskOptions, asArray, filterArray, filterPrimitives, filterString, filterStringOrStringArray, filterType, folderExists, getTrailingOptions, trailingFunctionArgument, trailingOptionsArgument} = __nccwpck_require__(847);
|
||
const {branchTask, branchLocalTask, deleteBranchesTask, deleteBranchTask} = __nccwpck_require__(17);
|
||
const {taskCallback} = __nccwpck_require__(8850);
|
||
const {checkIsRepoTask} = __nccwpck_require__(221);
|
||
const {cloneTask, cloneMirrorTask} = __nccwpck_require__(3173);
|
||
const {addConfigTask, listConfigTask} = __nccwpck_require__(7597);
|
||
const {cleanWithOptionsTask, isCleanOptionsArray} = __nccwpck_require__(4386);
|
||
const {commitTask} = __nccwpck_require__(5494);
|
||
const {diffSummaryTask} = __nccwpck_require__(9241);
|
||
const {fetchTask} = __nccwpck_require__(8823);
|
||
const {hashObjectTask} = __nccwpck_require__(8199);
|
||
const {initTask} = __nccwpck_require__(6016);
|
||
const {logTask, parseLogOptions} = __nccwpck_require__(8627);
|
||
const {mergeTask} = __nccwpck_require__(8829);
|
||
const {moveTask} = __nccwpck_require__(6520);
|
||
const {pullTask} = __nccwpck_require__(4636);
|
||
const {pushTagsTask, pushTask} = __nccwpck_require__(1435);
|
||
const {addRemoteTask, getRemotesTask, listRemotesTask, remoteTask, removeRemoteTask} = __nccwpck_require__(9866);
|
||
const {getResetMode, resetTask} = __nccwpck_require__(2377);
|
||
const {stashListTask} = __nccwpck_require__(810);
|
||
const {statusTask} = __nccwpck_require__(9197);
|
||
const {addSubModuleTask, initSubModuleTask, subModuleTask, updateSubModuleTask} = __nccwpck_require__(8772);
|
||
const {addAnnotatedTagTask, addTagTask, tagListTask} = __nccwpck_require__(8540);
|
||
const {straightThroughStringTask} = __nccwpck_require__(2815);
|
||
const {parseCheckIgnore} = __nccwpck_require__(9926);
|
||
|
||
const ChainedExecutor = Symbol('ChainedExecutor');
|
||
|
||
/**
|
||
* Git handling for node. All public functions can be chained and all `then` handlers are optional.
|
||
*
|
||
* @param {SimpleGitOptions} options Configuration settings for this instance
|
||
*
|
||
* @constructor
|
||
*/
|
||
function Git (options) {
|
||
this._executor = new GitExecutor(
|
||
options.binary, options.baseDir,
|
||
new Scheduler(options.maxConcurrentProcesses)
|
||
);
|
||
this._logger = new GitLogger();
|
||
}
|
||
|
||
/**
|
||
* The executor that runs each of the added commands
|
||
* @type {GitExecutor}
|
||
* @private
|
||
*/
|
||
Git.prototype._executor = null;
|
||
|
||
/**
|
||
* Logging utility for printing out info or error messages to the user
|
||
* @type {GitLogger}
|
||
* @private
|
||
*/
|
||
Git.prototype._logger = null;
|
||
|
||
/**
|
||
* Sets the path to a custom git binary, should either be `git` when there is an installation of git available on
|
||
* the system path, or a fully qualified path to the executable.
|
||
*
|
||
* @param {string} command
|
||
* @returns {Git}
|
||
*/
|
||
Git.prototype.customBinary = function (command) {
|
||
this._executor.binary = command;
|
||
return this;
|
||
};
|
||
|
||
/**
|
||
* Sets an environment variable for the spawned child process, either supply both a name and value as strings or
|
||
* a single object to entirely replace the current environment variables.
|
||
*
|
||
* @param {string|Object} name
|
||
* @param {string} [value]
|
||
* @returns {Git}
|
||
*/
|
||
Git.prototype.env = function (name, value) {
|
||
if (arguments.length === 1 && typeof name === 'object') {
|
||
this._executor.env = name;
|
||
} else {
|
||
(this._executor.env = this._executor.env || {})[name] = value;
|
||
}
|
||
|
||
return this;
|
||
};
|
||
|
||
/**
|
||
* Sets the working directory of the subsequent commands.
|
||
*/
|
||
Git.prototype.cwd = function (workingDirectory) {
|
||
const task = (typeof workingDirectory !== 'string')
|
||
? configurationErrorTask('Git.cwd: workingDirectory must be supplied as a string')
|
||
: adhocExecTask(() => {
|
||
if (!folderExists(workingDirectory)) {
|
||
throw new Error(`Git.cwd: cannot change to non-directory "${ workingDirectory }"`);
|
||
}
|
||
|
||
return (this._executor.cwd = workingDirectory);
|
||
});
|
||
|
||
return this._runTask(task, trailingFunctionArgument(arguments) || NOOP);
|
||
};
|
||
|
||
/**
|
||
* Sets a handler function to be called whenever a new child process is created, the handler function will be called
|
||
* with the name of the command being run and the stdout & stderr streams used by the ChildProcess.
|
||
*
|
||
* @example
|
||
* require('simple-git')
|
||
* .outputHandler(function (command, stdout, stderr) {
|
||
* stdout.pipe(process.stdout);
|
||
* })
|
||
* .checkout('https://github.com/user/repo.git');
|
||
*
|
||
* @see https://nodejs.org/api/child_process.html#child_process_class_childprocess
|
||
* @see https://nodejs.org/api/stream.html#stream_class_stream_readable
|
||
* @param {Function} outputHandler
|
||
* @returns {Git}
|
||
*/
|
||
Git.prototype.outputHandler = function (outputHandler) {
|
||
this._executor.outputHandler = outputHandler;
|
||
return this;
|
||
};
|
||
|
||
/**
|
||
* Initialize a git repo
|
||
*
|
||
* @param {Boolean} [bare=false]
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.init = function (bare, then) {
|
||
return this._runTask(
|
||
initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Check the status of the local repo
|
||
*/
|
||
Git.prototype.status = function () {
|
||
return this._runTask(
|
||
statusTask(getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* List the stash(s) of the local repo
|
||
*/
|
||
Git.prototype.stashList = function (options) {
|
||
return this._runTask(
|
||
stashListTask(
|
||
trailingOptionsArgument(arguments) || {},
|
||
filterArray(options) && options || []
|
||
),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Stash the local repo
|
||
*
|
||
* @param {Object|Array} [options]
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.stash = function (options, then) {
|
||
return this._runTask(
|
||
straightThroughStringTask(['stash', ...getTrailingOptions(arguments)]),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
function createCloneTask (api, task, repoPath, localPath) {
|
||
if (typeof repoPath !== 'string') {
|
||
return configurationErrorTask(`git.${ api }() requires a string 'repoPath'`);
|
||
}
|
||
|
||
return task(repoPath, filterType(localPath, filterString), getTrailingOptions(arguments));
|
||
}
|
||
|
||
|
||
/**
|
||
* Clone a git repo
|
||
*/
|
||
Git.prototype.clone = function () {
|
||
return this._runTask(
|
||
createCloneTask('clone', cloneTask, ...arguments),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Mirror a git repo
|
||
*/
|
||
Git.prototype.mirror = function () {
|
||
return this._runTask(
|
||
createCloneTask('mirror', cloneMirrorTask, ...arguments),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Moves one or more files to a new destination.
|
||
*
|
||
* @see https://git-scm.com/docs/git-mv
|
||
*
|
||
* @param {string|string[]} from
|
||
* @param {string} to
|
||
*/
|
||
Git.prototype.mv = function (from, to) {
|
||
return this._runTask(moveTask(from, to), trailingFunctionArgument(arguments));
|
||
};
|
||
|
||
/**
|
||
* Internally uses pull and tags to get the list of tags then checks out the latest tag.
|
||
*
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.checkoutLatestTag = function (then) {
|
||
var git = this;
|
||
return this.pull(function () {
|
||
git.tags(function (err, tags) {
|
||
git.checkout(tags.latest, then);
|
||
});
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Adds one or more files to source control
|
||
*/
|
||
Git.prototype.add = function (files) {
|
||
return this._run(
|
||
['add'].concat(files),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Commits changes in the current working directory - when specific file paths are supplied, only changes on those
|
||
* files will be committed.
|
||
*
|
||
* @param {string|string[]} message
|
||
* @param {string|string[]} [files]
|
||
* @param {Object} [options]
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.commit = function (message, files, options, then) {
|
||
const next = trailingFunctionArgument(arguments);
|
||
const messages = [];
|
||
|
||
if (filterStringOrStringArray(message)) {
|
||
messages.push(...asArray(message));
|
||
}
|
||
else {
|
||
console.warn('simple-git deprecation notice: git.commit: requires the commit message to be supplied as a string/string[], this will be an error in version 3');
|
||
}
|
||
|
||
return this._runTask(
|
||
commitTask(
|
||
messages,
|
||
asArray(filterType(files, filterStringOrStringArray, [])),
|
||
[...filterType(options, filterArray, []), ...getTrailingOptions(arguments, 0, true)]
|
||
),
|
||
next
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Pull the updated contents of the current repo
|
||
*/
|
||
Git.prototype.pull = function (remote, branch, options, then) {
|
||
return this._runTask(
|
||
pullTask(filterType(remote, filterString), filterType(branch, filterString), getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Fetch the updated contents of the current repo.
|
||
*
|
||
* @example
|
||
* .fetch('upstream', 'master') // fetches from master on remote named upstream
|
||
* .fetch(function () {}) // runs fetch against default remote and branch and calls function
|
||
*
|
||
* @param {string} [remote]
|
||
* @param {string} [branch]
|
||
*/
|
||
Git.prototype.fetch = function (remote, branch) {
|
||
return this._runTask(
|
||
fetchTask(filterType(remote, filterString), filterType(branch, filterString), getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Disables/enables the use of the console for printing warnings and errors, by default messages are not shown in
|
||
* a production environment.
|
||
*
|
||
* @param {boolean} silence
|
||
* @returns {Git}
|
||
*/
|
||
Git.prototype.silent = function (silence) {
|
||
this._logger.silent(!!silence);
|
||
return this;
|
||
};
|
||
|
||
/**
|
||
* List all tags. When using git 2.7.0 or above, include an options object with `"--sort": "property-name"` to
|
||
* sort the tags by that property instead of using the default semantic versioning sort.
|
||
*
|
||
* Note, supplying this option when it is not supported by your Git version will cause the operation to fail.
|
||
*
|
||
* @param {Object} [options]
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.tags = function (options, then) {
|
||
return this._runTask(
|
||
tagListTask(getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Rebases the current working copy. Options can be supplied either as an array of string parameters
|
||
* to be sent to the `git rebase` command, or a standard options object.
|
||
*/
|
||
Git.prototype.rebase = function () {
|
||
return this._run(
|
||
['rebase'].concat(getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments)
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Reset a repo
|
||
*
|
||
* @param {string|string[]} [mode=soft] Either an array of arguments supported by the 'git reset' command, or the
|
||
* string value 'soft' or 'hard' to set the reset mode.
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.reset = function (mode, then) {
|
||
return this._runTask(
|
||
resetTask(getResetMode(mode), getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Revert one or more commits in the local working copy
|
||
*/
|
||
Git.prototype.revert = function (commit) {
|
||
const next = trailingFunctionArgument(arguments);
|
||
|
||
if (typeof commit !== 'string') {
|
||
return this._runTask(
|
||
configurationErrorTask('Commit must be a string'),
|
||
next,
|
||
);
|
||
}
|
||
|
||
return this._run([
|
||
'revert',
|
||
...getTrailingOptions(arguments, 0, true),
|
||
commit
|
||
], next);
|
||
};
|
||
|
||
/**
|
||
* Add a lightweight tag to the head of the current branch
|
||
*
|
||
* @param {string} name
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.addTag = function (name, then) {
|
||
const task = (typeof name === 'string')
|
||
? addTagTask(name)
|
||
: configurationErrorTask('Git.addTag requires a tag name');
|
||
|
||
return this._runTask(task, trailingFunctionArgument(arguments));
|
||
};
|
||
|
||
/**
|
||
* Add an annotated tag to the head of the current branch
|
||
*
|
||
* @param {string} tagName
|
||
* @param {string} tagMessage
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.addAnnotatedTag = function (tagName, tagMessage, then) {
|
||
return this._runTask(
|
||
addAnnotatedTagTask(tagName, tagMessage),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Check out a tag or revision, any number of additional arguments can be passed to the `git checkout` command
|
||
* by supplying either a string or array of strings as the `what` parameter.
|
||
*
|
||
* @param {string|string[]} what One or more commands to pass to `git checkout`
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.checkout = function (what, then) {
|
||
const commands = ['checkout', ...getTrailingOptions(arguments, true)];
|
||
return this._runTask(
|
||
straightThroughStringTask(commands),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Check out a remote branch
|
||
*
|
||
* @param {string} branchName name of branch
|
||
* @param {string} startPoint (e.g origin/development)
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.checkoutBranch = function (branchName, startPoint, then) {
|
||
return this.checkout(['-b', branchName, startPoint], trailingFunctionArgument(arguments));
|
||
};
|
||
|
||
/**
|
||
* Check out a local branch
|
||
*/
|
||
Git.prototype.checkoutLocalBranch = function (branchName, then) {
|
||
return this.checkout(['-b', branchName], trailingFunctionArgument(arguments));
|
||
};
|
||
|
||
/**
|
||
* Delete a local branch
|
||
*/
|
||
Git.prototype.deleteLocalBranch = function (branchName, forceDelete, then) {
|
||
return this._runTask(
|
||
deleteBranchTask(branchName, typeof forceDelete === "boolean" ? forceDelete : false),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Delete one or more local branches
|
||
*/
|
||
Git.prototype.deleteLocalBranches = function (branchNames, forceDelete, then) {
|
||
return this._runTask(
|
||
deleteBranchesTask(branchNames, typeof forceDelete === "boolean" ? forceDelete : false),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* List all branches
|
||
*
|
||
* @param {Object | string[]} [options]
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.branch = function (options, then) {
|
||
return this._runTask(
|
||
branchTask(getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Return list of local branches
|
||
*
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.branchLocal = function (then) {
|
||
return this._runTask(
|
||
branchLocalTask(),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Add config to local git instance
|
||
*
|
||
* @param {string} key configuration key (e.g user.name)
|
||
* @param {string} value for the given key (e.g your name)
|
||
* @param {boolean} [append=false] optionally append the key/value pair (equivalent of passing `--add` option).
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.addConfig = function (key, value, append, then) {
|
||
return this._runTask(
|
||
addConfigTask(key, value, typeof append === "boolean" ? append : false),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
Git.prototype.listConfig = function () {
|
||
return this._runTask(listConfigTask(), trailingFunctionArgument(arguments));
|
||
};
|
||
|
||
/**
|
||
* Executes any command against the git binary.
|
||
*/
|
||
Git.prototype.raw = function (commands) {
|
||
const createRestCommands = !Array.isArray(commands);
|
||
const command = [].slice.call(createRestCommands ? arguments : commands, 0);
|
||
|
||
for (let i = 0; i < command.length && createRestCommands; i++) {
|
||
if (!filterPrimitives(command[i])) {
|
||
command.splice(i, command.length - i);
|
||
break;
|
||
}
|
||
}
|
||
|
||
command.push(
|
||
...getTrailingOptions(arguments, 0, true),
|
||
);
|
||
|
||
var next = trailingFunctionArgument(arguments);
|
||
|
||
if (!command.length) {
|
||
return this._runTask(
|
||
configurationErrorTask('Raw: must supply one or more command to execute'),
|
||
next,
|
||
);
|
||
}
|
||
|
||
return this._run(command, next);
|
||
};
|
||
|
||
Git.prototype.submoduleAdd = function (repo, path, then) {
|
||
return this._runTask(
|
||
addSubModuleTask(repo, path),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
Git.prototype.submoduleUpdate = function (args, then) {
|
||
return this._runTask(
|
||
updateSubModuleTask(getTrailingOptions(arguments, true)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
Git.prototype.submoduleInit = function (args, then) {
|
||
return this._runTask(
|
||
initSubModuleTask(getTrailingOptions(arguments, true)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
Git.prototype.subModule = function (options, then) {
|
||
return this._runTask(
|
||
subModuleTask(getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
Git.prototype.listRemote = function () {
|
||
return this._runTask(
|
||
listRemotesTask(getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Adds a remote to the list of remotes.
|
||
*/
|
||
Git.prototype.addRemote = function (remoteName, remoteRepo, then) {
|
||
return this._runTask(
|
||
addRemoteTask(remoteName, remoteRepo, getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Removes an entry by name from the list of remotes.
|
||
*/
|
||
Git.prototype.removeRemote = function (remoteName, then) {
|
||
return this._runTask(
|
||
removeRemoteTask(remoteName),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Gets the currently available remotes, setting the optional verbose argument to true includes additional
|
||
* detail on the remotes themselves.
|
||
*/
|
||
Git.prototype.getRemotes = function (verbose, then) {
|
||
return this._runTask(
|
||
getRemotesTask(verbose === true),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Compute object ID from a file
|
||
*/
|
||
Git.prototype.hashObject = function (path, write) {
|
||
return this._runTask(
|
||
hashObjectTask(path, write === true),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Call any `git remote` function with arguments passed as an array of strings.
|
||
*
|
||
* @param {string[]} options
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.remote = function (options, then) {
|
||
return this._runTask(
|
||
remoteTask(getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Merges from one branch to another, equivalent to running `git merge ${from} $[to}`, the `options` argument can
|
||
* either be an array of additional parameters to pass to the command or null / omitted to be ignored.
|
||
*
|
||
* @param {string} from
|
||
* @param {string} to
|
||
*/
|
||
Git.prototype.mergeFromTo = function (from, to) {
|
||
if (!(filterString(from) && filterString(to))) {
|
||
return this._runTask(configurationErrorTask(
|
||
`Git.mergeFromTo requires that the 'from' and 'to' arguments are supplied as strings`
|
||
));
|
||
}
|
||
|
||
return this._runTask(
|
||
mergeTask([from, to, ...getTrailingOptions(arguments)]),
|
||
trailingFunctionArgument(arguments, false),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Runs a merge, `options` can be either an array of arguments
|
||
* supported by the [`git merge`](https://git-scm.com/docs/git-merge)
|
||
* or an options object.
|
||
*
|
||
* Conflicts during the merge result in an error response,
|
||
* the response type whether it was an error or success will be a MergeSummary instance.
|
||
* When successful, the MergeSummary has all detail from a the PullSummary
|
||
*
|
||
* @param {Object | string[]} [options]
|
||
* @param {Function} [then]
|
||
* @returns {*}
|
||
*
|
||
* @see ./responses/MergeSummary.js
|
||
* @see ./responses/PullSummary.js
|
||
*/
|
||
Git.prototype.merge = function () {
|
||
return this._runTask(
|
||
mergeTask(getTrailingOptions(arguments)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Call any `git tag` function with arguments passed as an array of strings.
|
||
*
|
||
* @param {string[]} options
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.tag = function (options, then) {
|
||
const command = getTrailingOptions(arguments);
|
||
|
||
if (command[0] !== 'tag') {
|
||
command.unshift('tag');
|
||
}
|
||
|
||
return this._run(command, trailingFunctionArgument(arguments));
|
||
};
|
||
|
||
/**
|
||
* Updates repository server info
|
||
*
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.updateServerInfo = function (then) {
|
||
return this._run(["update-server-info"], trailingFunctionArgument(arguments));
|
||
};
|
||
|
||
/**
|
||
* Pushes the current committed changes to a remote, optionally specify the names of the remote and branch to use
|
||
* when pushing. Supply multiple options as an array of strings in the first argument - see examples below.
|
||
*/
|
||
Git.prototype.push = function (remote, branch, then) {
|
||
const task = pushTask(
|
||
{remote: filterType(remote, filterString), branch: filterType(branch, filterString)},
|
||
getTrailingOptions(arguments),
|
||
);
|
||
return this._runTask(task, trailingFunctionArgument(arguments));
|
||
};
|
||
|
||
/**
|
||
* Pushes the current tag changes to a remote which can be either a URL or named remote. When not specified uses the
|
||
* default configured remote spec.
|
||
*
|
||
* @param {string} [remote]
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.pushTags = function (remote, then) {
|
||
const task = pushTagsTask({remote: filterType(remote, filterString)}, getTrailingOptions(arguments));
|
||
|
||
return this._runTask(task, trailingFunctionArgument(arguments));
|
||
};
|
||
|
||
/**
|
||
* Removes the named files from source control.
|
||
*
|
||
* @param {string|string[]} files
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.rm = function (files, then) {
|
||
return this._rm(files, '-f', then);
|
||
};
|
||
|
||
/**
|
||
* Removes the named files from source control but keeps them on disk rather than deleting them entirely. To
|
||
* completely remove the files, use `rm`.
|
||
*
|
||
* @param {string|string[]} files
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.rmKeepLocal = function (files, then) {
|
||
return this._rm(files, '--cached', then);
|
||
};
|
||
|
||
/**
|
||
* Returns a list of objects in a tree based on commit hash. Passing in an object hash returns the object's content,
|
||
* size, and type.
|
||
*
|
||
* Passing "-p" will instruct cat-file to determine the object type, and display its formatted contents.
|
||
*
|
||
* @param {string[]} [options]
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.catFile = function (options, then) {
|
||
return this._catFile('utf-8', arguments);
|
||
};
|
||
|
||
/**
|
||
* Equivalent to `catFile` but will return the native `Buffer` of content from the git command's stdout.
|
||
*
|
||
* @param {string[]} options
|
||
* @param then
|
||
*/
|
||
Git.prototype.binaryCatFile = function (options, then) {
|
||
return this._catFile('buffer', arguments);
|
||
};
|
||
|
||
Git.prototype._catFile = function (format, args) {
|
||
var handler = trailingFunctionArgument(args);
|
||
var command = ['cat-file'];
|
||
var options = args[0];
|
||
|
||
if (typeof options === 'string') {
|
||
return this._runTask(
|
||
configurationErrorTask('Git#catFile: options must be supplied as an array of strings'),
|
||
handler,
|
||
);
|
||
}
|
||
|
||
if (Array.isArray(options)) {
|
||
command.push.apply(command, options);
|
||
}
|
||
|
||
return this._run(command, handler, {
|
||
format: format
|
||
});
|
||
};
|
||
|
||
Git.prototype.diff = function (options, then) {
|
||
const command = ['diff', ...getTrailingOptions(arguments)];
|
||
|
||
if (typeof options === 'string') {
|
||
command.splice(1, 0, options);
|
||
this._logger.warn('Git#diff: supplying options as a single string is now deprecated, switch to an array of strings');
|
||
}
|
||
|
||
return this._runTask(
|
||
straightThroughStringTask(command),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
Git.prototype.diffSummary = function () {
|
||
return this._runTask(
|
||
diffSummaryTask(getTrailingOptions(arguments, 1)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
Git.prototype.revparse = function () {
|
||
const commands = ['rev-parse', ...getTrailingOptions(arguments, true)];
|
||
return this._runTask(
|
||
straightThroughStringTask(commands, true),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Show various types of objects, for example the file at a certain commit
|
||
*
|
||
* @param {string[]} [options]
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.show = function (options, then) {
|
||
return this._runTask(
|
||
straightThroughStringTask(['show', ...getTrailingOptions(arguments, 1)]),
|
||
trailingFunctionArgument(arguments)
|
||
);
|
||
};
|
||
|
||
/**
|
||
*/
|
||
Git.prototype.clean = function (mode, options, then) {
|
||
const usingCleanOptionsArray = isCleanOptionsArray(mode);
|
||
const cleanMode = usingCleanOptionsArray && mode.join('') || filterType(mode, filterString) || '';
|
||
const customArgs = getTrailingOptions([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));
|
||
|
||
return this._runTask(
|
||
cleanWithOptionsTask(cleanMode, customArgs),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
/**
|
||
* Call a simple function at the next step in the chain.
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.exec = function (then) {
|
||
const task = {
|
||
commands: [],
|
||
format: 'utf-8',
|
||
parser () {
|
||
if (typeof then === 'function') {
|
||
then();
|
||
}
|
||
}
|
||
};
|
||
|
||
return this._runTask(task);
|
||
};
|
||
|
||
/**
|
||
* Show commit logs from `HEAD` to the first commit.
|
||
* If provided between `options.from` and `options.to` tags or branch.
|
||
*
|
||
* Additionally you can provide options.file, which is the path to a file in your repository. Then only this file will be considered.
|
||
*
|
||
* To use a custom splitter in the log format, set `options.splitter` to be the string the log should be split on.
|
||
*
|
||
* Options can also be supplied as a standard options object for adding custom properties supported by the git log command.
|
||
* For any other set of options, supply options as an array of strings to be appended to the git log command.
|
||
*/
|
||
Git.prototype.log = function (options) {
|
||
const next = trailingFunctionArgument(arguments);
|
||
|
||
if (filterString(arguments[0]) && filterString(arguments[1])) {
|
||
return this._runTask(
|
||
configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`),
|
||
next
|
||
);
|
||
}
|
||
|
||
const parsedOptions = parseLogOptions(
|
||
trailingOptionsArgument(arguments) || {},
|
||
filterArray(options) && options || []
|
||
);
|
||
|
||
return this._runTask(
|
||
logTask(parsedOptions.splitter, parsedOptions.fields, parsedOptions.commands),
|
||
next,
|
||
)
|
||
};
|
||
|
||
/**
|
||
* Clears the queue of pending commands and returns the wrapper instance for chaining.
|
||
*
|
||
* @returns {Git}
|
||
*/
|
||
Git.prototype.clearQueue = function () {
|
||
// TODO:
|
||
// this._executor.clear();
|
||
return this;
|
||
};
|
||
|
||
/**
|
||
* Check if a pathname or pathnames are excluded by .gitignore
|
||
*
|
||
* @param {string|string[]} pathnames
|
||
* @param {Function} [then]
|
||
*/
|
||
Git.prototype.checkIgnore = function (pathnames, then) {
|
||
return this._run(
|
||
["check-ignore", ...asArray((filterType(pathnames, filterStringOrStringArray, [])))],
|
||
trailingFunctionArgument(arguments),
|
||
{
|
||
parser: parseCheckIgnore
|
||
}
|
||
)
|
||
};
|
||
|
||
Git.prototype.checkIsRepo = function (checkType, then) {
|
||
return this._runTask(
|
||
checkIsRepoTask(filterType(checkType, filterString)),
|
||
trailingFunctionArgument(arguments),
|
||
);
|
||
};
|
||
|
||
Git.prototype._rm = function (_files, options, then) {
|
||
var files = [].concat(_files);
|
||
var args = ['rm', options];
|
||
args.push.apply(args, files);
|
||
|
||
return this._run(args, trailingFunctionArgument(arguments));
|
||
};
|
||
|
||
/**
|
||
* Schedules the supplied command to be run, the command should not include the name of the git binary and should
|
||
* be an array of strings passed as the arguments to the git binary.
|
||
*
|
||
* @param {string[]} command
|
||
* @param {Function} then
|
||
* @param {Object} [opt]
|
||
* @param {boolean} [opt.concatStdErr=false] Optionally concatenate stderr output into the stdout
|
||
* @param {boolean} [opt.format="utf-8"] The format to use when reading the content of stdout
|
||
* @param {Function} [opt.onError] Optional error handler for this command - can be used to allow non-clean exits
|
||
* without killing the remaining stack of commands
|
||
* @param {Function} [opt.parser] Optional parser function
|
||
* @param {number} [opt.onError.exitCode]
|
||
* @param {string} [opt.onError.stdErr]
|
||
*
|
||
* @returns {Git}
|
||
*/
|
||
Git.prototype._run = function (command, then, opt) {
|
||
|
||
const task = Object.assign({
|
||
concatStdErr: false,
|
||
onError: undefined,
|
||
format: 'utf-8',
|
||
parser (data) {
|
||
return data;
|
||
}
|
||
}, opt || {}, {
|
||
commands: command,
|
||
});
|
||
|
||
return this._runTask(task, then);
|
||
};
|
||
|
||
Git.prototype._runTask = function (task, then) {
|
||
const executor = this[ChainedExecutor] || this._executor.chain();
|
||
const promise = executor.push(task);
|
||
|
||
taskCallback(
|
||
task,
|
||
promise,
|
||
then);
|
||
|
||
return Object.create(this, {
|
||
then: {value: promise.then.bind(promise)},
|
||
catch: {value: promise.catch.bind(promise)},
|
||
[ChainedExecutor]: {value: executor},
|
||
});
|
||
};
|
||
|
||
module.exports = Git;
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1477:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
|
||
const {gitP} = __nccwpck_require__(941);
|
||
const {esModuleFactory, gitInstanceFactory, gitExportFactory} = __nccwpck_require__(1949);
|
||
|
||
module.exports = esModuleFactory(
|
||
gitExportFactory(gitInstanceFactory, {gitP})
|
||
);
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4732:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.TaskConfigurationError = exports.GitResponseError = exports.GitError = exports.GitConstructError = exports.ResetMode = exports.CheckRepoActions = exports.CleanOptions = void 0;
|
||
var clean_1 = __nccwpck_require__(4386);
|
||
Object.defineProperty(exports, "CleanOptions", ({ enumerable: true, get: function () { return clean_1.CleanOptions; } }));
|
||
var check_is_repo_1 = __nccwpck_require__(221);
|
||
Object.defineProperty(exports, "CheckRepoActions", ({ enumerable: true, get: function () { return check_is_repo_1.CheckRepoActions; } }));
|
||
var reset_1 = __nccwpck_require__(2377);
|
||
Object.defineProperty(exports, "ResetMode", ({ enumerable: true, get: function () { return reset_1.ResetMode; } }));
|
||
var git_construct_error_1 = __nccwpck_require__(1876);
|
||
Object.defineProperty(exports, "GitConstructError", ({ enumerable: true, get: function () { return git_construct_error_1.GitConstructError; } }));
|
||
var git_error_1 = __nccwpck_require__(5757);
|
||
Object.defineProperty(exports, "GitError", ({ enumerable: true, get: function () { return git_error_1.GitError; } }));
|
||
var git_response_error_1 = __nccwpck_require__(5131);
|
||
Object.defineProperty(exports, "GitResponseError", ({ enumerable: true, get: function () { return git_response_error_1.GitResponseError; } }));
|
||
var task_configuration_error_1 = __nccwpck_require__(740);
|
||
Object.defineProperty(exports, "TaskConfigurationError", ({ enumerable: true, get: function () { return task_configuration_error_1.TaskConfigurationError; } }));
|
||
//# sourceMappingURL=api.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1876:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.GitConstructError = void 0;
|
||
const git_error_1 = __nccwpck_require__(5757);
|
||
/**
|
||
* The `GitConstructError` is thrown when an error occurs in the constructor
|
||
* of the `simple-git` instance itself. Most commonly as a result of using
|
||
* a `baseDir` option that points to a folder that either does not exist,
|
||
* or cannot be read by the user the node script is running as.
|
||
*
|
||
* Check the `.message` property for more detail including the properties
|
||
* passed to the constructor.
|
||
*/
|
||
class GitConstructError extends git_error_1.GitError {
|
||
constructor(config, message) {
|
||
super(undefined, message);
|
||
this.config = config;
|
||
}
|
||
}
|
||
exports.GitConstructError = GitConstructError;
|
||
//# sourceMappingURL=git-construct-error.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 5757:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.GitError = void 0;
|
||
/**
|
||
* The `GitError` is thrown when the underlying `git` process throws a
|
||
* fatal exception (eg an `ENOENT` exception when attempting to use a
|
||
* non-writable directory as the root for your repo), and acts as the
|
||
* base class for more specific errors thrown by the parsing of the
|
||
* git response or errors in the configuration of the task about to
|
||
* be run.
|
||
*
|
||
* When an exception is thrown, pending tasks in the same instance will
|
||
* not be executed. The recommended way to run a series of tasks that
|
||
* can independently fail without needing to prevent future tasks from
|
||
* running is to catch them individually:
|
||
*
|
||
* ```typescript
|
||
import { gitP, SimpleGit, GitError, PullResult } from 'simple-git';
|
||
|
||
function catchTask (e: GitError) {
|
||
return e.
|
||
}
|
||
|
||
const git = gitP(repoWorkingDir);
|
||
const pulled: PullResult | GitError = await git.pull().catch(catchTask);
|
||
const pushed: string | GitError = await git.pushTags().catch(catchTask);
|
||
```
|
||
*/
|
||
class GitError extends Error {
|
||
constructor(task, message) {
|
||
super(message);
|
||
this.task = task;
|
||
Object.setPrototypeOf(this, new.target.prototype);
|
||
}
|
||
}
|
||
exports.GitError = GitError;
|
||
//# sourceMappingURL=git-error.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 5131:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.GitResponseError = void 0;
|
||
const git_error_1 = __nccwpck_require__(5757);
|
||
/**
|
||
* The `GitResponseError` is the wrapper for a parsed response that is treated as
|
||
* a fatal error, for example attempting a `merge` can leave the repo in a corrupted
|
||
* state when there are conflicts so the task will reject rather than resolve.
|
||
*
|
||
* For example, catching the merge conflict exception:
|
||
*
|
||
* ```typescript
|
||
import { gitP, SimpleGit, GitResponseError, MergeSummary } from 'simple-git';
|
||
|
||
const git = gitP(repoRoot);
|
||
const mergeOptions: string[] = ['--no-ff', 'other-branch'];
|
||
const mergeSummary: MergeSummary = await git.merge(mergeOptions)
|
||
.catch((e: GitResponseError<MergeSummary>) => e.git);
|
||
|
||
if (mergeSummary.failed) {
|
||
// deal with the error
|
||
}
|
||
```
|
||
*/
|
||
class GitResponseError extends git_error_1.GitError {
|
||
constructor(
|
||
/**
|
||
* `.git` access the parsed response that is treated as being an error
|
||
*/
|
||
git, message) {
|
||
super(undefined, message || String(git));
|
||
this.git = git;
|
||
}
|
||
}
|
||
exports.GitResponseError = GitResponseError;
|
||
//# sourceMappingURL=git-response-error.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 740:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.TaskConfigurationError = void 0;
|
||
const git_error_1 = __nccwpck_require__(5757);
|
||
/**
|
||
* The `TaskConfigurationError` is thrown when a command was incorrectly
|
||
* configured. An error of this kind means that no attempt was made to
|
||
* run your command through the underlying `git` binary.
|
||
*
|
||
* Check the `.message` property for more detail on why your configuration
|
||
* resulted in an error.
|
||
*/
|
||
class TaskConfigurationError extends git_error_1.GitError {
|
||
constructor(message) {
|
||
super(undefined, message);
|
||
}
|
||
}
|
||
exports.TaskConfigurationError = TaskConfigurationError;
|
||
//# sourceMappingURL=task-configuration-error.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 7178:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.GitLogger = exports.createLogger = exports.log = void 0;
|
||
const debug_1 = __nccwpck_require__(2179);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
debug_1.default.formatters.L = (value) => String(utils_1.filterHasLength(value) ? value.length : '-');
|
||
debug_1.default.formatters.B = (value) => {
|
||
if (Buffer.isBuffer(value)) {
|
||
return value.toString('utf8');
|
||
}
|
||
return utils_1.objectToString(value);
|
||
};
|
||
/**
|
||
* The shared debug logging instance
|
||
*/
|
||
exports.log = debug_1.default('simple-git');
|
||
function prefixedLogger(to, prefix, forward) {
|
||
if (!prefix || !String(prefix).replace(/\s*/, '')) {
|
||
return !forward ? to : (message, ...args) => {
|
||
to(message, ...args);
|
||
forward(message, ...args);
|
||
};
|
||
}
|
||
return (message, ...args) => {
|
||
to(`%s ${message}`, prefix, ...args);
|
||
if (forward) {
|
||
forward(message, ...args);
|
||
}
|
||
};
|
||
}
|
||
function childLoggerName(name, childDebugger, { namespace: parentNamespace }) {
|
||
if (typeof name === 'string') {
|
||
return name;
|
||
}
|
||
const childNamespace = childDebugger && childDebugger.namespace || '';
|
||
if (childNamespace.startsWith(parentNamespace)) {
|
||
return childNamespace.substr(parentNamespace.length + 1);
|
||
}
|
||
return childNamespace || parentNamespace;
|
||
}
|
||
function createLogger(label, verbose, initialStep, infoDebugger = exports.log) {
|
||
const labelPrefix = label && `[${label}]` || '';
|
||
const spawned = [];
|
||
const debugDebugger = (typeof verbose === 'string') ? infoDebugger.extend(verbose) : verbose;
|
||
const key = childLoggerName(utils_1.filterType(verbose, utils_1.filterString), debugDebugger, infoDebugger);
|
||
return step(initialStep);
|
||
function destroy() {
|
||
spawned.forEach(logger => logger.destroy());
|
||
spawned.length = 0;
|
||
}
|
||
function child(name) {
|
||
return utils_1.append(spawned, createLogger(label, debugDebugger && debugDebugger.extend(name) || name));
|
||
}
|
||
function sibling(name, initial) {
|
||
return utils_1.append(spawned, createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger));
|
||
}
|
||
function step(phase) {
|
||
const stepPrefix = phase && `[${phase}]` || '';
|
||
const debug = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || utils_1.NOOP;
|
||
const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug);
|
||
return Object.assign(debugDebugger ? debug : info, {
|
||
key,
|
||
label,
|
||
child,
|
||
sibling,
|
||
debug,
|
||
info,
|
||
step,
|
||
destroy,
|
||
});
|
||
}
|
||
}
|
||
exports.createLogger = createLogger;
|
||
/**
|
||
* The `GitLogger` is used by the main `SimpleGit` runner to handle logging
|
||
* any warnings or errors.
|
||
*/
|
||
class GitLogger {
|
||
constructor(_out = exports.log) {
|
||
this._out = _out;
|
||
this.error = prefixedLogger(_out, '[ERROR]');
|
||
this.warn = prefixedLogger(_out, '[WARN]');
|
||
}
|
||
silent(silence = false) {
|
||
if (silence !== this._out.enabled) {
|
||
return;
|
||
}
|
||
const { namespace } = this._out;
|
||
const env = (process.env.DEBUG || '').split(',').filter(s => !!s);
|
||
const hasOn = env.includes(namespace);
|
||
const hasOff = env.includes(`-${namespace}`);
|
||
// enabling the log
|
||
if (!silence) {
|
||
if (hasOff) {
|
||
utils_1.remove(env, `-${namespace}`);
|
||
}
|
||
else {
|
||
env.push(namespace);
|
||
}
|
||
}
|
||
else {
|
||
if (hasOn) {
|
||
utils_1.remove(env, namespace);
|
||
}
|
||
else {
|
||
env.push(`-${namespace}`);
|
||
}
|
||
}
|
||
debug_1.default.enable(env.join(','));
|
||
}
|
||
}
|
||
exports.GitLogger = GitLogger;
|
||
//# sourceMappingURL=git-logger.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6086:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.hasBranchDeletionError = exports.parseBranchDeletions = void 0;
|
||
const BranchDeleteSummary_1 = __nccwpck_require__(3755);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/;
|
||
const deleteErrorRegex = /^error[^']+'([^']+)'/m;
|
||
const parsers = [
|
||
new utils_1.LineParser(deleteSuccessRegex, (result, [branch, hash]) => {
|
||
const deletion = BranchDeleteSummary_1.branchDeletionSuccess(branch, hash);
|
||
result.all.push(deletion);
|
||
result.branches[branch] = deletion;
|
||
}),
|
||
new utils_1.LineParser(deleteErrorRegex, (result, [branch]) => {
|
||
const deletion = BranchDeleteSummary_1.branchDeletionFailure(branch);
|
||
result.errors.push(deletion);
|
||
result.all.push(deletion);
|
||
result.branches[branch] = deletion;
|
||
}),
|
||
];
|
||
const parseBranchDeletions = (stdOut) => {
|
||
return utils_1.parseStringResponse(new BranchDeleteSummary_1.BranchDeletionBatch(), parsers, stdOut);
|
||
};
|
||
exports.parseBranchDeletions = parseBranchDeletions;
|
||
function hasBranchDeletionError(data, processExitCode) {
|
||
return processExitCode === utils_1.ExitCodes.ERROR && deleteErrorRegex.test(data);
|
||
}
|
||
exports.hasBranchDeletionError = hasBranchDeletionError;
|
||
//# sourceMappingURL=parse-branch-delete.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9264:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseBranchSummary = void 0;
|
||
const BranchSummary_1 = __nccwpck_require__(4446);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const parsers = [
|
||
new utils_1.LineParser(/^(\*\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => {
|
||
result.push(!!current, true, name, commit, label);
|
||
}),
|
||
new utils_1.LineParser(/^(\*\s)?(\S+)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => {
|
||
result.push(!!current, false, name, commit, label);
|
||
})
|
||
];
|
||
function parseBranchSummary(stdOut) {
|
||
return utils_1.parseStringResponse(new BranchSummary_1.BranchSummaryResult(), parsers, stdOut);
|
||
}
|
||
exports.parseBranchSummary = parseBranchSummary;
|
||
//# sourceMappingURL=parse-branch.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3026:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseCommitResult = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const parsers = [
|
||
new utils_1.LineParser(/\[([^\s]+) ([^\]]+)/, (result, [branch, commit]) => {
|
||
result.branch = branch;
|
||
result.commit = commit;
|
||
}),
|
||
new utils_1.LineParser(/\s*Author:\s(.+)/i, (result, [author]) => {
|
||
const parts = author.split('<');
|
||
const email = parts.pop();
|
||
if (!email || !email.includes('@')) {
|
||
return;
|
||
}
|
||
result.author = {
|
||
email: email.substr(0, email.length - 1),
|
||
name: parts.join('<').trim()
|
||
};
|
||
}),
|
||
new utils_1.LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => {
|
||
result.summary.changes = parseInt(changes, 10) || 0;
|
||
result.summary.insertions = parseInt(insertions, 10) || 0;
|
||
result.summary.deletions = parseInt(deletions, 10) || 0;
|
||
}),
|
||
new utils_1.LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => {
|
||
result.summary.changes = parseInt(changes, 10) || 0;
|
||
const count = parseInt(lines, 10) || 0;
|
||
if (direction === '-') {
|
||
result.summary.deletions = count;
|
||
}
|
||
else if (direction === '+') {
|
||
result.summary.insertions = count;
|
||
}
|
||
}),
|
||
];
|
||
function parseCommitResult(stdOut) {
|
||
const result = {
|
||
author: null,
|
||
branch: '',
|
||
commit: '',
|
||
summary: {
|
||
changes: 0,
|
||
insertions: 0,
|
||
deletions: 0,
|
||
},
|
||
};
|
||
return utils_1.parseStringResponse(result, parsers, stdOut);
|
||
}
|
||
exports.parseCommitResult = parseCommitResult;
|
||
//# sourceMappingURL=parse-commit.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2024:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseDiffResult = void 0;
|
||
const DiffSummary_1 = __nccwpck_require__(4781);
|
||
function parseDiffResult(stdOut) {
|
||
const lines = stdOut.trim().split('\n');
|
||
const status = new DiffSummary_1.DiffSummary();
|
||
readSummaryLine(status, lines.pop());
|
||
for (let i = 0, max = lines.length; i < max; i++) {
|
||
const line = lines[i];
|
||
textFileChange(line, status) || binaryFileChange(line, status);
|
||
}
|
||
return status;
|
||
}
|
||
exports.parseDiffResult = parseDiffResult;
|
||
function readSummaryLine(status, summary) {
|
||
(summary || '')
|
||
.trim()
|
||
.split(', ')
|
||
.forEach(function (text) {
|
||
const summary = /(\d+)\s([a-z]+)/.exec(text);
|
||
if (!summary) {
|
||
return;
|
||
}
|
||
summaryType(status, summary[2], parseInt(summary[1], 10));
|
||
});
|
||
}
|
||
function summaryType(status, key, value) {
|
||
const match = (/([a-z]+?)s?\b/.exec(key));
|
||
if (!match || !statusUpdate[match[1]]) {
|
||
return;
|
||
}
|
||
statusUpdate[match[1]](status, value);
|
||
}
|
||
const statusUpdate = {
|
||
file(status, value) {
|
||
status.changed = value;
|
||
},
|
||
deletion(status, value) {
|
||
status.deletions = value;
|
||
},
|
||
insertion(status, value) {
|
||
status.insertions = value;
|
||
}
|
||
};
|
||
function textFileChange(input, { files }) {
|
||
const line = input.trim().match(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/);
|
||
if (line) {
|
||
var alterations = (line[3] || '').trim();
|
||
files.push({
|
||
file: line[1].trim(),
|
||
changes: parseInt(line[2], 10),
|
||
insertions: alterations.replace(/-/g, '').length,
|
||
deletions: alterations.replace(/\+/g, '').length,
|
||
binary: false
|
||
});
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
function binaryFileChange(input, { files }) {
|
||
const line = input.match(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)$/);
|
||
if (line) {
|
||
files.push({
|
||
file: line[1].trim(),
|
||
before: +line[2],
|
||
after: +line[3],
|
||
binary: true
|
||
});
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
//# sourceMappingURL=parse-diff-summary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6254:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseFetchResult = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const parsers = [
|
||
new utils_1.LineParser(/From (.+)$/, (result, [remote]) => {
|
||
result.remote = remote;
|
||
}),
|
||
new utils_1.LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
|
||
result.branches.push({
|
||
name,
|
||
tracking,
|
||
});
|
||
}),
|
||
new utils_1.LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
|
||
result.tags.push({
|
||
name,
|
||
tracking,
|
||
});
|
||
})
|
||
];
|
||
function parseFetchResult(stdOut, stdErr) {
|
||
const result = {
|
||
raw: stdOut,
|
||
remote: null,
|
||
branches: [],
|
||
tags: [],
|
||
};
|
||
return utils_1.parseStringResponse(result, parsers, stdOut, stdErr);
|
||
}
|
||
exports.parseFetchResult = parseFetchResult;
|
||
//# sourceMappingURL=parse-fetch.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9729:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.createListLogSummaryParser = exports.SPLITTER = exports.COMMIT_BOUNDARY = exports.START_BOUNDARY = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const parse_diff_summary_1 = __nccwpck_require__(2024);
|
||
exports.START_BOUNDARY = 'òòòòòò ';
|
||
exports.COMMIT_BOUNDARY = ' òò';
|
||
exports.SPLITTER = ' ò ';
|
||
const defaultFieldNames = ['hash', 'date', 'message', 'refs', 'author_name', 'author_email'];
|
||
function lineBuilder(tokens, fields) {
|
||
return fields.reduce((line, field, index) => {
|
||
line[field] = tokens[index] || '';
|
||
return line;
|
||
}, Object.create({ diff: null }));
|
||
}
|
||
function createListLogSummaryParser(splitter = exports.SPLITTER, fields = defaultFieldNames) {
|
||
return function (stdOut) {
|
||
const all = utils_1.toLinesWithContent(stdOut, true, exports.START_BOUNDARY)
|
||
.map(function (item) {
|
||
const lineDetail = item.trim().split(exports.COMMIT_BOUNDARY);
|
||
const listLogLine = lineBuilder(lineDetail[0].trim().split(splitter), fields);
|
||
if (lineDetail.length > 1 && !!lineDetail[1].trim()) {
|
||
listLogLine.diff = parse_diff_summary_1.parseDiffResult(lineDetail[1]);
|
||
}
|
||
return listLogLine;
|
||
});
|
||
return {
|
||
all,
|
||
latest: all.length && all[0] || null,
|
||
total: all.length,
|
||
};
|
||
};
|
||
}
|
||
exports.createListLogSummaryParser = createListLogSummaryParser;
|
||
//# sourceMappingURL=parse-list-log-summary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6412:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseMergeDetail = exports.parseMergeResult = void 0;
|
||
const MergeSummary_1 = __nccwpck_require__(1651);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const parse_pull_1 = __nccwpck_require__(5658);
|
||
const parsers = [
|
||
new utils_1.LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => {
|
||
summary.merges.push(autoMerge);
|
||
}),
|
||
new utils_1.LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => {
|
||
summary.conflicts.push(new MergeSummary_1.MergeSummaryConflict(reason, file));
|
||
}),
|
||
new utils_1.LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => {
|
||
summary.conflicts.push(new MergeSummary_1.MergeSummaryConflict(reason, file, { deleteRef }));
|
||
}),
|
||
new utils_1.LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
|
||
summary.conflicts.push(new MergeSummary_1.MergeSummaryConflict(reason, null));
|
||
}),
|
||
new utils_1.LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => {
|
||
summary.result = result;
|
||
}),
|
||
];
|
||
/**
|
||
* Parse the complete response from `git.merge`
|
||
*/
|
||
const parseMergeResult = (stdOut, stdErr) => {
|
||
return Object.assign(exports.parseMergeDetail(stdOut, stdErr), parse_pull_1.parsePullResult(stdOut, stdErr));
|
||
};
|
||
exports.parseMergeResult = parseMergeResult;
|
||
/**
|
||
* Parse the merge specific detail (ie: not the content also available in the pull detail) from `git.mnerge`
|
||
* @param stdOut
|
||
*/
|
||
const parseMergeDetail = (stdOut) => {
|
||
return utils_1.parseStringResponse(new MergeSummary_1.MergeSummaryDetail(), parsers, stdOut);
|
||
};
|
||
exports.parseMergeDetail = parseMergeDetail;
|
||
//# sourceMappingURL=parse-merge.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 7444:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseMoveResult = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const parsers = [
|
||
new utils_1.LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {
|
||
result.moves.push({ from, to });
|
||
}),
|
||
];
|
||
function parseMoveResult(stdOut) {
|
||
return utils_1.parseStringResponse({ moves: [] }, parsers, stdOut);
|
||
}
|
||
exports.parseMoveResult = parseMoveResult;
|
||
//# sourceMappingURL=parse-move.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 5658:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parsePullResult = exports.parsePullDetail = void 0;
|
||
const PullSummary_1 = __nccwpck_require__(3567);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const parse_remote_messages_1 = __nccwpck_require__(2661);
|
||
const FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;
|
||
const SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;
|
||
const ACTION_REGEX = /^(create|delete) mode \d+ (.+)/;
|
||
const parsers = [
|
||
new utils_1.LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {
|
||
result.files.push(file);
|
||
if (insertions) {
|
||
result.insertions[file] = insertions.length;
|
||
}
|
||
if (deletions) {
|
||
result.deletions[file] = deletions.length;
|
||
}
|
||
}),
|
||
new utils_1.LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {
|
||
if (insertions !== undefined || deletions !== undefined) {
|
||
result.summary.changes = +changes || 0;
|
||
result.summary.insertions = +insertions || 0;
|
||
result.summary.deletions = +deletions || 0;
|
||
return true;
|
||
}
|
||
return false;
|
||
}),
|
||
new utils_1.LineParser(ACTION_REGEX, (result, [action, file]) => {
|
||
utils_1.append(result.files, file);
|
||
utils_1.append((action === 'create') ? result.created : result.deleted, file);
|
||
}),
|
||
];
|
||
const parsePullDetail = (stdOut, stdErr) => {
|
||
return utils_1.parseStringResponse(new PullSummary_1.PullSummary(), parsers, stdOut, stdErr);
|
||
};
|
||
exports.parsePullDetail = parsePullDetail;
|
||
const parsePullResult = (stdOut, stdErr) => {
|
||
return Object.assign(new PullSummary_1.PullSummary(), exports.parsePullDetail(stdOut, stdErr), parse_remote_messages_1.parseRemoteMessages(stdOut, stdErr));
|
||
};
|
||
exports.parsePullResult = parsePullResult;
|
||
//# sourceMappingURL=parse-pull.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8530:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parsePushDetail = exports.parsePushResult = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const parse_remote_messages_1 = __nccwpck_require__(2661);
|
||
function pushResultPushedItem(local, remote, status) {
|
||
const deleted = status.includes('deleted');
|
||
const tag = status.includes('tag') || /^refs\/tags/.test(local);
|
||
const alreadyUpdated = !status.includes('new');
|
||
return {
|
||
deleted,
|
||
tag,
|
||
branch: !tag,
|
||
new: !alreadyUpdated,
|
||
alreadyUpdated,
|
||
local,
|
||
remote,
|
||
};
|
||
}
|
||
const parsers = [
|
||
new utils_1.LineParser(/^Pushing to (.+)$/, (result, [repo]) => {
|
||
result.repo = repo;
|
||
}),
|
||
new utils_1.LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
|
||
result.ref = Object.assign(Object.assign({}, (result.ref || {})), { local });
|
||
}),
|
||
new utils_1.LineParser(/^[*-=]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
|
||
result.pushed.push(pushResultPushedItem(local, remote, type));
|
||
}),
|
||
new utils_1.LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => {
|
||
result.branch = Object.assign(Object.assign({}, (result.branch || {})), { local,
|
||
remote,
|
||
remoteName });
|
||
}),
|
||
new utils_1.LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => {
|
||
result.update = {
|
||
head: {
|
||
local,
|
||
remote,
|
||
},
|
||
hash: {
|
||
from,
|
||
to,
|
||
},
|
||
};
|
||
}),
|
||
];
|
||
const parsePushResult = (stdOut, stdErr) => {
|
||
const pushDetail = exports.parsePushDetail(stdOut, stdErr);
|
||
const responseDetail = parse_remote_messages_1.parseRemoteMessages(stdOut, stdErr);
|
||
return Object.assign(Object.assign({}, pushDetail), responseDetail);
|
||
};
|
||
exports.parsePushResult = parsePushResult;
|
||
const parsePushDetail = (stdOut, stdErr) => {
|
||
return utils_1.parseStringResponse({ pushed: [] }, parsers, stdOut, stdErr);
|
||
};
|
||
exports.parsePushDetail = parsePushDetail;
|
||
//# sourceMappingURL=parse-push.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2661:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.RemoteMessageSummary = exports.parseRemoteMessages = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const parse_remote_objects_1 = __nccwpck_require__(3565);
|
||
const parsers = [
|
||
new utils_1.RemoteLineParser(/^remote:\s*(.+)$/, (result, [text]) => {
|
||
result.remoteMessages.all.push(text.trim());
|
||
return false;
|
||
}),
|
||
...parse_remote_objects_1.remoteMessagesObjectParsers,
|
||
new utils_1.RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => {
|
||
result.remoteMessages.pullRequestUrl = pullRequestUrl;
|
||
}),
|
||
new utils_1.RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => {
|
||
result.remoteMessages.vulnerabilities = {
|
||
count: utils_1.asNumber(count),
|
||
summary,
|
||
url,
|
||
};
|
||
}),
|
||
];
|
||
function parseRemoteMessages(_stdOut, stdErr) {
|
||
return utils_1.parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers, stdErr);
|
||
}
|
||
exports.parseRemoteMessages = parseRemoteMessages;
|
||
class RemoteMessageSummary {
|
||
constructor() {
|
||
this.all = [];
|
||
}
|
||
}
|
||
exports.RemoteMessageSummary = RemoteMessageSummary;
|
||
//# sourceMappingURL=parse-remote-messages.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3565:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.remoteMessagesObjectParsers = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
function objectEnumerationResult(remoteMessages) {
|
||
return (remoteMessages.objects = remoteMessages.objects || {
|
||
compressing: 0,
|
||
counting: 0,
|
||
enumerating: 0,
|
||
packReused: 0,
|
||
reused: { count: 0, delta: 0 },
|
||
total: { count: 0, delta: 0 }
|
||
});
|
||
}
|
||
function asObjectCount(source) {
|
||
const count = /^\s*(\d+)/.exec(source);
|
||
const delta = /delta (\d+)/i.exec(source);
|
||
return {
|
||
count: utils_1.asNumber(count && count[1] || '0'),
|
||
delta: utils_1.asNumber(delta && delta[1] || '0'),
|
||
};
|
||
}
|
||
exports.remoteMessagesObjectParsers = [
|
||
new utils_1.RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => {
|
||
const key = action.toLowerCase();
|
||
const enumeration = objectEnumerationResult(result.remoteMessages);
|
||
Object.assign(enumeration, { [key]: utils_1.asNumber(count) });
|
||
}),
|
||
new utils_1.RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => {
|
||
const key = action.toLowerCase();
|
||
const enumeration = objectEnumerationResult(result.remoteMessages);
|
||
Object.assign(enumeration, { [key]: utils_1.asNumber(count) });
|
||
}),
|
||
new utils_1.RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => {
|
||
const objects = objectEnumerationResult(result.remoteMessages);
|
||
objects.total = asObjectCount(total);
|
||
objects.reused = asObjectCount(reused);
|
||
objects.packReused = utils_1.asNumber(packReused);
|
||
}),
|
||
];
|
||
//# sourceMappingURL=parse-remote-objects.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3755:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.isSingleBranchDeleteFailure = exports.branchDeletionFailure = exports.branchDeletionSuccess = exports.BranchDeletionBatch = void 0;
|
||
class BranchDeletionBatch {
|
||
constructor() {
|
||
this.all = [];
|
||
this.branches = {};
|
||
this.errors = [];
|
||
}
|
||
get success() {
|
||
return !this.errors.length;
|
||
}
|
||
}
|
||
exports.BranchDeletionBatch = BranchDeletionBatch;
|
||
function branchDeletionSuccess(branch, hash) {
|
||
return {
|
||
branch, hash, success: true,
|
||
};
|
||
}
|
||
exports.branchDeletionSuccess = branchDeletionSuccess;
|
||
function branchDeletionFailure(branch) {
|
||
return {
|
||
branch, hash: null, success: false,
|
||
};
|
||
}
|
||
exports.branchDeletionFailure = branchDeletionFailure;
|
||
function isSingleBranchDeleteFailure(test) {
|
||
return test.success;
|
||
}
|
||
exports.isSingleBranchDeleteFailure = isSingleBranchDeleteFailure;
|
||
//# sourceMappingURL=BranchDeleteSummary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4446:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.BranchSummaryResult = void 0;
|
||
class BranchSummaryResult {
|
||
constructor() {
|
||
this.all = [];
|
||
this.branches = {};
|
||
this.current = '';
|
||
this.detached = false;
|
||
}
|
||
push(current, detached, name, commit, label) {
|
||
if (current) {
|
||
this.detached = detached;
|
||
this.current = name;
|
||
}
|
||
this.all.push(name);
|
||
this.branches[name] = {
|
||
current: current,
|
||
name: name,
|
||
commit: commit,
|
||
label: label
|
||
};
|
||
}
|
||
}
|
||
exports.BranchSummaryResult = BranchSummaryResult;
|
||
//# sourceMappingURL=BranchSummary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9926:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseCheckIgnore = void 0;
|
||
/**
|
||
* Parser for the `check-ignore` command - returns each file as a string array
|
||
*/
|
||
const parseCheckIgnore = (text) => {
|
||
return text.split(/\n/g)
|
||
.map(line => line.trim())
|
||
.filter(file => !!file);
|
||
};
|
||
exports.parseCheckIgnore = parseCheckIgnore;
|
||
//# sourceMappingURL=CheckIgnore.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 5689:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.cleanSummaryParser = exports.CleanResponse = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
class CleanResponse {
|
||
constructor(dryRun) {
|
||
this.dryRun = dryRun;
|
||
this.paths = [];
|
||
this.files = [];
|
||
this.folders = [];
|
||
}
|
||
}
|
||
exports.CleanResponse = CleanResponse;
|
||
const removalRegexp = /^[a-z]+\s*/i;
|
||
const dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i;
|
||
const isFolderRegexp = /\/$/;
|
||
function cleanSummaryParser(dryRun, text) {
|
||
const summary = new CleanResponse(dryRun);
|
||
const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;
|
||
utils_1.toLinesWithContent(text).forEach(line => {
|
||
const removed = line.replace(regexp, '');
|
||
summary.paths.push(removed);
|
||
(isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);
|
||
});
|
||
return summary;
|
||
}
|
||
exports.cleanSummaryParser = cleanSummaryParser;
|
||
//# sourceMappingURL=CleanSummary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 7219:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.configListParser = exports.ConfigList = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
class ConfigList {
|
||
constructor() {
|
||
this.files = [];
|
||
this.values = Object.create(null);
|
||
}
|
||
get all() {
|
||
if (!this._all) {
|
||
this._all = this.files.reduce((all, file) => {
|
||
return Object.assign(all, this.values[file]);
|
||
}, {});
|
||
}
|
||
return this._all;
|
||
}
|
||
addFile(file) {
|
||
if (!(file in this.values)) {
|
||
const latest = utils_1.last(this.files);
|
||
this.values[file] = latest ? Object.create(this.values[latest]) : {};
|
||
this.files.push(file);
|
||
}
|
||
return this.values[file];
|
||
}
|
||
addValue(file, key, value) {
|
||
const values = this.addFile(file);
|
||
if (!values.hasOwnProperty(key)) {
|
||
values[key] = value;
|
||
}
|
||
else if (Array.isArray(values[key])) {
|
||
values[key].push(value);
|
||
}
|
||
else {
|
||
values[key] = [values[key], value];
|
||
}
|
||
this._all = undefined;
|
||
}
|
||
}
|
||
exports.ConfigList = ConfigList;
|
||
function configListParser(text) {
|
||
const config = new ConfigList();
|
||
const lines = text.split('\0');
|
||
for (let i = 0, max = lines.length - 1; i < max;) {
|
||
const file = configFilePath(lines[i++]);
|
||
const [key, value] = utils_1.splitOn(lines[i++], '\n');
|
||
config.addValue(file, key, value);
|
||
}
|
||
return config;
|
||
}
|
||
exports.configListParser = configListParser;
|
||
function configFilePath(filePath) {
|
||
return filePath.replace(/^(file):/, '');
|
||
}
|
||
//# sourceMappingURL=ConfigList.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4781:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.DiffSummary = void 0;
|
||
/***
|
||
* The DiffSummary is returned as a response to getting `git().status()`
|
||
*/
|
||
class DiffSummary {
|
||
constructor() {
|
||
this.changed = 0;
|
||
this.deletions = 0;
|
||
this.insertions = 0;
|
||
this.files = [];
|
||
}
|
||
}
|
||
exports.DiffSummary = DiffSummary;
|
||
//# sourceMappingURL=DiffSummary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 860:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.FileStatusSummary = exports.fromPathRegex = void 0;
|
||
exports.fromPathRegex = /^(.+) -> (.+)$/;
|
||
class FileStatusSummary {
|
||
constructor(path, index, working_dir) {
|
||
this.path = path;
|
||
this.index = index;
|
||
this.working_dir = working_dir;
|
||
if ('R' === (index + working_dir)) {
|
||
const detail = exports.fromPathRegex.exec(path) || [null, path, path];
|
||
this.from = detail[1] || '';
|
||
this.path = detail[2] || '';
|
||
}
|
||
}
|
||
}
|
||
exports.FileStatusSummary = FileStatusSummary;
|
||
//# sourceMappingURL=FileStatusSummary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9999:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseGetRemotesVerbose = exports.parseGetRemotes = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
function parseGetRemotes(text) {
|
||
const remotes = {};
|
||
forEach(text, ([name]) => remotes[name] = { name });
|
||
return Object.values(remotes);
|
||
}
|
||
exports.parseGetRemotes = parseGetRemotes;
|
||
function parseGetRemotesVerbose(text) {
|
||
const remotes = {};
|
||
forEach(text, ([name, url, purpose]) => {
|
||
if (!remotes.hasOwnProperty(name)) {
|
||
remotes[name] = {
|
||
name: name,
|
||
refs: { fetch: '', push: '' },
|
||
};
|
||
}
|
||
if (purpose && url) {
|
||
remotes[name].refs[purpose.replace(/[^a-z]/g, '')] = url;
|
||
}
|
||
});
|
||
return Object.values(remotes);
|
||
}
|
||
exports.parseGetRemotesVerbose = parseGetRemotesVerbose;
|
||
function forEach(text, handler) {
|
||
utils_1.forEachLineWithContent(text, (line) => handler(line.split(/\s+/)));
|
||
}
|
||
//# sourceMappingURL=GetRemoteSummary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8690:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseInit = exports.InitSummary = void 0;
|
||
class InitSummary {
|
||
constructor(bare, path, existing, gitDir) {
|
||
this.bare = bare;
|
||
this.path = path;
|
||
this.existing = existing;
|
||
this.gitDir = gitDir;
|
||
}
|
||
}
|
||
exports.InitSummary = InitSummary;
|
||
const initResponseRegex = /^Init.+ repository in (.+)$/;
|
||
const reInitResponseRegex = /^Rein.+ in (.+)$/;
|
||
function parseInit(bare, path, text) {
|
||
const response = String(text).trim();
|
||
let result;
|
||
if ((result = initResponseRegex.exec(response))) {
|
||
return new InitSummary(bare, path, false, result[1]);
|
||
}
|
||
if ((result = reInitResponseRegex.exec(response))) {
|
||
return new InitSummary(bare, path, true, result[1]);
|
||
}
|
||
let gitDir = '';
|
||
const tokens = response.split(' ');
|
||
while (tokens.length) {
|
||
const token = tokens.shift();
|
||
if (token === 'in') {
|
||
gitDir = tokens.join(' ');
|
||
break;
|
||
}
|
||
}
|
||
return new InitSummary(bare, path, /^re/i.test(response), gitDir);
|
||
}
|
||
exports.parseInit = parseInit;
|
||
//# sourceMappingURL=InitSummary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1651:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.MergeSummaryDetail = exports.MergeSummaryConflict = void 0;
|
||
class MergeSummaryConflict {
|
||
constructor(reason, file = null, meta) {
|
||
this.reason = reason;
|
||
this.file = file;
|
||
this.meta = meta;
|
||
}
|
||
toString() {
|
||
return `${this.file}:${this.reason}`;
|
||
}
|
||
}
|
||
exports.MergeSummaryConflict = MergeSummaryConflict;
|
||
class MergeSummaryDetail {
|
||
constructor() {
|
||
this.conflicts = [];
|
||
this.merges = [];
|
||
this.result = 'success';
|
||
}
|
||
get failed() {
|
||
return this.conflicts.length > 0;
|
||
}
|
||
get reason() {
|
||
return this.result;
|
||
}
|
||
toString() {
|
||
if (this.conflicts.length) {
|
||
return `CONFLICTS: ${this.conflicts.join(', ')}`;
|
||
}
|
||
return 'OK';
|
||
}
|
||
}
|
||
exports.MergeSummaryDetail = MergeSummaryDetail;
|
||
//# sourceMappingURL=MergeSummary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3567:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.PullSummary = void 0;
|
||
class PullSummary {
|
||
constructor() {
|
||
this.remoteMessages = {
|
||
all: [],
|
||
};
|
||
this.created = [];
|
||
this.deleted = [];
|
||
this.files = [];
|
||
this.deletions = {};
|
||
this.insertions = {};
|
||
this.summary = {
|
||
changes: 0,
|
||
deletions: 0,
|
||
insertions: 0,
|
||
};
|
||
}
|
||
}
|
||
exports.PullSummary = PullSummary;
|
||
//# sourceMappingURL=PullSummary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6790:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseStatusSummary = exports.StatusSummary = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const FileStatusSummary_1 = __nccwpck_require__(860);
|
||
/**
|
||
* The StatusSummary is returned as a response to getting `git().status()`
|
||
*/
|
||
class StatusSummary {
|
||
constructor() {
|
||
this.not_added = [];
|
||
this.conflicted = [];
|
||
this.created = [];
|
||
this.deleted = [];
|
||
this.modified = [];
|
||
this.renamed = [];
|
||
/**
|
||
* All files represented as an array of objects containing the `path` and status in `index` and
|
||
* in the `working_dir`.
|
||
*/
|
||
this.files = [];
|
||
this.staged = [];
|
||
/**
|
||
* Number of commits ahead of the tracked branch
|
||
*/
|
||
this.ahead = 0;
|
||
/**
|
||
*Number of commits behind the tracked branch
|
||
*/
|
||
this.behind = 0;
|
||
/**
|
||
* Name of the current branch
|
||
*/
|
||
this.current = null;
|
||
/**
|
||
* Name of the branch being tracked
|
||
*/
|
||
this.tracking = null;
|
||
}
|
||
/**
|
||
* Gets whether this StatusSummary represents a clean working branch.
|
||
*/
|
||
isClean() {
|
||
return !this.files.length;
|
||
}
|
||
}
|
||
exports.StatusSummary = StatusSummary;
|
||
var PorcelainFileStatus;
|
||
(function (PorcelainFileStatus) {
|
||
PorcelainFileStatus["ADDED"] = "A";
|
||
PorcelainFileStatus["DELETED"] = "D";
|
||
PorcelainFileStatus["MODIFIED"] = "M";
|
||
PorcelainFileStatus["RENAMED"] = "R";
|
||
PorcelainFileStatus["COPIED"] = "C";
|
||
PorcelainFileStatus["UNMERGED"] = "U";
|
||
PorcelainFileStatus["UNTRACKED"] = "?";
|
||
PorcelainFileStatus["IGNORED"] = "!";
|
||
PorcelainFileStatus["NONE"] = " ";
|
||
})(PorcelainFileStatus || (PorcelainFileStatus = {}));
|
||
function renamedFile(line) {
|
||
const detail = /^(.+) -> (.+)$/.exec(line);
|
||
if (!detail) {
|
||
return {
|
||
from: line, to: line
|
||
};
|
||
}
|
||
return {
|
||
from: String(detail[1]),
|
||
to: String(detail[2]),
|
||
};
|
||
}
|
||
function parser(indexX, indexY, handler) {
|
||
return [`${indexX}${indexY}`, handler];
|
||
}
|
||
function conflicts(indexX, ...indexY) {
|
||
return indexY.map(y => parser(indexX, y, (result, file) => utils_1.append(result.conflicted, file)));
|
||
}
|
||
const parsers = new Map([
|
||
parser(PorcelainFileStatus.NONE, PorcelainFileStatus.ADDED, (result, file) => utils_1.append(result.created, file)),
|
||
parser(PorcelainFileStatus.NONE, PorcelainFileStatus.DELETED, (result, file) => utils_1.append(result.deleted, file)),
|
||
parser(PorcelainFileStatus.NONE, PorcelainFileStatus.MODIFIED, (result, file) => utils_1.append(result.modified, file)),
|
||
parser(PorcelainFileStatus.ADDED, PorcelainFileStatus.NONE, (result, file) => utils_1.append(result.created, file) && utils_1.append(result.staged, file)),
|
||
parser(PorcelainFileStatus.ADDED, PorcelainFileStatus.MODIFIED, (result, file) => utils_1.append(result.created, file) && utils_1.append(result.staged, file) && utils_1.append(result.modified, file)),
|
||
parser(PorcelainFileStatus.DELETED, PorcelainFileStatus.NONE, (result, file) => utils_1.append(result.deleted, file) && utils_1.append(result.staged, file)),
|
||
parser(PorcelainFileStatus.MODIFIED, PorcelainFileStatus.NONE, (result, file) => utils_1.append(result.modified, file) && utils_1.append(result.staged, file)),
|
||
parser(PorcelainFileStatus.MODIFIED, PorcelainFileStatus.MODIFIED, (result, file) => utils_1.append(result.modified, file) && utils_1.append(result.staged, file)),
|
||
parser(PorcelainFileStatus.RENAMED, PorcelainFileStatus.NONE, (result, file) => {
|
||
utils_1.append(result.renamed, renamedFile(file));
|
||
}),
|
||
parser(PorcelainFileStatus.RENAMED, PorcelainFileStatus.MODIFIED, (result, file) => {
|
||
const renamed = renamedFile(file);
|
||
utils_1.append(result.renamed, renamed);
|
||
utils_1.append(result.modified, renamed.to);
|
||
}),
|
||
parser(PorcelainFileStatus.UNTRACKED, PorcelainFileStatus.UNTRACKED, (result, file) => utils_1.append(result.not_added, file)),
|
||
...conflicts(PorcelainFileStatus.ADDED, PorcelainFileStatus.ADDED, PorcelainFileStatus.UNMERGED),
|
||
...conflicts(PorcelainFileStatus.DELETED, PorcelainFileStatus.DELETED, PorcelainFileStatus.UNMERGED),
|
||
...conflicts(PorcelainFileStatus.UNMERGED, PorcelainFileStatus.ADDED, PorcelainFileStatus.DELETED, PorcelainFileStatus.UNMERGED),
|
||
['##', (result, line) => {
|
||
const aheadReg = /ahead (\d+)/;
|
||
const behindReg = /behind (\d+)/;
|
||
const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
|
||
const trackingReg = /\.{3}(\S*)/;
|
||
const onEmptyBranchReg = /\son\s([\S]+)$/;
|
||
let regexResult;
|
||
regexResult = aheadReg.exec(line);
|
||
result.ahead = regexResult && +regexResult[1] || 0;
|
||
regexResult = behindReg.exec(line);
|
||
result.behind = regexResult && +regexResult[1] || 0;
|
||
regexResult = currentReg.exec(line);
|
||
result.current = regexResult && regexResult[1];
|
||
regexResult = trackingReg.exec(line);
|
||
result.tracking = regexResult && regexResult[1];
|
||
regexResult = onEmptyBranchReg.exec(line);
|
||
result.current = regexResult && regexResult[1] || result.current;
|
||
}]
|
||
]);
|
||
const parseStatusSummary = function (text) {
|
||
const lines = text.trim().split('\n');
|
||
const status = new StatusSummary();
|
||
for (let i = 0, l = lines.length; i < l; i++) {
|
||
splitLine(status, lines[i]);
|
||
}
|
||
return status;
|
||
};
|
||
exports.parseStatusSummary = parseStatusSummary;
|
||
function splitLine(result, lineStr) {
|
||
const trimmed = lineStr.trim();
|
||
switch (' ') {
|
||
case trimmed.charAt(2):
|
||
return data(trimmed.charAt(0), trimmed.charAt(1), trimmed.substr(3));
|
||
case trimmed.charAt(1):
|
||
return data(PorcelainFileStatus.NONE, trimmed.charAt(0), trimmed.substr(2));
|
||
default:
|
||
return;
|
||
}
|
||
function data(index, workingDir, path) {
|
||
const raw = `${index}${workingDir}`;
|
||
const handler = parsers.get(raw);
|
||
if (handler) {
|
||
handler(result, path);
|
||
}
|
||
if (raw !== '##') {
|
||
result.files.push(new FileStatusSummary_1.FileStatusSummary(path, index, workingDir));
|
||
}
|
||
}
|
||
}
|
||
//# sourceMappingURL=StatusSummary.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4539:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseTagList = exports.TagList = void 0;
|
||
class TagList {
|
||
constructor(all, latest) {
|
||
this.all = all;
|
||
this.latest = latest;
|
||
}
|
||
}
|
||
exports.TagList = TagList;
|
||
const parseTagList = function (data, customSort = false) {
|
||
const tags = data
|
||
.split('\n')
|
||
.map(trimmed)
|
||
.filter(Boolean);
|
||
if (!customSort) {
|
||
tags.sort(function (tagA, tagB) {
|
||
const partsA = tagA.split('.');
|
||
const partsB = tagB.split('.');
|
||
if (partsA.length === 1 || partsB.length === 1) {
|
||
return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));
|
||
}
|
||
for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {
|
||
const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));
|
||
if (diff) {
|
||
return diff;
|
||
}
|
||
}
|
||
return 0;
|
||
});
|
||
}
|
||
const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf('.') >= 0);
|
||
return new TagList(tags, latest);
|
||
};
|
||
exports.parseTagList = parseTagList;
|
||
function singleSorted(a, b) {
|
||
const aIsNum = isNaN(a);
|
||
const bIsNum = isNaN(b);
|
||
if (aIsNum !== bIsNum) {
|
||
return aIsNum ? 1 : -1;
|
||
}
|
||
return aIsNum ? sorted(a, b) : 0;
|
||
}
|
||
function sorted(a, b) {
|
||
return a === b ? 0 : a > b ? 1 : -1;
|
||
}
|
||
function trimmed(input) {
|
||
return input.trim();
|
||
}
|
||
function toNumber(input) {
|
||
if (typeof input === 'string') {
|
||
return parseInt(input.replace(/^\D+/g, ''), 10) || 0;
|
||
}
|
||
return 0;
|
||
}
|
||
//# sourceMappingURL=TagList.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8543:
|
||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
return new (P || (P = Promise))(function (resolve, reject) {
|
||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
});
|
||
};
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.GitExecutorChain = void 0;
|
||
const child_process_1 = __nccwpck_require__(3129);
|
||
const api_1 = __nccwpck_require__(4732);
|
||
const task_1 = __nccwpck_require__(2815);
|
||
const tasks_pending_queue_1 = __nccwpck_require__(6676);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
class GitExecutorChain {
|
||
constructor(_executor, _scheduler) {
|
||
this._executor = _executor;
|
||
this._scheduler = _scheduler;
|
||
this._chain = Promise.resolve();
|
||
this._queue = new tasks_pending_queue_1.TasksPendingQueue();
|
||
}
|
||
get binary() {
|
||
return this._executor.binary;
|
||
}
|
||
get outputHandler() {
|
||
return this._executor.outputHandler;
|
||
}
|
||
get cwd() {
|
||
return this._executor.cwd;
|
||
}
|
||
get env() {
|
||
return this._executor.env;
|
||
}
|
||
push(task) {
|
||
this._queue.push(task);
|
||
return this._chain = this._chain.then(() => this.attemptTask(task));
|
||
}
|
||
attemptTask(task) {
|
||
return __awaiter(this, void 0, void 0, function* () {
|
||
const onScheduleComplete = yield this._scheduler.next();
|
||
const onQueueComplete = () => this._queue.complete(task);
|
||
try {
|
||
const { logger } = this._queue.attempt(task);
|
||
return yield (task_1.isEmptyTask(task)
|
||
? this.attemptEmptyTask(task, logger)
|
||
: this.attemptRemoteTask(task, logger));
|
||
}
|
||
catch (e) {
|
||
throw this.onFatalException(task, e);
|
||
}
|
||
finally {
|
||
onQueueComplete();
|
||
onScheduleComplete();
|
||
}
|
||
});
|
||
}
|
||
onFatalException(task, e) {
|
||
const gitError = (e instanceof api_1.GitError) ? Object.assign(e, { task }) : new api_1.GitError(task, e && String(e));
|
||
this._chain = Promise.resolve();
|
||
this._queue.fatal(gitError);
|
||
return gitError;
|
||
}
|
||
attemptRemoteTask(task, logger) {
|
||
return __awaiter(this, void 0, void 0, function* () {
|
||
const raw = yield this.gitResponse(this.binary, task.commands, this.outputHandler, logger.step('SPAWN'));
|
||
const outputStreams = yield this.handleTaskData(task, raw, logger.step('HANDLE'));
|
||
logger(`passing response to task's parser as a %s`, task.format);
|
||
if (task_1.isBufferTask(task)) {
|
||
return utils_1.callTaskParser(task.parser, outputStreams);
|
||
}
|
||
return utils_1.callTaskParser(task.parser, outputStreams.asStrings());
|
||
});
|
||
}
|
||
attemptEmptyTask(task, logger) {
|
||
return __awaiter(this, void 0, void 0, function* () {
|
||
logger(`empty task bypassing child process to call to task's parser`);
|
||
return task.parser();
|
||
});
|
||
}
|
||
handleTaskData({ onError, concatStdErr }, { exitCode, stdOut, stdErr }, logger) {
|
||
return new Promise((done, fail) => {
|
||
logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
|
||
if (exitCode && stdErr.length && onError) {
|
||
logger.info(`exitCode=%s handling with custom error handler`);
|
||
logger(`concatenate stdErr to stdOut: %j`, concatStdErr);
|
||
return onError(exitCode, Buffer.concat([...(concatStdErr ? stdOut : []), ...stdErr]).toString('utf-8'), (result) => {
|
||
logger.info(`custom error handler treated as success`);
|
||
logger(`custom error returned a %s`, utils_1.objectToString(result));
|
||
done(new utils_1.GitOutputStreams(Buffer.isBuffer(result) ? result : Buffer.from(String(result)), Buffer.concat(stdErr)));
|
||
}, fail);
|
||
}
|
||
if (exitCode && stdErr.length) {
|
||
logger.info(`exitCode=%s treated as error when then child process has written to stdErr`);
|
||
return fail(Buffer.concat(stdErr).toString('utf-8'));
|
||
}
|
||
if (concatStdErr) {
|
||
logger(`concatenating stdErr onto stdOut before processing`);
|
||
logger(`stdErr: $O`, stdErr);
|
||
stdOut.push(...stdErr);
|
||
}
|
||
logger.info(`retrieving task output complete`);
|
||
done(new utils_1.GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
|
||
});
|
||
}
|
||
gitResponse(command, args, outputHandler, logger) {
|
||
return __awaiter(this, void 0, void 0, function* () {
|
||
const outputLogger = logger.sibling('output');
|
||
const spawnOptions = {
|
||
cwd: this.cwd,
|
||
env: this.env,
|
||
windowsHide: true,
|
||
};
|
||
return new Promise((done) => {
|
||
const stdOut = [];
|
||
const stdErr = [];
|
||
let attempted = false;
|
||
function attemptClose(exitCode, event = 'retry') {
|
||
// closing when there is content, terminate immediately
|
||
if (attempted || stdErr.length || stdOut.length) {
|
||
logger.info(`exitCode=%s event=%s`, exitCode, event);
|
||
done({
|
||
stdOut,
|
||
stdErr,
|
||
exitCode,
|
||
});
|
||
attempted = true;
|
||
outputLogger.destroy();
|
||
}
|
||
// first attempt at closing but no content yet, wait briefly for the close/exit that may follow
|
||
if (!attempted) {
|
||
attempted = true;
|
||
setTimeout(() => attemptClose(exitCode, 'deferred'), 50);
|
||
logger('received %s event before content on stdOut/stdErr', event);
|
||
}
|
||
}
|
||
logger.info(`%s %o`, command, args);
|
||
logger('%O', spawnOptions);
|
||
const spawned = child_process_1.spawn(command, args, spawnOptions);
|
||
spawned.stdout.on('data', onDataReceived(stdOut, 'stdOut', logger, outputLogger.step('stdOut')));
|
||
spawned.stderr.on('data', onDataReceived(stdErr, 'stdErr', logger, outputLogger.step('stdErr')));
|
||
spawned.on('error', onErrorReceived(stdErr, logger));
|
||
spawned.on('close', (code) => attemptClose(code, 'close'));
|
||
spawned.on('exit', (code) => attemptClose(code, 'exit'));
|
||
if (outputHandler) {
|
||
logger(`Passing child process stdOut/stdErr to custom outputHandler`);
|
||
outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
|
||
}
|
||
});
|
||
});
|
||
}
|
||
}
|
||
exports.GitExecutorChain = GitExecutorChain;
|
||
function onErrorReceived(target, logger) {
|
||
return (err) => {
|
||
logger(`[ERROR] child process exception %o`, err);
|
||
target.push(Buffer.from(String(err.stack), 'ascii'));
|
||
};
|
||
}
|
||
function onDataReceived(target, name, logger, output) {
|
||
return (buffer) => {
|
||
logger(`%s received %L bytes`, name, buffer);
|
||
output(`%B`, buffer);
|
||
target.push(buffer);
|
||
};
|
||
}
|
||
//# sourceMappingURL=git-executor-chain.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4701:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.GitExecutor = void 0;
|
||
const git_executor_chain_1 = __nccwpck_require__(8543);
|
||
class GitExecutor {
|
||
constructor(binary = 'git', cwd, _scheduler) {
|
||
this.binary = binary;
|
||
this.cwd = cwd;
|
||
this._scheduler = _scheduler;
|
||
this._chain = new git_executor_chain_1.GitExecutorChain(this, this._scheduler);
|
||
}
|
||
chain() {
|
||
return new git_executor_chain_1.GitExecutorChain(this, this._scheduler);
|
||
}
|
||
push(task) {
|
||
return this._chain.push(task);
|
||
}
|
||
}
|
||
exports.GitExecutor = GitExecutor;
|
||
//# sourceMappingURL=git-executor.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 941:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.gitP = void 0;
|
||
const git_response_error_1 = __nccwpck_require__(5131);
|
||
const functionNamesBuilderApi = [
|
||
'customBinary', 'env', 'outputHandler', 'silent',
|
||
];
|
||
const functionNamesPromiseApi = [
|
||
'add',
|
||
'addAnnotatedTag',
|
||
'addConfig',
|
||
'addRemote',
|
||
'addTag',
|
||
'binaryCatFile',
|
||
'branch',
|
||
'branchLocal',
|
||
'catFile',
|
||
'checkIgnore',
|
||
'checkIsRepo',
|
||
'checkout',
|
||
'checkoutBranch',
|
||
'checkoutLatestTag',
|
||
'checkoutLocalBranch',
|
||
'clean',
|
||
'clone',
|
||
'commit',
|
||
'cwd',
|
||
'deleteLocalBranch',
|
||
'deleteLocalBranches',
|
||
'diff',
|
||
'diffSummary',
|
||
'exec',
|
||
'fetch',
|
||
'getRemotes',
|
||
'init',
|
||
'listConfig',
|
||
'listRemote',
|
||
'log',
|
||
'merge',
|
||
'mergeFromTo',
|
||
'mirror',
|
||
'mv',
|
||
'pull',
|
||
'push',
|
||
'pushTags',
|
||
'raw',
|
||
'rebase',
|
||
'remote',
|
||
'removeRemote',
|
||
'reset',
|
||
'revert',
|
||
'revparse',
|
||
'rm',
|
||
'rmKeepLocal',
|
||
'show',
|
||
'stash',
|
||
'stashList',
|
||
'status',
|
||
'subModule',
|
||
'submoduleAdd',
|
||
'submoduleInit',
|
||
'submoduleUpdate',
|
||
'tag',
|
||
'tags',
|
||
'updateServerInfo'
|
||
];
|
||
const { gitInstanceFactory } = __nccwpck_require__(1949);
|
||
function gitP(...args) {
|
||
let git;
|
||
let chain = Promise.resolve();
|
||
try {
|
||
git = gitInstanceFactory(...args);
|
||
}
|
||
catch (e) {
|
||
chain = Promise.reject(e);
|
||
}
|
||
function builderReturn() {
|
||
return promiseApi;
|
||
}
|
||
function chainReturn() {
|
||
return chain;
|
||
}
|
||
const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce((api, name) => {
|
||
const isAsync = functionNamesPromiseApi.includes(name);
|
||
const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api);
|
||
const alternative = isAsync ? chainReturn : builderReturn;
|
||
Object.defineProperty(api, name, {
|
||
enumerable: false,
|
||
configurable: false,
|
||
value: git ? valid : alternative,
|
||
});
|
||
return api;
|
||
}, {});
|
||
return promiseApi;
|
||
function asyncWrapper(fn, git) {
|
||
return function (...args) {
|
||
if (typeof args[args.length] === 'function') {
|
||
throw new TypeError('Promise interface requires that handlers are not supplied inline, ' +
|
||
'trailing function not allowed in call to ' + fn);
|
||
}
|
||
return chain.then(function () {
|
||
return new Promise(function (resolve, reject) {
|
||
const callback = (err, result) => {
|
||
if (err) {
|
||
return reject(toError(err));
|
||
}
|
||
resolve(result);
|
||
};
|
||
args.push(callback);
|
||
git[fn].apply(git, args);
|
||
});
|
||
});
|
||
};
|
||
}
|
||
function syncWrapper(fn, git, api) {
|
||
return (...args) => {
|
||
git[fn](...args);
|
||
return api;
|
||
};
|
||
}
|
||
}
|
||
exports.gitP = gitP;
|
||
function toError(error) {
|
||
if (error instanceof Error) {
|
||
return error;
|
||
}
|
||
if (typeof error === 'string') {
|
||
return new Error(error);
|
||
}
|
||
return new git_response_error_1.GitResponseError(error);
|
||
}
|
||
//# sourceMappingURL=promise-wrapped.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3421:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.Scheduler = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const promise_deferred_1 = __nccwpck_require__(9819);
|
||
const git_logger_1 = __nccwpck_require__(7178);
|
||
const logger = git_logger_1.createLogger('', 'scheduler');
|
||
const createScheduledTask = (() => {
|
||
let id = 0;
|
||
return () => {
|
||
id++;
|
||
const { promise, done } = promise_deferred_1.createDeferred();
|
||
return {
|
||
promise,
|
||
done,
|
||
id,
|
||
};
|
||
};
|
||
})();
|
||
class Scheduler {
|
||
constructor(concurrency = 2) {
|
||
this.concurrency = concurrency;
|
||
this.pending = [];
|
||
this.running = [];
|
||
logger(`Constructed, concurrency=%s`, concurrency);
|
||
}
|
||
schedule() {
|
||
if (!this.pending.length || this.running.length >= this.concurrency) {
|
||
logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`, this.pending.length, this.running.length, this.concurrency);
|
||
return;
|
||
}
|
||
const task = utils_1.append(this.running, this.pending.shift());
|
||
logger(`Attempting id=%s`, task.id);
|
||
task.done(() => {
|
||
logger(`Completing id=`, task.id);
|
||
utils_1.remove(this.running, task);
|
||
this.schedule();
|
||
});
|
||
}
|
||
next() {
|
||
const { promise, id } = utils_1.append(this.pending, createScheduledTask());
|
||
logger(`Scheduling id=%s`, id);
|
||
this.schedule();
|
||
return promise;
|
||
}
|
||
}
|
||
exports.Scheduler = Scheduler;
|
||
//# sourceMappingURL=scheduler.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6676:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.TasksPendingQueue = void 0;
|
||
const git_logger_1 = __nccwpck_require__(7178);
|
||
const api_1 = __nccwpck_require__(4732);
|
||
class TasksPendingQueue {
|
||
constructor(logLabel = 'GitExecutor') {
|
||
this.logLabel = logLabel;
|
||
this._queue = new Map();
|
||
}
|
||
withProgress(task) {
|
||
return this._queue.get(task);
|
||
}
|
||
createProgress(task) {
|
||
const name = TasksPendingQueue.getName(task.commands[0]);
|
||
const logger = git_logger_1.createLogger(this.logLabel, name);
|
||
return {
|
||
task,
|
||
logger,
|
||
name,
|
||
};
|
||
}
|
||
push(task) {
|
||
const progress = this.createProgress(task);
|
||
progress.logger('Adding task to the queue, commands = %o', task.commands);
|
||
this._queue.set(task, progress);
|
||
return progress;
|
||
}
|
||
fatal(err) {
|
||
for (const [task, { logger }] of Array.from(this._queue.entries())) {
|
||
if (task === err.task) {
|
||
logger.info(`Failed %o`, err);
|
||
logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`);
|
||
}
|
||
else {
|
||
logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message);
|
||
}
|
||
this.complete(task);
|
||
}
|
||
if (this._queue.size !== 0) {
|
||
throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);
|
||
}
|
||
}
|
||
complete(task) {
|
||
const progress = this.withProgress(task);
|
||
if (progress) {
|
||
progress.logger.destroy();
|
||
this._queue.delete(task);
|
||
}
|
||
}
|
||
attempt(task) {
|
||
const progress = this.withProgress(task);
|
||
if (!progress) {
|
||
throw new api_1.GitError(undefined, 'TasksPendingQueue: attempt called for an unknown task');
|
||
}
|
||
progress.logger('Starting task');
|
||
return progress;
|
||
}
|
||
static getName(name = 'empty') {
|
||
return `task:${name}:${++TasksPendingQueue.counter}`;
|
||
}
|
||
}
|
||
exports.TasksPendingQueue = TasksPendingQueue;
|
||
TasksPendingQueue.counter = 0;
|
||
//# sourceMappingURL=tasks-pending-queue.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8850:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.taskCallback = void 0;
|
||
const api_1 = __nccwpck_require__(4732);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
function taskCallback(task, response, callback = utils_1.NOOP) {
|
||
const onSuccess = (data) => {
|
||
callback(null, data);
|
||
};
|
||
const onError = (err) => {
|
||
if ((err === null || err === void 0 ? void 0 : err.task) === task) {
|
||
if (err instanceof api_1.GitResponseError) {
|
||
return callback(addDeprecationNoticeToError(err));
|
||
}
|
||
callback(err);
|
||
}
|
||
};
|
||
response.then(onSuccess, onError);
|
||
}
|
||
exports.taskCallback = taskCallback;
|
||
function addDeprecationNoticeToError(err) {
|
||
let log = (name) => {
|
||
console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`);
|
||
log = utils_1.NOOP;
|
||
};
|
||
return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));
|
||
function descriptorReducer(all, name) {
|
||
if (name in err) {
|
||
return all;
|
||
}
|
||
all[name] = {
|
||
enumerable: false,
|
||
configurable: false,
|
||
get() {
|
||
log(name);
|
||
return err.git[name];
|
||
},
|
||
};
|
||
return all;
|
||
}
|
||
}
|
||
//# sourceMappingURL=task-callback.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 17:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.deleteBranchTask = exports.deleteBranchesTask = exports.branchLocalTask = exports.branchTask = exports.containsDeleteBranchCommand = void 0;
|
||
const git_response_error_1 = __nccwpck_require__(5131);
|
||
const parse_branch_delete_1 = __nccwpck_require__(6086);
|
||
const parse_branch_1 = __nccwpck_require__(9264);
|
||
function containsDeleteBranchCommand(commands) {
|
||
const deleteCommands = ['-d', '-D', '--delete'];
|
||
return commands.some(command => deleteCommands.includes(command));
|
||
}
|
||
exports.containsDeleteBranchCommand = containsDeleteBranchCommand;
|
||
function branchTask(customArgs) {
|
||
const isDelete = containsDeleteBranchCommand(customArgs);
|
||
const commands = ['branch', ...customArgs];
|
||
if (commands.length === 1) {
|
||
commands.push('-a');
|
||
}
|
||
if (!commands.includes('-v')) {
|
||
commands.splice(1, 0, '-v');
|
||
}
|
||
return {
|
||
format: 'utf-8',
|
||
commands,
|
||
parser(stdOut, stdErr) {
|
||
if (isDelete) {
|
||
return parse_branch_delete_1.parseBranchDeletions(stdOut, stdErr).all[0];
|
||
}
|
||
return parse_branch_1.parseBranchSummary(stdOut);
|
||
},
|
||
};
|
||
}
|
||
exports.branchTask = branchTask;
|
||
function branchLocalTask() {
|
||
const parser = parse_branch_1.parseBranchSummary;
|
||
return {
|
||
format: 'utf-8',
|
||
commands: ['branch', '-v'],
|
||
parser,
|
||
};
|
||
}
|
||
exports.branchLocalTask = branchLocalTask;
|
||
function deleteBranchesTask(branches, forceDelete = false) {
|
||
return {
|
||
format: 'utf-8',
|
||
commands: ['branch', '-v', forceDelete ? '-D' : '-d', ...branches],
|
||
parser(stdOut, stdErr) {
|
||
return parse_branch_delete_1.parseBranchDeletions(stdOut, stdErr);
|
||
},
|
||
onError(exitCode, error, done, fail) {
|
||
if (!parse_branch_delete_1.hasBranchDeletionError(error, exitCode)) {
|
||
return fail(error);
|
||
}
|
||
done(error);
|
||
},
|
||
concatStdErr: true,
|
||
};
|
||
}
|
||
exports.deleteBranchesTask = deleteBranchesTask;
|
||
function deleteBranchTask(branch, forceDelete = false) {
|
||
const task = {
|
||
format: 'utf-8',
|
||
commands: ['branch', '-v', forceDelete ? '-D' : '-d', branch],
|
||
parser(stdOut, stdErr) {
|
||
return parse_branch_delete_1.parseBranchDeletions(stdOut, stdErr).branches[branch];
|
||
},
|
||
onError(exitCode, error, _, fail) {
|
||
if (!parse_branch_delete_1.hasBranchDeletionError(error, exitCode)) {
|
||
return fail(error);
|
||
}
|
||
throw new git_response_error_1.GitResponseError(task.parser(error, ''), error);
|
||
},
|
||
concatStdErr: true,
|
||
};
|
||
return task;
|
||
}
|
||
exports.deleteBranchTask = deleteBranchTask;
|
||
//# sourceMappingURL=branch.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 221:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.checkIsBareRepoTask = exports.checkIsRepoRootTask = exports.checkIsRepoTask = exports.CheckRepoActions = void 0;
|
||
const utils_1 = __nccwpck_require__(847);
|
||
var CheckRepoActions;
|
||
(function (CheckRepoActions) {
|
||
CheckRepoActions["BARE"] = "bare";
|
||
CheckRepoActions["IN_TREE"] = "tree";
|
||
CheckRepoActions["IS_REPO_ROOT"] = "root";
|
||
})(CheckRepoActions = exports.CheckRepoActions || (exports.CheckRepoActions = {}));
|
||
const onError = (exitCode, stdErr, done, fail) => {
|
||
if (exitCode === utils_1.ExitCodes.UNCLEAN && isNotRepoMessage(stdErr)) {
|
||
return done('false');
|
||
}
|
||
fail(stdErr);
|
||
};
|
||
const parser = (text) => {
|
||
return text.trim() === 'true';
|
||
};
|
||
function checkIsRepoTask(action) {
|
||
switch (action) {
|
||
case CheckRepoActions.BARE:
|
||
return checkIsBareRepoTask();
|
||
case CheckRepoActions.IS_REPO_ROOT:
|
||
return checkIsRepoRootTask();
|
||
}
|
||
const commands = ['rev-parse', '--is-inside-work-tree'];
|
||
return {
|
||
commands,
|
||
format: 'utf-8',
|
||
onError,
|
||
parser,
|
||
};
|
||
}
|
||
exports.checkIsRepoTask = checkIsRepoTask;
|
||
function checkIsRepoRootTask() {
|
||
const commands = ['rev-parse', '--git-dir'];
|
||
return {
|
||
commands,
|
||
format: 'utf-8',
|
||
onError,
|
||
parser(path) {
|
||
return /^\.(git)?$/.test(path.trim());
|
||
},
|
||
};
|
||
}
|
||
exports.checkIsRepoRootTask = checkIsRepoRootTask;
|
||
function checkIsBareRepoTask() {
|
||
const commands = ['rev-parse', '--is-bare-repository'];
|
||
return {
|
||
commands,
|
||
format: 'utf-8',
|
||
onError,
|
||
parser,
|
||
};
|
||
}
|
||
exports.checkIsBareRepoTask = checkIsBareRepoTask;
|
||
function isNotRepoMessage(message) {
|
||
return /(Not a git repository|Kein Git-Repository)/i.test(message);
|
||
}
|
||
//# sourceMappingURL=check-is-repo.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4386:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.isCleanOptionsArray = exports.cleanTask = exports.cleanWithOptionsTask = exports.CleanOptions = exports.CONFIG_ERROR_UNKNOWN_OPTION = exports.CONFIG_ERROR_MODE_REQUIRED = exports.CONFIG_ERROR_INTERACTIVE_MODE = void 0;
|
||
const CleanSummary_1 = __nccwpck_require__(5689);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const task_1 = __nccwpck_require__(2815);
|
||
exports.CONFIG_ERROR_INTERACTIVE_MODE = 'Git clean interactive mode is not supported';
|
||
exports.CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter ("n" or "f") is required';
|
||
exports.CONFIG_ERROR_UNKNOWN_OPTION = 'Git clean unknown option found in: ';
|
||
/**
|
||
* All supported option switches available for use in a `git.clean` operation
|
||
*/
|
||
var CleanOptions;
|
||
(function (CleanOptions) {
|
||
CleanOptions["DRY_RUN"] = "n";
|
||
CleanOptions["FORCE"] = "f";
|
||
CleanOptions["IGNORED_INCLUDED"] = "x";
|
||
CleanOptions["IGNORED_ONLY"] = "X";
|
||
CleanOptions["EXCLUDING"] = "e";
|
||
CleanOptions["QUIET"] = "q";
|
||
CleanOptions["RECURSIVE"] = "d";
|
||
})(CleanOptions = exports.CleanOptions || (exports.CleanOptions = {}));
|
||
const CleanOptionValues = new Set(['i', ...utils_1.asStringArray(Object.values(CleanOptions))]);
|
||
function cleanWithOptionsTask(mode, customArgs) {
|
||
const { cleanMode, options, valid } = getCleanOptions(mode);
|
||
if (!cleanMode) {
|
||
return task_1.configurationErrorTask(exports.CONFIG_ERROR_MODE_REQUIRED);
|
||
}
|
||
if (!valid.options) {
|
||
return task_1.configurationErrorTask(exports.CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));
|
||
}
|
||
options.push(...customArgs);
|
||
if (options.some(isInteractiveMode)) {
|
||
return task_1.configurationErrorTask(exports.CONFIG_ERROR_INTERACTIVE_MODE);
|
||
}
|
||
return cleanTask(cleanMode, options);
|
||
}
|
||
exports.cleanWithOptionsTask = cleanWithOptionsTask;
|
||
function cleanTask(mode, customArgs) {
|
||
const commands = ['clean', `-${mode}`, ...customArgs];
|
||
return {
|
||
commands,
|
||
format: 'utf-8',
|
||
parser(text) {
|
||
return CleanSummary_1.cleanSummaryParser(mode === CleanOptions.DRY_RUN, text);
|
||
}
|
||
};
|
||
}
|
||
exports.cleanTask = cleanTask;
|
||
function isCleanOptionsArray(input) {
|
||
return Array.isArray(input) && input.every(test => CleanOptionValues.has(test));
|
||
}
|
||
exports.isCleanOptionsArray = isCleanOptionsArray;
|
||
function getCleanOptions(input) {
|
||
let cleanMode;
|
||
let options = [];
|
||
let valid = { cleanMode: false, options: true };
|
||
input.replace(/[^a-z]i/g, '').split('').forEach(char => {
|
||
if (isCleanMode(char)) {
|
||
cleanMode = char;
|
||
valid.cleanMode = true;
|
||
}
|
||
else {
|
||
valid.options = valid.options && isKnownOption(options[options.length] = (`-${char}`));
|
||
}
|
||
});
|
||
return {
|
||
cleanMode,
|
||
options,
|
||
valid,
|
||
};
|
||
}
|
||
function isCleanMode(cleanMode) {
|
||
return cleanMode === CleanOptions.FORCE || cleanMode === CleanOptions.DRY_RUN;
|
||
}
|
||
function isKnownOption(option) {
|
||
return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));
|
||
}
|
||
function isInteractiveMode(option) {
|
||
if (/^-[^\-]/.test(option)) {
|
||
return option.indexOf('i') > 0;
|
||
}
|
||
return option === '--interactive';
|
||
}
|
||
//# sourceMappingURL=clean.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3173:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.cloneMirrorTask = exports.cloneTask = void 0;
|
||
const task_1 = __nccwpck_require__(2815);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
function cloneTask(repo, directory, customArgs) {
|
||
const commands = ['clone', ...customArgs];
|
||
if (typeof repo === 'string') {
|
||
commands.push(repo);
|
||
}
|
||
if (typeof directory === 'string') {
|
||
commands.push(directory);
|
||
}
|
||
return task_1.straightThroughStringTask(commands);
|
||
}
|
||
exports.cloneTask = cloneTask;
|
||
function cloneMirrorTask(repo, directory, customArgs) {
|
||
utils_1.append(customArgs, '--mirror');
|
||
return cloneTask(repo, directory, customArgs);
|
||
}
|
||
exports.cloneMirrorTask = cloneMirrorTask;
|
||
//# sourceMappingURL=clone.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 5494:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.commitTask = void 0;
|
||
const parse_commit_1 = __nccwpck_require__(3026);
|
||
function commitTask(message, files, customArgs) {
|
||
const commands = [
|
||
'commit',
|
||
...(message.flatMap(m => ['-m', m])),
|
||
...files,
|
||
...customArgs,
|
||
];
|
||
return {
|
||
commands,
|
||
format: 'utf-8',
|
||
parser: parse_commit_1.parseCommitResult,
|
||
};
|
||
}
|
||
exports.commitTask = commitTask;
|
||
//# sourceMappingURL=commit.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 7597:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.listConfigTask = exports.addConfigTask = void 0;
|
||
const ConfigList_1 = __nccwpck_require__(7219);
|
||
function addConfigTask(key, value, append = false) {
|
||
const commands = ['config', '--local'];
|
||
if (append) {
|
||
commands.push('--add');
|
||
}
|
||
commands.push(key, value);
|
||
return {
|
||
commands,
|
||
format: 'utf-8',
|
||
parser(text) {
|
||
return text;
|
||
}
|
||
};
|
||
}
|
||
exports.addConfigTask = addConfigTask;
|
||
function listConfigTask() {
|
||
return {
|
||
commands: ['config', '--list', '--show-origin', '--null'],
|
||
format: 'utf-8',
|
||
parser(text) {
|
||
return ConfigList_1.configListParser(text);
|
||
},
|
||
};
|
||
}
|
||
exports.listConfigTask = listConfigTask;
|
||
//# sourceMappingURL=config.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9241:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.diffSummaryTask = void 0;
|
||
const parse_diff_summary_1 = __nccwpck_require__(2024);
|
||
function diffSummaryTask(customArgs) {
|
||
return {
|
||
commands: ['diff', '--stat=4096', ...customArgs],
|
||
format: 'utf-8',
|
||
parser(stdOut) {
|
||
return parse_diff_summary_1.parseDiffResult(stdOut);
|
||
}
|
||
};
|
||
}
|
||
exports.diffSummaryTask = diffSummaryTask;
|
||
//# sourceMappingURL=diff.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8823:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.fetchTask = void 0;
|
||
const parse_fetch_1 = __nccwpck_require__(6254);
|
||
function fetchTask(remote, branch, customArgs) {
|
||
const commands = ['fetch', ...customArgs];
|
||
if (remote && branch) {
|
||
commands.push(remote, branch);
|
||
}
|
||
return {
|
||
commands,
|
||
format: 'utf-8',
|
||
parser: parse_fetch_1.parseFetchResult,
|
||
};
|
||
}
|
||
exports.fetchTask = fetchTask;
|
||
//# sourceMappingURL=fetch.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8199:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.hashObjectTask = void 0;
|
||
const task_1 = __nccwpck_require__(2815);
|
||
/**
|
||
* Task used by `git.hashObject`
|
||
*/
|
||
function hashObjectTask(filePath, write) {
|
||
const commands = ['hash-object', filePath];
|
||
if (write) {
|
||
commands.push('-w');
|
||
}
|
||
return task_1.straightThroughStringTask(commands, true);
|
||
}
|
||
exports.hashObjectTask = hashObjectTask;
|
||
//# sourceMappingURL=hash-object.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6016:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.initTask = void 0;
|
||
const InitSummary_1 = __nccwpck_require__(8690);
|
||
const bareCommand = '--bare';
|
||
function hasBareCommand(command) {
|
||
return command.includes(bareCommand);
|
||
}
|
||
function initTask(bare = false, path, customArgs) {
|
||
const commands = ['init', ...customArgs];
|
||
if (bare && !hasBareCommand(commands)) {
|
||
commands.splice(1, 0, bareCommand);
|
||
}
|
||
return {
|
||
commands,
|
||
concatStdErr: false,
|
||
format: 'utf-8',
|
||
parser(text) {
|
||
return InitSummary_1.parseInit(commands.includes('--bare'), path, text);
|
||
}
|
||
};
|
||
}
|
||
exports.initTask = initTask;
|
||
//# sourceMappingURL=init.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8627:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.logTask = exports.parseLogOptions = void 0;
|
||
const parse_list_log_summary_1 = __nccwpck_require__(9729);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
const excludeOptions = new Set([
|
||
'--pretty',
|
||
'max-count',
|
||
'maxCount',
|
||
'n',
|
||
'file',
|
||
'format',
|
||
'from',
|
||
'to',
|
||
'splitter',
|
||
'symmetric',
|
||
'multiLine',
|
||
'strictDate',
|
||
]);
|
||
function prettyFormat(format, splitter) {
|
||
const fields = [];
|
||
const formatStr = [];
|
||
Object.entries(format).forEach(([field, format]) => {
|
||
fields.push(field);
|
||
formatStr.push(format);
|
||
});
|
||
return [
|
||
fields, formatStr.join(splitter)
|
||
];
|
||
}
|
||
function userOptions(options) {
|
||
return Object.fromEntries(Object.entries(options).filter(([key]) => !excludeOptions.has(key)));
|
||
}
|
||
function parseLogOptions(opt = {}, customArgs = []) {
|
||
const splitter = opt.splitter || parse_list_log_summary_1.SPLITTER;
|
||
const format = opt.format || {
|
||
hash: '%H',
|
||
date: opt.strictDate === false ? '%ai' : '%aI',
|
||
message: '%s',
|
||
refs: '%D',
|
||
body: opt.multiLine ? '%B' : '%b',
|
||
author_name: '%aN',
|
||
author_email: '%ae'
|
||
};
|
||
const [fields, formatStr] = prettyFormat(format, splitter);
|
||
const suffix = [];
|
||
const command = [
|
||
`--pretty=format:${parse_list_log_summary_1.START_BOUNDARY}${formatStr}${parse_list_log_summary_1.COMMIT_BOUNDARY}`,
|
||
...customArgs,
|
||
];
|
||
const maxCount = opt.n || opt['max-count'] || opt.maxCount;
|
||
if (maxCount) {
|
||
command.push(`--max-count=${maxCount}`);
|
||
}
|
||
if (opt.from && opt.to) {
|
||
const rangeOperator = (opt.symmetric !== false) ? '...' : '..';
|
||
suffix.push(`${opt.from}${rangeOperator}${opt.to}`);
|
||
}
|
||
if (opt.file) {
|
||
suffix.push('--follow', opt.file);
|
||
}
|
||
utils_1.appendTaskOptions(userOptions(opt), command);
|
||
return {
|
||
fields,
|
||
splitter,
|
||
commands: [
|
||
...command,
|
||
...suffix,
|
||
],
|
||
};
|
||
}
|
||
exports.parseLogOptions = parseLogOptions;
|
||
function logTask(splitter, fields, customArgs) {
|
||
return {
|
||
commands: ['log', ...customArgs],
|
||
format: 'utf-8',
|
||
parser: parse_list_log_summary_1.createListLogSummaryParser(splitter, fields),
|
||
};
|
||
}
|
||
exports.logTask = logTask;
|
||
//# sourceMappingURL=log.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8829:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.mergeTask = void 0;
|
||
const api_1 = __nccwpck_require__(4732);
|
||
const parse_merge_1 = __nccwpck_require__(6412);
|
||
const task_1 = __nccwpck_require__(2815);
|
||
function mergeTask(customArgs) {
|
||
if (!customArgs.length) {
|
||
return task_1.configurationErrorTask('Git.merge requires at least one option');
|
||
}
|
||
return {
|
||
commands: ['merge', ...customArgs],
|
||
format: 'utf-8',
|
||
parser(stdOut, stdErr) {
|
||
const merge = parse_merge_1.parseMergeResult(stdOut, stdErr);
|
||
if (merge.failed) {
|
||
throw new api_1.GitResponseError(merge);
|
||
}
|
||
return merge;
|
||
}
|
||
};
|
||
}
|
||
exports.mergeTask = mergeTask;
|
||
//# sourceMappingURL=merge.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6520:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.moveTask = void 0;
|
||
const parse_move_1 = __nccwpck_require__(7444);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
function moveTask(from, to) {
|
||
return {
|
||
commands: ['mv', '-v', ...utils_1.asArray(from), to],
|
||
format: 'utf-8',
|
||
parser: parse_move_1.parseMoveResult,
|
||
};
|
||
}
|
||
exports.moveTask = moveTask;
|
||
//# sourceMappingURL=move.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 4636:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.pullTask = void 0;
|
||
const parse_pull_1 = __nccwpck_require__(5658);
|
||
function pullTask(remote, branch, customArgs) {
|
||
const commands = ['pull', ...customArgs];
|
||
if (remote && branch) {
|
||
commands.splice(1, 0, remote, branch);
|
||
}
|
||
return {
|
||
commands,
|
||
format: 'utf-8',
|
||
parser(stdOut, stdErr) {
|
||
return parse_pull_1.parsePullResult(stdOut, stdErr);
|
||
}
|
||
};
|
||
}
|
||
exports.pullTask = pullTask;
|
||
//# sourceMappingURL=pull.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1435:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.pushTask = exports.pushTagsTask = void 0;
|
||
const parse_push_1 = __nccwpck_require__(8530);
|
||
const utils_1 = __nccwpck_require__(847);
|
||
function pushTagsTask(ref = {}, customArgs) {
|
||
utils_1.append(customArgs, '--tags');
|
||
return pushTask(ref, customArgs);
|
||
}
|
||
exports.pushTagsTask = pushTagsTask;
|
||
function pushTask(ref = {}, customArgs) {
|
||
const commands = ['push', ...customArgs];
|
||
if (ref.branch) {
|
||
commands.splice(1, 0, ref.branch);
|
||
}
|
||
if (ref.remote) {
|
||
commands.splice(1, 0, ref.remote);
|
||
}
|
||
utils_1.remove(commands, '-v');
|
||
utils_1.append(commands, '--verbose');
|
||
utils_1.append(commands, '--porcelain');
|
||
return {
|
||
commands,
|
||
format: 'utf-8',
|
||
parser: parse_push_1.parsePushResult,
|
||
};
|
||
}
|
||
exports.pushTask = pushTask;
|
||
//# sourceMappingURL=push.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9866:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.removeRemoteTask = exports.remoteTask = exports.listRemotesTask = exports.getRemotesTask = exports.addRemoteTask = void 0;
|
||
const GetRemoteSummary_1 = __nccwpck_require__(9999);
|
||
const task_1 = __nccwpck_require__(2815);
|
||
function addRemoteTask(remoteName, remoteRepo, customArgs = []) {
|
||
return task_1.straightThroughStringTask(['remote', 'add', ...customArgs, remoteName, remoteRepo]);
|
||
}
|
||
exports.addRemoteTask = addRemoteTask;
|
||
function getRemotesTask(verbose) {
|
||
const commands = ['remote'];
|
||
if (verbose) {
|
||
commands.push('-v');
|
||
}
|
||
return {
|
||
commands,
|
||
format: 'utf-8',
|
||
parser: verbose ? GetRemoteSummary_1.parseGetRemotesVerbose : GetRemoteSummary_1.parseGetRemotes,
|
||
};
|
||
}
|
||
exports.getRemotesTask = getRemotesTask;
|
||
function listRemotesTask(customArgs = []) {
|
||
const commands = [...customArgs];
|
||
if (commands[0] !== 'ls-remote') {
|
||
commands.unshift('ls-remote');
|
||
}
|
||
return task_1.straightThroughStringTask(commands);
|
||
}
|
||
exports.listRemotesTask = listRemotesTask;
|
||
function remoteTask(customArgs = []) {
|
||
const commands = [...customArgs];
|
||
if (commands[0] !== 'remote') {
|
||
commands.unshift('remote');
|
||
}
|
||
return task_1.straightThroughStringTask(commands);
|
||
}
|
||
exports.remoteTask = remoteTask;
|
||
function removeRemoteTask(remoteName) {
|
||
return task_1.straightThroughStringTask(['remote', 'remove', remoteName]);
|
||
}
|
||
exports.removeRemoteTask = removeRemoteTask;
|
||
//# sourceMappingURL=remote.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2377:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.getResetMode = exports.resetTask = exports.ResetMode = void 0;
|
||
const task_1 = __nccwpck_require__(2815);
|
||
var ResetMode;
|
||
(function (ResetMode) {
|
||
ResetMode["MIXED"] = "mixed";
|
||
ResetMode["SOFT"] = "soft";
|
||
ResetMode["HARD"] = "hard";
|
||
ResetMode["MERGE"] = "merge";
|
||
ResetMode["KEEP"] = "keep";
|
||
})(ResetMode = exports.ResetMode || (exports.ResetMode = {}));
|
||
const ResetModes = Array.from(Object.values(ResetMode));
|
||
function resetTask(mode, customArgs) {
|
||
const commands = ['reset'];
|
||
if (isValidResetMode(mode)) {
|
||
commands.push(`--${mode}`);
|
||
}
|
||
commands.push(...customArgs);
|
||
return task_1.straightThroughStringTask(commands);
|
||
}
|
||
exports.resetTask = resetTask;
|
||
function getResetMode(mode) {
|
||
if (isValidResetMode(mode)) {
|
||
return mode;
|
||
}
|
||
switch (typeof mode) {
|
||
case 'string':
|
||
case 'undefined':
|
||
return ResetMode.SOFT;
|
||
}
|
||
return;
|
||
}
|
||
exports.getResetMode = getResetMode;
|
||
function isValidResetMode(mode) {
|
||
return ResetModes.includes(mode);
|
||
}
|
||
//# sourceMappingURL=reset.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 810:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.stashListTask = void 0;
|
||
const parse_list_log_summary_1 = __nccwpck_require__(9729);
|
||
const log_1 = __nccwpck_require__(8627);
|
||
function stashListTask(opt = {}, customArgs) {
|
||
const options = log_1.parseLogOptions(opt);
|
||
const parser = parse_list_log_summary_1.createListLogSummaryParser(options.splitter, options.fields);
|
||
return {
|
||
commands: ['stash', 'list', ...options.commands, ...customArgs],
|
||
format: 'utf-8',
|
||
parser,
|
||
};
|
||
}
|
||
exports.stashListTask = stashListTask;
|
||
//# sourceMappingURL=stash-list.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9197:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.statusTask = void 0;
|
||
const StatusSummary_1 = __nccwpck_require__(6790);
|
||
function statusTask(customArgs) {
|
||
return {
|
||
format: 'utf-8',
|
||
commands: ['status', '--porcelain', '-b', '-u', ...customArgs],
|
||
parser(text) {
|
||
return StatusSummary_1.parseStatusSummary(text);
|
||
}
|
||
};
|
||
}
|
||
exports.statusTask = statusTask;
|
||
//# sourceMappingURL=status.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8772:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.updateSubModuleTask = exports.subModuleTask = exports.initSubModuleTask = exports.addSubModuleTask = void 0;
|
||
const task_1 = __nccwpck_require__(2815);
|
||
function addSubModuleTask(repo, path) {
|
||
return subModuleTask(['add', repo, path]);
|
||
}
|
||
exports.addSubModuleTask = addSubModuleTask;
|
||
function initSubModuleTask(customArgs) {
|
||
return subModuleTask(['init', ...customArgs]);
|
||
}
|
||
exports.initSubModuleTask = initSubModuleTask;
|
||
function subModuleTask(customArgs) {
|
||
const commands = [...customArgs];
|
||
if (commands[0] !== 'submodule') {
|
||
commands.unshift('submodule');
|
||
}
|
||
return task_1.straightThroughStringTask(commands);
|
||
}
|
||
exports.subModuleTask = subModuleTask;
|
||
function updateSubModuleTask(customArgs) {
|
||
return subModuleTask(['update', ...customArgs]);
|
||
}
|
||
exports.updateSubModuleTask = updateSubModuleTask;
|
||
//# sourceMappingURL=sub-module.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8540:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.addAnnotatedTagTask = exports.addTagTask = exports.tagListTask = void 0;
|
||
const TagList_1 = __nccwpck_require__(4539);
|
||
/**
|
||
* Task used by `git.tags`
|
||
*/
|
||
function tagListTask(customArgs = []) {
|
||
const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));
|
||
return {
|
||
format: 'utf-8',
|
||
commands: ['tag', '-l', ...customArgs],
|
||
parser(text) {
|
||
return TagList_1.parseTagList(text, hasCustomSort);
|
||
},
|
||
};
|
||
}
|
||
exports.tagListTask = tagListTask;
|
||
/**
|
||
* Task used by `git.addTag`
|
||
*/
|
||
function addTagTask(name) {
|
||
return {
|
||
format: 'utf-8',
|
||
commands: ['tag', name],
|
||
parser() {
|
||
return { name };
|
||
}
|
||
};
|
||
}
|
||
exports.addTagTask = addTagTask;
|
||
/**
|
||
* Task used by `git.addTag`
|
||
*/
|
||
function addAnnotatedTagTask(name, tagMessage) {
|
||
return {
|
||
format: 'utf-8',
|
||
commands: ['tag', '-a', '-m', tagMessage, name],
|
||
parser() {
|
||
return { name };
|
||
}
|
||
};
|
||
}
|
||
exports.addAnnotatedTagTask = addAnnotatedTagTask;
|
||
//# sourceMappingURL=tag.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2815:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.isEmptyTask = exports.isBufferTask = exports.straightThroughStringTask = exports.configurationErrorTask = exports.adhocExecTask = exports.EMPTY_COMMANDS = void 0;
|
||
const task_configuration_error_1 = __nccwpck_require__(740);
|
||
exports.EMPTY_COMMANDS = [];
|
||
function adhocExecTask(parser) {
|
||
return {
|
||
commands: exports.EMPTY_COMMANDS,
|
||
format: 'utf-8',
|
||
parser,
|
||
};
|
||
}
|
||
exports.adhocExecTask = adhocExecTask;
|
||
function configurationErrorTask(error) {
|
||
return {
|
||
commands: exports.EMPTY_COMMANDS,
|
||
format: 'utf-8',
|
||
parser() {
|
||
throw typeof error === 'string' ? new task_configuration_error_1.TaskConfigurationError(error) : error;
|
||
}
|
||
};
|
||
}
|
||
exports.configurationErrorTask = configurationErrorTask;
|
||
function straightThroughStringTask(commands, trimmed = false) {
|
||
return {
|
||
commands,
|
||
format: 'utf-8',
|
||
parser(text) {
|
||
return trimmed ? String(text).trim() : text;
|
||
},
|
||
};
|
||
}
|
||
exports.straightThroughStringTask = straightThroughStringTask;
|
||
function isBufferTask(task) {
|
||
return task.format === 'buffer';
|
||
}
|
||
exports.isBufferTask = isBufferTask;
|
||
function isEmptyTask(task) {
|
||
return !task.commands.length;
|
||
}
|
||
exports.isEmptyTask = isEmptyTask;
|
||
//# sourceMappingURL=task.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 7366:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.filterHasLength = exports.filterFunction = exports.filterPlainObject = exports.filterStringOrStringArray = exports.filterStringArray = exports.filterString = exports.filterPrimitives = exports.filterArray = exports.filterType = void 0;
|
||
const util_1 = __nccwpck_require__(8237);
|
||
function filterType(input, filter, def) {
|
||
if (filter(input)) {
|
||
return input;
|
||
}
|
||
return (arguments.length > 2) ? def : undefined;
|
||
}
|
||
exports.filterType = filterType;
|
||
const filterArray = (input) => {
|
||
return Array.isArray(input);
|
||
};
|
||
exports.filterArray = filterArray;
|
||
function filterPrimitives(input, omit) {
|
||
return /number|string|boolean/.test(typeof input) && (!omit || !omit.includes((typeof input)));
|
||
}
|
||
exports.filterPrimitives = filterPrimitives;
|
||
const filterString = (input) => {
|
||
return typeof input === 'string';
|
||
};
|
||
exports.filterString = filterString;
|
||
const filterStringArray = (input) => {
|
||
return Array.isArray(input) && input.every(exports.filterString);
|
||
};
|
||
exports.filterStringArray = filterStringArray;
|
||
const filterStringOrStringArray = (input) => {
|
||
return exports.filterString(input) || (Array.isArray(input) && input.every(exports.filterString));
|
||
};
|
||
exports.filterStringOrStringArray = filterStringOrStringArray;
|
||
function filterPlainObject(input) {
|
||
return !!input && util_1.objectToString(input) === '[object Object]';
|
||
}
|
||
exports.filterPlainObject = filterPlainObject;
|
||
function filterFunction(input) {
|
||
return typeof input === 'function';
|
||
}
|
||
exports.filterFunction = filterFunction;
|
||
const filterHasLength = (input) => {
|
||
if (input == null || 'number|boolean|function'.includes(typeof input)) {
|
||
return false;
|
||
}
|
||
return Array.isArray(input) || typeof input === 'string' || typeof input.length === 'number';
|
||
};
|
||
exports.filterHasLength = filterHasLength;
|
||
//# sourceMappingURL=argument-filters.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2185:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.ExitCodes = void 0;
|
||
/**
|
||
* Known process exit codes used by the task parsers to determine whether an error
|
||
* was one they can automatically handle
|
||
*/
|
||
var ExitCodes;
|
||
(function (ExitCodes) {
|
||
ExitCodes[ExitCodes["SUCCESS"] = 0] = "SUCCESS";
|
||
ExitCodes[ExitCodes["ERROR"] = 1] = "ERROR";
|
||
ExitCodes[ExitCodes["UNCLEAN"] = 128] = "UNCLEAN";
|
||
})(ExitCodes = exports.ExitCodes || (exports.ExitCodes = {}));
|
||
//# sourceMappingURL=exit-codes.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 6578:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.GitOutputStreams = void 0;
|
||
class GitOutputStreams {
|
||
constructor(stdOut, stdErr) {
|
||
this.stdOut = stdOut;
|
||
this.stdErr = stdErr;
|
||
}
|
||
asStrings() {
|
||
return new GitOutputStreams(this.stdOut.toString('utf8'), this.stdErr.toString('utf8'));
|
||
}
|
||
}
|
||
exports.GitOutputStreams = GitOutputStreams;
|
||
//# sourceMappingURL=git-output-streams.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 847:
|
||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||
}) : (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
o[k2] = m[k];
|
||
}));
|
||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||
};
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
__exportStar(__nccwpck_require__(7366), exports);
|
||
__exportStar(__nccwpck_require__(2185), exports);
|
||
__exportStar(__nccwpck_require__(6578), exports);
|
||
__exportStar(__nccwpck_require__(9536), exports);
|
||
__exportStar(__nccwpck_require__(5218), exports);
|
||
__exportStar(__nccwpck_require__(3546), exports);
|
||
__exportStar(__nccwpck_require__(1351), exports);
|
||
__exportStar(__nccwpck_require__(8237), exports);
|
||
//# sourceMappingURL=index.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9536:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.RemoteLineParser = exports.LineParser = void 0;
|
||
class LineParser {
|
||
constructor(regExp, useMatches) {
|
||
this.matches = [];
|
||
this.parse = (line, target) => {
|
||
this.resetMatches();
|
||
if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {
|
||
return false;
|
||
}
|
||
return this.useMatches(target, this.prepareMatches()) !== false;
|
||
};
|
||
this._regExp = Array.isArray(regExp) ? regExp : [regExp];
|
||
if (useMatches) {
|
||
this.useMatches = useMatches;
|
||
}
|
||
}
|
||
// @ts-ignore
|
||
useMatches(target, match) {
|
||
throw new Error(`LineParser:useMatches not implemented`);
|
||
}
|
||
resetMatches() {
|
||
this.matches.length = 0;
|
||
}
|
||
prepareMatches() {
|
||
return this.matches;
|
||
}
|
||
addMatch(reg, index, line) {
|
||
const matched = line && reg.exec(line);
|
||
if (matched) {
|
||
this.pushMatch(index, matched);
|
||
}
|
||
return !!matched;
|
||
}
|
||
pushMatch(_index, matched) {
|
||
this.matches.push(...matched.slice(1));
|
||
}
|
||
}
|
||
exports.LineParser = LineParser;
|
||
class RemoteLineParser extends LineParser {
|
||
addMatch(reg, index, line) {
|
||
return /^remote:\s/.test(String(line)) && super.addMatch(reg, index, line);
|
||
}
|
||
pushMatch(index, matched) {
|
||
if (index > 0 || matched.length > 1) {
|
||
super.pushMatch(index, matched);
|
||
}
|
||
}
|
||
}
|
||
exports.RemoteLineParser = RemoteLineParser;
|
||
//# sourceMappingURL=line-parser.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 5218:
|
||
/***/ ((__unused_webpack_module, exports) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.createInstanceConfig = void 0;
|
||
const defaultOptions = {
|
||
binary: 'git',
|
||
maxConcurrentProcesses: 5,
|
||
};
|
||
function createInstanceConfig(...options) {
|
||
const baseDir = process.cwd();
|
||
const config = Object.assign(Object.assign({ baseDir }, defaultOptions), ...(options.filter(o => typeof o === 'object' && o)));
|
||
config.baseDir = config.baseDir || baseDir;
|
||
return config;
|
||
}
|
||
exports.createInstanceConfig = createInstanceConfig;
|
||
//# sourceMappingURL=simple-git-options.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3546:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.trailingFunctionArgument = exports.trailingOptionsArgument = exports.getTrailingOptions = exports.appendTaskOptions = void 0;
|
||
const argument_filters_1 = __nccwpck_require__(7366);
|
||
const util_1 = __nccwpck_require__(8237);
|
||
function appendTaskOptions(options, commands = []) {
|
||
if (!argument_filters_1.filterPlainObject(options)) {
|
||
return commands;
|
||
}
|
||
return Object.keys(options).reduce((commands, key) => {
|
||
const value = options[key];
|
||
if (argument_filters_1.filterPrimitives(value, ['boolean'])) {
|
||
commands.push(key + '=' + value);
|
||
}
|
||
else {
|
||
commands.push(key);
|
||
}
|
||
return commands;
|
||
}, commands);
|
||
}
|
||
exports.appendTaskOptions = appendTaskOptions;
|
||
function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {
|
||
const command = [];
|
||
for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) {
|
||
if ('string|number'.includes(typeof args[i])) {
|
||
command.push(String(args[i]));
|
||
}
|
||
}
|
||
appendTaskOptions(trailingOptionsArgument(args), command);
|
||
if (!objectOnly) {
|
||
command.push(...trailingArrayArgument(args));
|
||
}
|
||
return command;
|
||
}
|
||
exports.getTrailingOptions = getTrailingOptions;
|
||
function trailingArrayArgument(args) {
|
||
const hasTrailingCallback = typeof util_1.last(args) === 'function';
|
||
return argument_filters_1.filterType(util_1.last(args, hasTrailingCallback ? 1 : 0), argument_filters_1.filterArray, []);
|
||
}
|
||
/**
|
||
* Given any number of arguments, returns the trailing options argument, ignoring a trailing function argument
|
||
* if there is one. When not found, the return value is null.
|
||
*/
|
||
function trailingOptionsArgument(args) {
|
||
const hasTrailingCallback = argument_filters_1.filterFunction(util_1.last(args));
|
||
return argument_filters_1.filterType(util_1.last(args, hasTrailingCallback ? 1 : 0), argument_filters_1.filterPlainObject);
|
||
}
|
||
exports.trailingOptionsArgument = trailingOptionsArgument;
|
||
/**
|
||
* Returns either the source argument when it is a `Function`, or the default
|
||
* `NOOP` function constant
|
||
*/
|
||
function trailingFunctionArgument(args, includeNoop = true) {
|
||
const callback = util_1.asFunction(util_1.last(args));
|
||
return includeNoop || util_1.isUserFunction(callback) ? callback : undefined;
|
||
}
|
||
exports.trailingFunctionArgument = trailingFunctionArgument;
|
||
//# sourceMappingURL=task-options.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1351:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.parseStringResponse = exports.callTaskParser = void 0;
|
||
const util_1 = __nccwpck_require__(8237);
|
||
function callTaskParser(parser, streams) {
|
||
return parser(streams.stdOut, streams.stdErr);
|
||
}
|
||
exports.callTaskParser = callTaskParser;
|
||
function parseStringResponse(result, parsers, ...texts) {
|
||
texts.forEach(text => {
|
||
for (let lines = util_1.toLinesWithContent(text), i = 0, max = lines.length; i < max; i++) {
|
||
const line = (offset = 0) => {
|
||
if ((i + offset) >= max) {
|
||
return;
|
||
}
|
||
return lines[i + offset];
|
||
};
|
||
parsers.some(({ parse }) => parse(line, result));
|
||
}
|
||
});
|
||
return result;
|
||
}
|
||
exports.parseStringResponse = parseStringResponse;
|
||
//# sourceMappingURL=task-parser.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 8237:
|
||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.asNumber = exports.asStringArray = exports.asArray = exports.objectToString = exports.remove = exports.append = exports.folderExists = exports.forEachLineWithContent = exports.toLinesWithContent = exports.last = exports.first = exports.splitOn = exports.isUserFunction = exports.asFunction = exports.NOOP = void 0;
|
||
const file_exists_1 = __nccwpck_require__(4751);
|
||
const NOOP = () => {
|
||
};
|
||
exports.NOOP = NOOP;
|
||
/**
|
||
* Returns either the source argument when it is a `Function`, or the default
|
||
* `NOOP` function constant
|
||
*/
|
||
function asFunction(source) {
|
||
return typeof source === 'function' ? source : exports.NOOP;
|
||
}
|
||
exports.asFunction = asFunction;
|
||
/**
|
||
* Determines whether the supplied argument is both a function, and is not
|
||
* the `NOOP` function.
|
||
*/
|
||
function isUserFunction(source) {
|
||
return (typeof source === 'function' && source !== exports.NOOP);
|
||
}
|
||
exports.isUserFunction = isUserFunction;
|
||
function splitOn(input, char) {
|
||
const index = input.indexOf(char);
|
||
if (index <= 0) {
|
||
return [input, ''];
|
||
}
|
||
return [
|
||
input.substr(0, index),
|
||
input.substr(index + 1),
|
||
];
|
||
}
|
||
exports.splitOn = splitOn;
|
||
function first(input, offset = 0) {
|
||
return isArrayLike(input) && input.length > offset ? input[offset] : undefined;
|
||
}
|
||
exports.first = first;
|
||
function last(input, offset = 0) {
|
||
if (isArrayLike(input) && input.length > offset) {
|
||
return input[input.length - 1 - offset];
|
||
}
|
||
}
|
||
exports.last = last;
|
||
function isArrayLike(input) {
|
||
return !!(input && typeof input.length === 'number');
|
||
}
|
||
function toLinesWithContent(input, trimmed = true, separator = '\n') {
|
||
return input.split(separator)
|
||
.reduce((output, line) => {
|
||
const lineContent = trimmed ? line.trim() : line;
|
||
if (lineContent) {
|
||
output.push(lineContent);
|
||
}
|
||
return output;
|
||
}, []);
|
||
}
|
||
exports.toLinesWithContent = toLinesWithContent;
|
||
function forEachLineWithContent(input, callback) {
|
||
return toLinesWithContent(input, true).map(line => callback(line));
|
||
}
|
||
exports.forEachLineWithContent = forEachLineWithContent;
|
||
function folderExists(path) {
|
||
return file_exists_1.exists(path, file_exists_1.FOLDER);
|
||
}
|
||
exports.folderExists = folderExists;
|
||
/**
|
||
* Adds `item` into the `target` `Array` or `Set` when it is not already present.
|
||
*/
|
||
function append(target, item) {
|
||
if (Array.isArray(target)) {
|
||
if (!target.includes(item)) {
|
||
target.push(item);
|
||
}
|
||
}
|
||
else {
|
||
target.add(item);
|
||
}
|
||
return item;
|
||
}
|
||
exports.append = append;
|
||
function remove(target, item) {
|
||
if (Array.isArray(target)) {
|
||
const index = target.indexOf(item);
|
||
if (index >= 0) {
|
||
target.splice(index, 1);
|
||
}
|
||
}
|
||
else {
|
||
target.delete(item);
|
||
}
|
||
return item;
|
||
}
|
||
exports.remove = remove;
|
||
exports.objectToString = Object.prototype.toString.call.bind(Object.prototype.toString);
|
||
function asArray(source) {
|
||
return Array.isArray(source) ? source : [source];
|
||
}
|
||
exports.asArray = asArray;
|
||
function asStringArray(source) {
|
||
return asArray(source).map(String);
|
||
}
|
||
exports.asStringArray = asStringArray;
|
||
function asNumber(source, onNaN = 0) {
|
||
if (source == null) {
|
||
return onNaN;
|
||
}
|
||
const num = parseInt(source, 10);
|
||
return isNaN(num) ? onNaN : num;
|
||
}
|
||
exports.asNumber = asNumber;
|
||
//# sourceMappingURL=util.js.map
|
||
|
||
/***/ }),
|
||
|
||
/***/ 9318:
|
||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||
|
||
"use strict";
|
||
|
||
const os = __nccwpck_require__(2087);
|
||
const tty = __nccwpck_require__(3867);
|
||
const hasFlag = __nccwpck_require__(1621);
|
||
|
||
const {env} = process;
|
||
|
||
let forceColor;
|
||
if (hasFlag('no-color') ||
|
||
hasFlag('no-colors') ||
|
||
hasFlag('color=false') ||
|
||
hasFlag('color=never')) {
|
||
forceColor = 0;
|
||
} else if (hasFlag('color') ||
|
||
hasFlag('colors') ||
|
||
hasFlag('color=true') ||
|
||
hasFlag('color=always')) {
|
||
forceColor = 1;
|
||
}
|
||
|
||
if ('FORCE_COLOR' in env) {
|
||
if (env.FORCE_COLOR === 'true') {
|
||
forceColor = 1;
|
||
} else if (env.FORCE_COLOR === 'false') {
|
||
forceColor = 0;
|
||
} else {
|
||
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
||
}
|
||
}
|
||
|
||
function translateLevel(level) {
|
||
if (level === 0) {
|
||
return false;
|
||
}
|
||
|
||
return {
|
||
level,
|
||
hasBasic: true,
|
||
has256: level >= 2,
|
||
has16m: level >= 3
|
||
};
|
||
}
|
||
|
||
function supportsColor(haveStream, streamIsTTY) {
|
||
if (forceColor === 0) {
|
||
return 0;
|
||
}
|
||
|
||
if (hasFlag('color=16m') ||
|
||
hasFlag('color=full') ||
|
||
hasFlag('color=truecolor')) {
|
||
return 3;
|
||
}
|
||
|
||
if (hasFlag('color=256')) {
|
||
return 2;
|
||
}
|
||
|
||
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
||
return 0;
|
||
}
|
||
|
||
const min = forceColor || 0;
|
||
|
||
if (env.TERM === 'dumb') {
|
||
return min;
|
||
}
|
||
|
||
if (process.platform === 'win32') {
|
||
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
||
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
||
const osRelease = os.release().split('.');
|
||
if (
|
||
Number(osRelease[0]) >= 10 &&
|
||
Number(osRelease[2]) >= 10586
|
||
) {
|
||
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
|
||
if ('CI' in env) {
|
||
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
||
return 1;
|
||
}
|
||
|
||
return min;
|
||
}
|
||
|
||
if ('TEAMCITY_VERSION' in env) {
|
||
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
||
}
|
||
|
||
if (env.COLORTERM === 'truecolor') {
|
||
return 3;
|
||
}
|
||
|
||
if ('TERM_PROGRAM' in env) {
|
||
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
||
|
||
switch (env.TERM_PROGRAM) {
|
||
case 'iTerm.app':
|
||
return version >= 3 ? 3 : 2;
|
||
case 'Apple_Terminal':
|
||
return 2;
|
||
// No default
|
||
}
|
||
}
|
||
|
||
if (/-256(color)?$/i.test(env.TERM)) {
|
||
return 2;
|
||
}
|
||
|
||
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
||
return 1;
|
||
}
|
||
|
||
if ('COLORTERM' in env) {
|
||
return 1;
|
||
}
|
||
|
||
return min;
|
||
}
|
||
|
||
function getSupportLevel(stream) {
|
||
const level = supportsColor(stream, stream && stream.isTTY);
|
||
return translateLevel(level);
|
||
}
|
||
|
||
module.exports = {
|
||
supportsColor: getSupportLevel,
|
||
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
||
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 399:
|
||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
return new (P || (P = Promise))(function (resolve, reject) {
|
||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
});
|
||
};
|
||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
};
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
const core_1 = __nccwpck_require__(2186);
|
||
const path_1 = __importDefault(__nccwpck_require__(5622));
|
||
const simple_git_1 = __importDefault(__nccwpck_require__(1477));
|
||
const js_yaml_1 = __importDefault(__nccwpck_require__(1917));
|
||
const util_1 = __nccwpck_require__(2629);
|
||
const baseDir = path_1.default.join(process.cwd(), util_1.getInput('cwd') || '');
|
||
const git = simple_git_1.default({ baseDir });
|
||
console.log(`Running in ${baseDir}`);
|
||
(() => __awaiter(void 0, void 0, void 0, function* () {
|
||
var _a;
|
||
yield checkInputs().catch(core_1.setFailed);
|
||
core_1.startGroup('Internal logs');
|
||
core_1.info('> Staging files...');
|
||
if (util_1.getInput('add')) {
|
||
core_1.info('> Adding files...');
|
||
yield add();
|
||
}
|
||
else
|
||
core_1.info('> No files to add.');
|
||
if (util_1.getInput('remove')) {
|
||
core_1.info('> Removing files...');
|
||
yield remove();
|
||
}
|
||
else
|
||
core_1.info('> No files to remove.');
|
||
core_1.info('> Checking for uncommitted changes in the git working tree...');
|
||
const changedFiles = (yield git.diffSummary(['--cached'])).files.length;
|
||
if (changedFiles > 0) {
|
||
core_1.info(`> Found ${changedFiles} changed files.`);
|
||
yield git
|
||
.addConfig('user.email', util_1.getInput('author_email'), undefined, util_1.log)
|
||
.addConfig('user.name', util_1.getInput('author_name'), undefined, util_1.log);
|
||
core_1.debug('> Current git config\n' +
|
||
JSON.stringify((yield git.listConfig()).all, null, 2));
|
||
yield git.fetch(['--tags', '--force'], util_1.log);
|
||
core_1.info('> Switching/creating branch...');
|
||
yield git
|
||
.checkout(util_1.getInput('branch'), undefined, util_1.log)
|
||
.catch(() => git.checkoutLocalBranch(util_1.getInput('branch'), util_1.log));
|
||
if (util_1.getInput('pull_strategy') == 'NO-PULL')
|
||
core_1.info('> Not pulling from repo.');
|
||
else {
|
||
core_1.info('> Pulling from remote...');
|
||
yield git.fetch(undefined, util_1.log).pull(undefined, undefined, {
|
||
[util_1.getInput('pull_strategy')]: null
|
||
}, util_1.log);
|
||
}
|
||
core_1.info('> Re-staging files...');
|
||
if (util_1.getInput('add'))
|
||
yield add({ ignoreErrors: true });
|
||
if (util_1.getInput('remove'))
|
||
yield remove({ ignoreErrors: true });
|
||
core_1.info('> Creating commit...');
|
||
yield git.commit(util_1.getInput('message'), undefined, Object.assign({ '--author': `"${util_1.getInput('author_name')} <${util_1.getInput('author_email')}>"` }, (util_1.getInput('signoff')
|
||
? {
|
||
'--signoff': null
|
||
}
|
||
: {})), (err, data) => {
|
||
if (data)
|
||
util_1.setOutput('committed', 'true');
|
||
return util_1.log(err, data);
|
||
});
|
||
if (util_1.getInput('tag')) {
|
||
core_1.info('> Tagging commit...');
|
||
yield git
|
||
.tag(util_1.matchGitArgs(util_1.getInput('tag')), (err, data) => {
|
||
if (data)
|
||
util_1.setOutput('tagged', 'true');
|
||
return util_1.log(err, data);
|
||
})
|
||
.then((data) => {
|
||
util_1.setOutput('tagged', 'true');
|
||
return util_1.log(null, data);
|
||
})
|
||
.catch((err) => core_1.setFailed(err));
|
||
}
|
||
else
|
||
core_1.info('> No tag info provided.');
|
||
const pushOption = (_a = util_1.parseBool(util_1.getInput('push'))) !== null && _a !== void 0 ? _a : util_1.getInput('push');
|
||
if (pushOption) {
|
||
// If the options is `true | string`...
|
||
core_1.info('> Pushing commit to repo...');
|
||
if (pushOption === true) {
|
||
core_1.debug(`Running: git push origin ${util_1.getInput('branch')} --set-upstream`);
|
||
yield git.push('origin', util_1.getInput('branch'), { '--set-upstream': null }, (err, data) => {
|
||
if (data)
|
||
util_1.setOutput('pushed', 'true');
|
||
return util_1.log(err, data);
|
||
});
|
||
}
|
||
else {
|
||
core_1.debug(`Running: git push ${pushOption}`);
|
||
yield git.push(undefined, undefined, util_1.matchGitArgs(pushOption), (err, data) => {
|
||
if (data)
|
||
util_1.setOutput('pushed', 'true');
|
||
return util_1.log(err, data);
|
||
});
|
||
}
|
||
if (util_1.getInput('tag')) {
|
||
core_1.info('> Pushing tags to repo...');
|
||
yield git
|
||
.pushTags('origin', undefined, (e, d) => util_1.log(undefined, e || d))
|
||
.catch(() => {
|
||
core_1.info('> Tag push failed: deleting remote tag and re-pushing...');
|
||
return git
|
||
.push(undefined, undefined, {
|
||
'--delete': null,
|
||
origin: null,
|
||
[util_1.matchGitArgs(util_1.getInput('tag')).filter((w) => !w.startsWith('-'))[0]]: null
|
||
}, util_1.log)
|
||
.pushTags('origin', undefined, util_1.log);
|
||
});
|
||
}
|
||
else
|
||
core_1.info('> No tags to push.');
|
||
}
|
||
else
|
||
core_1.info('> Not pushing anything.');
|
||
core_1.endGroup();
|
||
core_1.info('> Task completed.');
|
||
}
|
||
else {
|
||
core_1.endGroup();
|
||
core_1.info('> Working tree clean. Nothing to commit.');
|
||
}
|
||
}))()
|
||
.then(logOutputs)
|
||
.catch((e) => {
|
||
core_1.endGroup();
|
||
logOutputs();
|
||
core_1.setFailed(e);
|
||
});
|
||
function checkInputs() {
|
||
var _a, _b, _c, _d;
|
||
return __awaiter(this, void 0, void 0, function* () {
|
||
function setInput(input, value) {
|
||
if (value)
|
||
return (process.env[`INPUT_${input.toUpperCase()}`] = value);
|
||
else
|
||
return delete process.env[`INPUT_${input.toUpperCase()}`];
|
||
}
|
||
function setDefault(input, value) {
|
||
if (!util_1.getInput(input))
|
||
setInput(input, value);
|
||
return util_1.getInput(input);
|
||
}
|
||
const eventPath = process.env.GITHUB_EVENT_PATH, event = eventPath && require(eventPath), isPR = (_a = process.env.GITHUB_EVENT_NAME) === null || _a === void 0 ? void 0 : _a.includes('pull_request'), defaultBranch = isPR
|
||
? (_c = (_b = event === null || event === void 0 ? void 0 : event.pull_request) === null || _b === void 0 ? void 0 : _b.head) === null || _c === void 0 ? void 0 : _c.ref
|
||
: (_d = process.env.GITHUB_REF) === null || _d === void 0 ? void 0 : _d.substring(11);
|
||
// #region add, remove
|
||
if (!util_1.getInput('add') && !util_1.getInput('remove'))
|
||
throw new Error("Both 'add' and 'remove' are empty, the action has nothing to do.");
|
||
if (util_1.getInput('add')) {
|
||
const parsed = parseInputArray(util_1.getInput('add'));
|
||
if (parsed.length == 1)
|
||
core_1.info('Add input parsed as single string, running 1 git add command.');
|
||
else if (parsed.length > 1)
|
||
core_1.info(`Add input parsed as string array, running ${parsed.length} git add commands.`);
|
||
else
|
||
core_1.setFailed('Add input: array length < 1');
|
||
}
|
||
if (util_1.getInput('remove')) {
|
||
const parsed = parseInputArray(util_1.getInput('remove'));
|
||
if (parsed.length == 1)
|
||
core_1.info('Remove input parsed as single string, running 1 git rm command.');
|
||
else if (parsed.length > 1)
|
||
core_1.info(`Remove input parsed as string array, running ${parsed.length} git rm commands.`);
|
||
else
|
||
core_1.setFailed('Remove input: array length < 1');
|
||
}
|
||
// #endregion
|
||
// #region author_name, author_email
|
||
setDefault('author_name', `${process.env.GITHUB_ACTOR}`);
|
||
setDefault('author_email', `${process.env.GITHUB_ACTOR}@users.noreply.github.com`);
|
||
core_1.info(`> Using '${util_1.getInput('author_name')} <${util_1.getInput('author_email')}>' as author.`);
|
||
// #endregion
|
||
// #region message
|
||
setDefault('message', `Commit from GitHub Actions (${process.env.GITHUB_WORKFLOW})`);
|
||
core_1.info(`> Using "${util_1.getInput('message')}" as commit message.`);
|
||
// #endregion
|
||
// #region branch
|
||
const branch = setDefault('branch', defaultBranch || '');
|
||
if (isPR)
|
||
core_1.info(`> Running for a PR, the action will use '${branch}' as ref.`);
|
||
// #endregion
|
||
// #region signoff
|
||
if (util_1.getInput('signoff')) {
|
||
const parsed = util_1.parseBool(util_1.getInput('signoff'));
|
||
if (parsed === undefined)
|
||
throw new Error(`"${util_1.getInput('signoff')}" is not a valid value for the 'signoff' input: only "true" and "false" are allowed.`);
|
||
if (!parsed)
|
||
setInput('signoff', undefined);
|
||
core_1.debug(`Current signoff option: ${util_1.getInput('signoff')} (${typeof util_1.getInput('signoff')})`);
|
||
}
|
||
// #endregion
|
||
// #region pull_strategy
|
||
if (util_1.getInput('pull_strategy') == 'NO-PULL')
|
||
core_1.debug("NO-PULL found: won't pull from remote.");
|
||
// #endregion
|
||
// #region push
|
||
if (util_1.getInput('push')) {
|
||
// It has to be either 'true', 'false', or any other string (use as arguments)
|
||
const parsed = util_1.parseBool(util_1.getInput('push'));
|
||
core_1.debug(`Current push option: '${util_1.getInput('push')}' (parsed as ${typeof parsed})`);
|
||
}
|
||
});
|
||
}
|
||
function add({ logWarning = true, ignoreErrors = false } = {}) {
|
||
return __awaiter(this, void 0, void 0, function* () {
|
||
const input = util_1.getInput('add');
|
||
if (!input)
|
||
return [];
|
||
const parsed = parseInputArray(input);
|
||
const res = [];
|
||
for (const args of parsed) {
|
||
res.push(
|
||
// Push the result of every git command (which are executed in order) to the array
|
||
// If any of them fails, the whole function will return a Promise rejection
|
||
yield git
|
||
.add(util_1.matchGitArgs(args), (err, data) => util_1.log(ignoreErrors ? null : err, data))
|
||
.catch((e) => {
|
||
if (ignoreErrors)
|
||
return;
|
||
if (e.message.includes('fatal: pathspec') &&
|
||
e.message.includes('did not match any files') &&
|
||
logWarning)
|
||
core_1.warning(`Add command did not match any file:\n git add ${args}`);
|
||
else
|
||
throw e;
|
||
}));
|
||
}
|
||
return res;
|
||
});
|
||
}
|
||
function remove({ logWarning = true, ignoreErrors = false } = {}) {
|
||
return __awaiter(this, void 0, void 0, function* () {
|
||
const input = util_1.getInput('remove');
|
||
if (!input)
|
||
return [];
|
||
const parsed = parseInputArray(input);
|
||
const res = [];
|
||
for (const args of parsed) {
|
||
res.push(
|
||
// Push the result of every git command (which are executed in order) to the array
|
||
// If any of them fails, the whole function will return a Promise rejection
|
||
yield git
|
||
.rm(util_1.matchGitArgs(args), (e, d) => util_1.log(ignoreErrors ? null : e, d))
|
||
.catch((e) => {
|
||
if (ignoreErrors)
|
||
return;
|
||
if (e.message.includes('fatal: pathspec') &&
|
||
e.message.includes('did not match any files'))
|
||
logWarning &&
|
||
core_1.warning(`Remove command did not match any file:\n git rm ${args}`);
|
||
else
|
||
throw e;
|
||
}));
|
||
}
|
||
return res;
|
||
});
|
||
}
|
||
/**
|
||
* Tries to parse a JSON array, then a YAML array.
|
||
* If both fail, it returns an array containing the input value as its only element
|
||
*/
|
||
function parseInputArray(input) {
|
||
try {
|
||
const json = JSON.parse(input);
|
||
if (json &&
|
||
Array.isArray(json) &&
|
||
json.every((e) => typeof e == 'string')) {
|
||
core_1.debug(`Input parsed as JSON array of length ${json.length}`);
|
||
return json;
|
||
}
|
||
}
|
||
catch (_a) { }
|
||
try {
|
||
const yaml = js_yaml_1.default.load(input);
|
||
if (yaml &&
|
||
Array.isArray(yaml) &&
|
||
yaml.every((e) => typeof e == 'string')) {
|
||
core_1.debug(`Input parsed as YAML array of length ${yaml.length}`);
|
||
return yaml;
|
||
}
|
||
}
|
||
catch (_b) { }
|
||
core_1.debug('Input parsed as single string');
|
||
return [input];
|
||
}
|
||
function logOutputs() {
|
||
core_1.startGroup('Outputs');
|
||
for (const key in util_1.outputs) {
|
||
core_1.info(`${key}: ${util_1.outputs[key]}`);
|
||
}
|
||
core_1.endGroup();
|
||
}
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2629:
|
||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||
|
||
"use strict";
|
||
|
||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||
}) : (function(o, m, k, k2) {
|
||
if (k2 === undefined) k2 = k;
|
||
o[k2] = m[k];
|
||
}));
|
||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||
}) : function(o, v) {
|
||
o["default"] = v;
|
||
});
|
||
var __importStar = (this && this.__importStar) || function (mod) {
|
||
if (mod && mod.__esModule) return mod;
|
||
var result = {};
|
||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||
__setModuleDefault(result, mod);
|
||
return result;
|
||
};
|
||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||
exports.setOutput = exports.parseBool = exports.matchGitArgs = exports.log = exports.getInput = exports.outputs = void 0;
|
||
const core = __importStar(__nccwpck_require__(2186));
|
||
exports.outputs = {
|
||
committed: 'false',
|
||
pushed: 'false',
|
||
tagged: 'false'
|
||
};
|
||
function getInput(name) {
|
||
return core.getInput(name);
|
||
}
|
||
exports.getInput = getInput;
|
||
function log(err, data) {
|
||
if (data)
|
||
console.log(data);
|
||
if (err)
|
||
core.error(err);
|
||
}
|
||
exports.log = log;
|
||
/**
|
||
* Matches the different pathspecs and arguments by removing spaces that are not inside quotes
|
||
* @example
|
||
* ```js
|
||
* matchGitArgs(' first second "third" \'fourth\'') => [ 'first', 'second', '"third"', "'fourth'" ]
|
||
* matchGitArgs(' ') => [ ]
|
||
* ```
|
||
* @returns An array, if there's no match it'll be empty
|
||
*/
|
||
function matchGitArgs(string) {
|
||
return string.match(/(?:[^\s"]+|"[^"]*")+/g) || [];
|
||
}
|
||
exports.matchGitArgs = matchGitArgs;
|
||
function parseBool(value) {
|
||
try {
|
||
const parsed = JSON.parse(value);
|
||
if (typeof parsed == 'boolean')
|
||
return parsed;
|
||
}
|
||
catch (_a) { }
|
||
}
|
||
exports.parseBool = parseBool;
|
||
function setOutput(name, value) {
|
||
core.debug(`Setting output: ${name}=${value}`);
|
||
exports.outputs[name] = value;
|
||
return core.setOutput(name, value);
|
||
}
|
||
exports.setOutput = setOutput;
|
||
for (const key in exports.outputs)
|
||
setOutput(key, exports.outputs[key]);
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3129:
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = require("child_process");;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 5747:
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = require("fs");;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 2087:
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = require("os");;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 5622:
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = require("path");;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 3867:
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = require("tty");;
|
||
|
||
/***/ }),
|
||
|
||
/***/ 1669:
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
module.exports = require("util");;
|
||
|
||
/***/ })
|
||
|
||
/******/ });
|
||
/************************************************************************/
|
||
/******/ // The module cache
|
||
/******/ var __webpack_module_cache__ = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __nccwpck_require__(moduleId) {
|
||
/******/ // Check if module is in cache
|
||
/******/ if(__webpack_module_cache__[moduleId]) {
|
||
/******/ return __webpack_module_cache__[moduleId].exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||
/******/ // no module.id needed
|
||
/******/ // no module.loaded needed
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ var threw = true;
|
||
/******/ try {
|
||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__);
|
||
/******/ threw = false;
|
||
/******/ } finally {
|
||
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
||
/******/ }
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/************************************************************************/
|
||
/******/ /* webpack/runtime/compat */
|
||
/******/
|
||
/******/ __nccwpck_require__.ab = __dirname + "/";/************************************************************************/
|
||
/******/ // module exports must be returned from runtime so entry inlining is disabled
|
||
/******/ // startup
|
||
/******/ // Load entry module and return exports
|
||
/******/ return __nccwpck_require__(399);
|
||
/******/ })()
|
||
; |