@wix/cli
Version:
CLI tool for building Wix sites and applications
1,683 lines (1,674 loc) • 2.04 MB
JavaScript
import { createRequire as _createRequire } from 'node:module';
const require = _createRequire(import.meta.url);
import {
require_esprima
} from "./chunk-SR7TTQEG.js";
import {
GridAppLayout
} from "./chunk-QRGKMYDD.js";
import {
require_isexe
} from "./chunk-MHV22UIU.js";
import {
require_clean,
require_is_core_module,
require_semver,
require_valid,
resolveUrl,
serializer,
toURLSearchParams
} from "./chunk-CCWE4DS6.js";
import {
require_index_node,
require_ms,
require_src
} from "./chunk-U5H3SP3I.js";
import {
external_exports
} from "./chunk-SDLCFZRL.js";
import {
require_verror
} from "./chunk-CO5A7CZG.js";
import {
__commonJS,
__dirname,
__require,
__toESM,
init_esm_shims
} from "./chunk-EXLZF52D.js";
// ../../node_modules/comment-json/node_modules/core-util-is/lib/util.js
var require_util = __commonJS({
"../../node_modules/comment-json/node_modules/core-util-is/lib/util.js"(exports2) {
"use strict";
init_esm_shims();
function isArray(arg) {
if (Array.isArray) {
return Array.isArray(arg);
}
return objectToString(arg) === "[object Array]";
}
exports2.isArray = isArray;
function isBoolean(arg) {
return typeof arg === "boolean";
}
exports2.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports2.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports2.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === "number";
}
exports2.isNumber = isNumber;
function isString(arg) {
return typeof arg === "string";
}
exports2.isString = isString;
function isSymbol(arg) {
return typeof arg === "symbol";
}
exports2.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports2.isUndefined = isUndefined;
function isRegExp(re) {
return objectToString(re) === "[object RegExp]";
}
exports2.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === "object" && arg !== null;
}
exports2.isObject = isObject;
function isDate(d) {
return objectToString(d) === "[object Date]";
}
exports2.isDate = isDate;
function isError(e) {
return objectToString(e) === "[object Error]" || e instanceof Error;
}
exports2.isError = isError;
function isFunction(arg) {
return typeof arg === "function";
}
exports2.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
typeof arg === "undefined";
}
exports2.isPrimitive = isPrimitive;
exports2.isBuffer = __require("buffer").Buffer.isBuffer;
function objectToString(o) {
return Object.prototype.toString.call(o);
}
}
});
// ../../node_modules/array-timsort/src/index.js
var require_src2 = __commonJS({
"../../node_modules/array-timsort/src/index.js"(exports2, module2) {
"use strict";
init_esm_shims();
var DEFAULT_MIN_MERGE = 32;
var DEFAULT_MIN_GALLOPING = 7;
var DEFAULT_TMP_STORAGE_LENGTH = 256;
var POWERS_OF_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9];
var results;
var log10 = (x) => x < 1e5 ? x < 100 ? x < 10 ? 0 : 1 : x < 1e4 ? x < 1e3 ? 2 : 3 : 4 : x < 1e7 ? x < 1e6 ? 5 : 6 : x < 1e9 ? x < 1e8 ? 7 : 8 : 9;
function alphabeticalCompare(a, b) {
if (a === b) {
return 0;
}
if (~~a === a && ~~b === b) {
if (a === 0 || b === 0) {
return a < b ? -1 : 1;
}
if (a < 0 || b < 0) {
if (b >= 0) {
return -1;
}
if (a >= 0) {
return 1;
}
a = -a;
b = -b;
}
const al = log10(a);
const bl = log10(b);
let t = 0;
if (al < bl) {
a *= POWERS_OF_TEN[bl - al - 1];
b /= 10;
t = -1;
} else if (al > bl) {
b *= POWERS_OF_TEN[al - bl - 1];
a /= 10;
t = 1;
}
if (a === b) {
return t;
}
return a < b ? -1 : 1;
}
const aStr = String(a);
const bStr = String(b);
if (aStr === bStr) {
return 0;
}
return aStr < bStr ? -1 : 1;
}
function minRunLength(n) {
let r = 0;
while (n >= DEFAULT_MIN_MERGE) {
r |= n & 1;
n >>= 1;
}
return n + r;
}
function makeAscendingRun(array, lo, hi, compare) {
let runHi = lo + 1;
if (runHi === hi) {
return 1;
}
if (compare(array[runHi++], array[lo]) < 0) {
while (runHi < hi && compare(array[runHi], array[runHi - 1]) < 0) {
runHi++;
}
reverseRun(array, lo, runHi);
reverseRun(results, lo, runHi);
} else {
while (runHi < hi && compare(array[runHi], array[runHi - 1]) >= 0) {
runHi++;
}
}
return runHi - lo;
}
function reverseRun(array, lo, hi) {
hi--;
while (lo < hi) {
const t = array[lo];
array[lo++] = array[hi];
array[hi--] = t;
}
}
function binaryInsertionSort(array, lo, hi, start, compare) {
if (start === lo) {
start++;
}
for (; start < hi; start++) {
const pivot = array[start];
const pivotIndex = results[start];
let left = lo;
let right = start;
while (left < right) {
const mid = left + right >>> 1;
if (compare(pivot, array[mid]) < 0) {
right = mid;
} else {
left = mid + 1;
}
}
let n = start - left;
switch (n) {
case 3:
array[left + 3] = array[left + 2];
results[left + 3] = results[left + 2];
/* falls through */
case 2:
array[left + 2] = array[left + 1];
results[left + 2] = results[left + 1];
/* falls through */
case 1:
array[left + 1] = array[left];
results[left + 1] = results[left];
break;
default:
while (n > 0) {
array[left + n] = array[left + n - 1];
results[left + n] = results[left + n - 1];
n--;
}
}
array[left] = pivot;
results[left] = pivotIndex;
}
}
function gallopLeft(value, array, start, length, hint, compare) {
let lastOffset = 0;
let maxOffset = 0;
let offset = 1;
if (compare(value, array[start + hint]) > 0) {
maxOffset = length - hint;
while (offset < maxOffset && compare(value, array[start + hint + offset]) > 0) {
lastOffset = offset;
offset = (offset << 1) + 1;
if (offset <= 0) {
offset = maxOffset;
}
}
if (offset > maxOffset) {
offset = maxOffset;
}
lastOffset += hint;
offset += hint;
} else {
maxOffset = hint + 1;
while (offset < maxOffset && compare(value, array[start + hint - offset]) <= 0) {
lastOffset = offset;
offset = (offset << 1) + 1;
if (offset <= 0) {
offset = maxOffset;
}
}
if (offset > maxOffset) {
offset = maxOffset;
}
const tmp = lastOffset;
lastOffset = hint - offset;
offset = hint - tmp;
}
lastOffset++;
while (lastOffset < offset) {
const m = lastOffset + (offset - lastOffset >>> 1);
if (compare(value, array[start + m]) > 0) {
lastOffset = m + 1;
} else {
offset = m;
}
}
return offset;
}
function gallopRight(value, array, start, length, hint, compare) {
let lastOffset = 0;
let maxOffset = 0;
let offset = 1;
if (compare(value, array[start + hint]) < 0) {
maxOffset = hint + 1;
while (offset < maxOffset && compare(value, array[start + hint - offset]) < 0) {
lastOffset = offset;
offset = (offset << 1) + 1;
if (offset <= 0) {
offset = maxOffset;
}
}
if (offset > maxOffset) {
offset = maxOffset;
}
const tmp = lastOffset;
lastOffset = hint - offset;
offset = hint - tmp;
} else {
maxOffset = length - hint;
while (offset < maxOffset && compare(value, array[start + hint + offset]) >= 0) {
lastOffset = offset;
offset = (offset << 1) + 1;
if (offset <= 0) {
offset = maxOffset;
}
}
if (offset > maxOffset) {
offset = maxOffset;
}
lastOffset += hint;
offset += hint;
}
lastOffset++;
while (lastOffset < offset) {
const m = lastOffset + (offset - lastOffset >>> 1);
if (compare(value, array[start + m]) < 0) {
offset = m;
} else {
lastOffset = m + 1;
}
}
return offset;
}
var TimSort = class {
constructor(array, compare) {
this.array = array;
this.compare = compare;
const { length } = array;
this.length = length;
this.minGallop = DEFAULT_MIN_GALLOPING;
this.tmpStorageLength = length < 2 * DEFAULT_TMP_STORAGE_LENGTH ? length >>> 1 : DEFAULT_TMP_STORAGE_LENGTH;
this.tmp = new Array(this.tmpStorageLength);
this.tmpIndex = new Array(this.tmpStorageLength);
this.stackLength = length < 120 ? 5 : length < 1542 ? 10 : length < 119151 ? 19 : 40;
this.runStart = new Array(this.stackLength);
this.runLength = new Array(this.stackLength);
this.stackSize = 0;
}
/**
* Push a new run on TimSort's stack.
*
* @param {number} runStart - Start index of the run in the original array.
* @param {number} runLength - Length of the run;
*/
pushRun(runStart, runLength) {
this.runStart[this.stackSize] = runStart;
this.runLength[this.stackSize] = runLength;
this.stackSize += 1;
}
/**
* Merge runs on TimSort's stack so that the following holds for all i:
* 1) runLength[i - 3] > runLength[i - 2] + runLength[i - 1]
* 2) runLength[i - 2] > runLength[i - 1]
*/
mergeRuns() {
while (this.stackSize > 1) {
let n = this.stackSize - 2;
if (n >= 1 && this.runLength[n - 1] <= this.runLength[n] + this.runLength[n + 1] || n >= 2 && this.runLength[n - 2] <= this.runLength[n] + this.runLength[n - 1]) {
if (this.runLength[n - 1] < this.runLength[n + 1]) {
n--;
}
} else if (this.runLength[n] > this.runLength[n + 1]) {
break;
}
this.mergeAt(n);
}
}
/**
* Merge all runs on TimSort's stack until only one remains.
*/
forceMergeRuns() {
while (this.stackSize > 1) {
let n = this.stackSize - 2;
if (n > 0 && this.runLength[n - 1] < this.runLength[n + 1]) {
n--;
}
this.mergeAt(n);
}
}
/**
* Merge the runs on the stack at positions i and i+1. Must be always be called
* with i=stackSize-2 or i=stackSize-3 (that is, we merge on top of the stack).
*
* @param {number} i - Index of the run to merge in TimSort's stack.
*/
mergeAt(i) {
const { compare } = this;
const { array } = this;
let start1 = this.runStart[i];
let length1 = this.runLength[i];
const start2 = this.runStart[i + 1];
let length2 = this.runLength[i + 1];
this.runLength[i] = length1 + length2;
if (i === this.stackSize - 3) {
this.runStart[i + 1] = this.runStart[i + 2];
this.runLength[i + 1] = this.runLength[i + 2];
}
this.stackSize--;
const k = gallopRight(array[start2], array, start1, length1, 0, compare);
start1 += k;
length1 -= k;
if (length1 === 0) {
return;
}
length2 = gallopLeft(
array[start1 + length1 - 1],
array,
start2,
length2,
length2 - 1,
compare
);
if (length2 === 0) {
return;
}
if (length1 <= length2) {
this.mergeLow(start1, length1, start2, length2);
} else {
this.mergeHigh(start1, length1, start2, length2);
}
}
/**
* Merge two adjacent runs in a stable way. The runs must be such that the
* first element of run1 is bigger than the first element in run2 and the
* last element of run1 is greater than all the elements in run2.
* The method should be called when run1.length <= run2.length as it uses
* TimSort temporary array to store run1. Use mergeHigh if run1.length >
* run2.length.
*
* @param {number} start1 - First element in run1.
* @param {number} length1 - Length of run1.
* @param {number} start2 - First element in run2.
* @param {number} length2 - Length of run2.
*/
mergeLow(start1, length1, start2, length2) {
const { compare } = this;
const { array } = this;
const { tmp } = this;
const { tmpIndex } = this;
let i = 0;
for (i = 0; i < length1; i++) {
tmp[i] = array[start1 + i];
tmpIndex[i] = results[start1 + i];
}
let cursor1 = 0;
let cursor2 = start2;
let dest = start1;
array[dest] = array[cursor2];
results[dest] = results[cursor2];
dest++;
cursor2++;
if (--length2 === 0) {
for (i = 0; i < length1; i++) {
array[dest + i] = tmp[cursor1 + i];
results[dest + i] = tmpIndex[cursor1 + i];
}
return;
}
if (length1 === 1) {
for (i = 0; i < length2; i++) {
array[dest + i] = array[cursor2 + i];
results[dest + i] = results[cursor2 + i];
}
array[dest + length2] = tmp[cursor1];
results[dest + length2] = tmpIndex[cursor1];
return;
}
let { minGallop } = this;
while (true) {
let count1 = 0;
let count2 = 0;
let exit = false;
do {
if (compare(array[cursor2], tmp[cursor1]) < 0) {
array[dest] = array[cursor2];
results[dest] = results[cursor2];
dest++;
cursor2++;
count2++;
count1 = 0;
if (--length2 === 0) {
exit = true;
break;
}
} else {
array[dest] = tmp[cursor1];
results[dest] = tmpIndex[cursor1];
dest++;
cursor1++;
count1++;
count2 = 0;
if (--length1 === 1) {
exit = true;
break;
}
}
} while ((count1 | count2) < minGallop);
if (exit) {
break;
}
do {
count1 = gallopRight(array[cursor2], tmp, cursor1, length1, 0, compare);
if (count1 !== 0) {
for (i = 0; i < count1; i++) {
array[dest + i] = tmp[cursor1 + i];
results[dest + i] = tmpIndex[cursor1 + i];
}
dest += count1;
cursor1 += count1;
length1 -= count1;
if (length1 <= 1) {
exit = true;
break;
}
}
array[dest] = array[cursor2];
results[dest] = results[cursor2];
dest++;
cursor2++;
if (--length2 === 0) {
exit = true;
break;
}
count2 = gallopLeft(tmp[cursor1], array, cursor2, length2, 0, compare);
if (count2 !== 0) {
for (i = 0; i < count2; i++) {
array[dest + i] = array[cursor2 + i];
results[dest + i] = results[cursor2 + i];
}
dest += count2;
cursor2 += count2;
length2 -= count2;
if (length2 === 0) {
exit = true;
break;
}
}
array[dest] = tmp[cursor1];
results[dest] = tmpIndex[cursor1];
dest++;
cursor1++;
if (--length1 === 1) {
exit = true;
break;
}
minGallop--;
} while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);
if (exit) {
break;
}
if (minGallop < 0) {
minGallop = 0;
}
minGallop += 2;
}
this.minGallop = minGallop;
if (minGallop < 1) {
this.minGallop = 1;
}
if (length1 === 1) {
for (i = 0; i < length2; i++) {
array[dest + i] = array[cursor2 + i];
results[dest + i] = results[cursor2 + i];
}
array[dest + length2] = tmp[cursor1];
results[dest + length2] = tmpIndex[cursor1];
} else if (length1 === 0) {
throw new Error("mergeLow preconditions were not respected");
} else {
for (i = 0; i < length1; i++) {
array[dest + i] = tmp[cursor1 + i];
results[dest + i] = tmpIndex[cursor1 + i];
}
}
}
/**
* Merge two adjacent runs in a stable way. The runs must be such that the
* first element of run1 is bigger than the first element in run2 and the
* last element of run1 is greater than all the elements in run2.
* The method should be called when run1.length > run2.length as it uses
* TimSort temporary array to store run2. Use mergeLow if run1.length <=
* run2.length.
*
* @param {number} start1 - First element in run1.
* @param {number} length1 - Length of run1.
* @param {number} start2 - First element in run2.
* @param {number} length2 - Length of run2.
*/
mergeHigh(start1, length1, start2, length2) {
const { compare } = this;
const { array } = this;
const { tmp } = this;
const { tmpIndex } = this;
let i = 0;
for (i = 0; i < length2; i++) {
tmp[i] = array[start2 + i];
tmpIndex[i] = results[start2 + i];
}
let cursor1 = start1 + length1 - 1;
let cursor2 = length2 - 1;
let dest = start2 + length2 - 1;
let customCursor = 0;
let customDest = 0;
array[dest] = array[cursor1];
results[dest] = results[cursor1];
dest--;
cursor1--;
if (--length1 === 0) {
customCursor = dest - (length2 - 1);
for (i = 0; i < length2; i++) {
array[customCursor + i] = tmp[i];
results[customCursor + i] = tmpIndex[i];
}
return;
}
if (length2 === 1) {
dest -= length1;
cursor1 -= length1;
customDest = dest + 1;
customCursor = cursor1 + 1;
for (i = length1 - 1; i >= 0; i--) {
array[customDest + i] = array[customCursor + i];
results[customDest + i] = results[customCursor + i];
}
array[dest] = tmp[cursor2];
results[dest] = tmpIndex[cursor2];
return;
}
let { minGallop } = this;
while (true) {
let count1 = 0;
let count2 = 0;
let exit = false;
do {
if (compare(tmp[cursor2], array[cursor1]) < 0) {
array[dest] = array[cursor1];
results[dest] = results[cursor1];
dest--;
cursor1--;
count1++;
count2 = 0;
if (--length1 === 0) {
exit = true;
break;
}
} else {
array[dest] = tmp[cursor2];
results[dest] = tmpIndex[cursor2];
dest--;
cursor2--;
count2++;
count1 = 0;
if (--length2 === 1) {
exit = true;
break;
}
}
} while ((count1 | count2) < minGallop);
if (exit) {
break;
}
do {
count1 = length1 - gallopRight(
tmp[cursor2],
array,
start1,
length1,
length1 - 1,
compare
);
if (count1 !== 0) {
dest -= count1;
cursor1 -= count1;
length1 -= count1;
customDest = dest + 1;
customCursor = cursor1 + 1;
for (i = count1 - 1; i >= 0; i--) {
array[customDest + i] = array[customCursor + i];
results[customDest + i] = results[customCursor + i];
}
if (length1 === 0) {
exit = true;
break;
}
}
array[dest] = tmp[cursor2];
results[dest] = tmpIndex[cursor2];
dest--;
cursor2--;
if (--length2 === 1) {
exit = true;
break;
}
count2 = length2 - gallopLeft(
array[cursor1],
tmp,
0,
length2,
length2 - 1,
compare
);
if (count2 !== 0) {
dest -= count2;
cursor2 -= count2;
length2 -= count2;
customDest = dest + 1;
customCursor = cursor2 + 1;
for (i = 0; i < count2; i++) {
array[customDest + i] = tmp[customCursor + i];
results[customDest + i] = tmpIndex[customCursor + i];
}
if (length2 <= 1) {
exit = true;
break;
}
}
array[dest] = array[cursor1];
results[dest] = results[cursor1];
dest--;
cursor1--;
if (--length1 === 0) {
exit = true;
break;
}
minGallop--;
} while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);
if (exit) {
break;
}
if (minGallop < 0) {
minGallop = 0;
}
minGallop += 2;
}
this.minGallop = minGallop;
if (minGallop < 1) {
this.minGallop = 1;
}
if (length2 === 1) {
dest -= length1;
cursor1 -= length1;
customDest = dest + 1;
customCursor = cursor1 + 1;
for (i = length1 - 1; i >= 0; i--) {
array[customDest + i] = array[customCursor + i];
results[customDest + i] = results[customCursor + i];
}
array[dest] = tmp[cursor2];
results[dest] = tmpIndex[cursor2];
} else if (length2 === 0) {
throw new Error("mergeHigh preconditions were not respected");
} else {
customCursor = dest - (length2 - 1);
for (i = 0; i < length2; i++) {
array[customCursor + i] = tmp[i];
results[customCursor + i] = tmpIndex[i];
}
}
}
};
function sort(array, compare, lo, hi) {
if (!Array.isArray(array)) {
throw new TypeError(
`The "array" argument must be an array. Received ${array}`
);
}
results = [];
const { length } = array;
let i = 0;
while (i < length) {
results[i] = i++;
}
if (!compare) {
compare = alphabeticalCompare;
} else if (typeof compare !== "function") {
hi = lo;
lo = compare;
compare = alphabeticalCompare;
}
if (!lo) {
lo = 0;
}
if (!hi) {
hi = length;
}
let remaining = hi - lo;
if (remaining < 2) {
return results;
}
let runLength = 0;
if (remaining < DEFAULT_MIN_MERGE) {
runLength = makeAscendingRun(array, lo, hi, compare);
binaryInsertionSort(array, lo, hi, lo + runLength, compare);
return results;
}
const ts = new TimSort(array, compare);
const minRun = minRunLength(remaining);
do {
runLength = makeAscendingRun(array, lo, hi, compare);
if (runLength < minRun) {
let force = remaining;
if (force > minRun) {
force = minRun;
}
binaryInsertionSort(array, lo, lo + force, lo + runLength, compare);
runLength = force;
}
ts.pushRun(lo, runLength);
ts.mergeRuns();
remaining -= runLength;
lo += runLength;
} while (remaining !== 0);
ts.forceMergeRuns();
return results;
}
module2.exports = {
sort
};
}
});
// ../../node_modules/has-own-prop/index.js
var require_has_own_prop = __commonJS({
"../../node_modules/has-own-prop/index.js"(exports2, module2) {
"use strict";
init_esm_shims();
var hasOwnProp = Object.prototype.hasOwnProperty;
module2.exports = (object, property) => hasOwnProp.call(object, property);
}
});
// ../../node_modules/comment-json/src/common.js
var require_common = __commonJS({
"../../node_modules/comment-json/src/common.js"(exports2, module2) {
"use strict";
init_esm_shims();
var hasOwnProperty = require_has_own_prop();
var {
isObject,
isArray,
isString,
isNumber
} = require_util();
var PREFIX_BEFORE = "before";
var PREFIX_AFTER_PROP = "after-prop";
var PREFIX_AFTER_COLON = "after-colon";
var PREFIX_AFTER_VALUE = "after-value";
var PREFIX_AFTER = "after";
var PREFIX_BEFORE_ALL = "before-all";
var PREFIX_AFTER_ALL = "after-all";
var BRACKET_OPEN = "[";
var BRACKET_CLOSE = "]";
var CURLY_BRACKET_OPEN = "{";
var CURLY_BRACKET_CLOSE = "}";
var COMMA = ",";
var EMPTY = "";
var MINUS = "-";
var SYMBOL_PREFIXES = [
PREFIX_BEFORE,
PREFIX_AFTER_PROP,
PREFIX_AFTER_COLON,
PREFIX_AFTER_VALUE,
PREFIX_AFTER
];
var NON_PROP_SYMBOL_KEYS = [
PREFIX_BEFORE,
PREFIX_BEFORE_ALL,
PREFIX_AFTER_ALL
].map(Symbol.for);
var COLON = ":";
var UNDEFINED = void 0;
var symbol = (prefix, key) => Symbol.for(prefix + COLON + key);
var define2 = (target, key, value) => Object.defineProperty(target, key, {
value,
writable: true,
configurable: true
});
var copy_comments_by_kind = (target, source, target_key, source_key, prefix, remove_source) => {
const source_prop = symbol(prefix, source_key);
if (!hasOwnProperty(source, source_prop)) {
return;
}
const target_prop = target_key === source_key ? source_prop : symbol(prefix, target_key);
define2(target, target_prop, source[source_prop]);
if (remove_source) {
delete source[source_prop];
}
};
var copy_comments = (target, source, target_key, source_key, remove_source) => {
SYMBOL_PREFIXES.forEach((prefix) => {
copy_comments_by_kind(
target,
source,
target_key,
source_key,
prefix,
remove_source
);
});
};
var swap_comments = (array, from, to) => {
if (from === to) {
return;
}
SYMBOL_PREFIXES.forEach((prefix) => {
const target_prop = symbol(prefix, to);
if (!hasOwnProperty(array, target_prop)) {
copy_comments_by_kind(array, array, to, from, prefix, true);
return;
}
const comments = array[target_prop];
delete array[target_prop];
copy_comments_by_kind(array, array, to, from, prefix, true);
define2(array, symbol(prefix, from), comments);
});
};
var assign_non_prop_comments = (target, source) => {
NON_PROP_SYMBOL_KEYS.forEach((key) => {
const comments = source[key];
if (comments) {
define2(target, key, comments);
}
});
};
var assign = (target, source, keys) => {
keys.forEach((key) => {
if (!isString(key) && !isNumber(key)) {
return;
}
if (!hasOwnProperty(source, key)) {
return;
}
target[key] = source[key];
copy_comments(target, source, key, key);
});
return target;
};
module2.exports = {
SYMBOL_PREFIXES,
PREFIX_BEFORE,
PREFIX_AFTER_PROP,
PREFIX_AFTER_COLON,
PREFIX_AFTER_VALUE,
PREFIX_AFTER,
PREFIX_BEFORE_ALL,
PREFIX_AFTER_ALL,
BRACKET_OPEN,
BRACKET_CLOSE,
CURLY_BRACKET_OPEN,
CURLY_BRACKET_CLOSE,
COLON,
COMMA,
MINUS,
EMPTY,
UNDEFINED,
symbol,
define: define2,
copy_comments,
swap_comments,
assign_non_prop_comments,
assign(target, source, keys) {
if (!isObject(target)) {
throw new TypeError("Cannot convert undefined or null to object");
}
if (!isObject(source)) {
return target;
}
if (keys === UNDEFINED) {
keys = Object.keys(source);
assign_non_prop_comments(target, source);
} else if (!isArray(keys)) {
throw new TypeError("keys must be array or undefined");
} else if (keys.length === 0) {
assign_non_prop_comments(target, source);
}
return assign(target, source, keys);
}
};
}
});
// ../../node_modules/comment-json/src/array.js
var require_array = __commonJS({
"../../node_modules/comment-json/src/array.js"(exports2, module2) {
"use strict";
init_esm_shims();
var { isArray } = require_util();
var { sort } = require_src2();
var {
SYMBOL_PREFIXES,
UNDEFINED,
symbol,
copy_comments,
swap_comments
} = require_common();
var reverse_comments = (array) => {
const { length } = array;
let i = 0;
const max = length / 2;
for (; i < max; i++) {
swap_comments(array, i, length - i - 1);
}
};
var move_comment = (target, source, i, offset, remove) => {
copy_comments(target, source, i + offset, i, remove);
};
var move_comments = (target, source, start, count, offset, remove) => {
if (offset > 0) {
let i2 = count;
while (i2-- > 0) {
move_comment(target, source, start + i2, offset, remove);
}
return;
}
let i = 0;
while (i < count) {
const ii = i++;
move_comment(target, source, start + ii, offset, remove);
}
};
var remove_comments = (array, key) => {
SYMBOL_PREFIXES.forEach((prefix) => {
const prop = symbol(prefix, key);
delete array[prop];
});
};
var get_mapped = (map, key) => {
let mapped = key;
while (mapped in map) {
mapped = map[mapped];
}
return mapped;
};
var CommentArray = class _CommentArray extends Array {
// - deleteCount + items.length
// We should avoid `splice(begin, deleteCount, ...items)`,
// because `splice(0, undefined)` is not equivalent to `splice(0)`,
// as well as:
// - slice
splice(...args2) {
const { length } = this;
const ret = super.splice(...args2);
let [begin, deleteCount, ...items] = args2;
if (begin < 0) {
begin += length;
}
if (arguments.length === 1) {
deleteCount = length - begin;
} else {
deleteCount = Math.min(length - begin, deleteCount);
}
const {
length: item_length
} = items;
const offset = item_length - deleteCount;
const start = begin + deleteCount;
const count = length - start;
move_comments(this, this, start, count, offset, true);
return ret;
}
slice(...args2) {
const { length } = this;
const array = super.slice(...args2);
if (!array.length) {
return new _CommentArray();
}
let [begin, before] = args2;
if (before === UNDEFINED) {
before = length;
} else if (before < 0) {
before += length;
}
if (begin < 0) {
begin += length;
} else if (begin === UNDEFINED) {
begin = 0;
}
move_comments(array, this, begin, before - begin, -begin);
return array;
}
unshift(...items) {
const { length } = this;
const ret = super.unshift(...items);
const {
length: items_length
} = items;
if (items_length > 0) {
move_comments(this, this, 0, length, items_length, true);
}
return ret;
}
shift() {
const ret = super.shift();
const { length } = this;
remove_comments(this, 0);
move_comments(this, this, 1, length, -1, true);
return ret;
}
reverse() {
super.reverse();
reverse_comments(this);
return this;
}
pop() {
const ret = super.pop();
remove_comments(this, this.length);
return ret;
}
concat(...items) {
let { length } = this;
const ret = super.concat(...items);
if (!items.length) {
return ret;
}
move_comments(ret, this, 0, this.length, 0);
items.forEach((item) => {
const prev = length;
length += isArray(item) ? item.length : 1;
if (!(item instanceof _CommentArray)) {
return;
}
move_comments(ret, item, 0, item.length, prev);
});
return ret;
}
sort(...args2) {
const result = sort(
this,
...args2.slice(0, 1)
);
const map = /* @__PURE__ */ Object.create(null);
result.forEach((source_index, index) => {
if (source_index === index) {
return;
}
const real_source_index = get_mapped(map, source_index);
if (real_source_index === index) {
return;
}
map[index] = real_source_index;
swap_comments(this, index, real_source_index);
});
return this;
}
};
module2.exports = {
CommentArray
};
}
});
// ../../node_modules/comment-json/src/parse.js
var require_parse = __commonJS({
"../../node_modules/comment-json/src/parse.js"(exports2, module2) {
"use strict";
init_esm_shims();
var esprima = require_esprima();
var {
CommentArray
} = require_array();
var {
PREFIX_BEFORE,
PREFIX_AFTER_PROP,
PREFIX_AFTER_COLON,
PREFIX_AFTER_VALUE,
PREFIX_AFTER,
PREFIX_BEFORE_ALL,
PREFIX_AFTER_ALL,
BRACKET_OPEN,
BRACKET_CLOSE,
CURLY_BRACKET_OPEN,
CURLY_BRACKET_CLOSE,
COLON,
COMMA,
MINUS,
EMPTY,
UNDEFINED,
define: define2,
assign_non_prop_comments
} = require_common();
var tokenize = (code) => esprima.tokenize(code, {
comment: true,
loc: true
});
var previous_hosts = [];
var comments_host = null;
var unassigned_comments = null;
var previous_props = [];
var last_prop;
var remove_comments = false;
var inline = false;
var tokens = null;
var last = null;
var current = null;
var index;
var reviver = null;
var clean = () => {
previous_props.length = previous_hosts.length = 0;
last = null;
last_prop = UNDEFINED;
};
var free = () => {
clean();
tokens.length = 0;
unassigned_comments = comments_host = tokens = last = current = reviver = null;
};
var symbolFor = (prefix) => Symbol.for(
last_prop !== UNDEFINED ? prefix + COLON + last_prop : prefix
);
var transform = (k, v) => reviver ? reviver(k, v) : v;
var unexpected = () => {
const error = new SyntaxError(`Unexpected token ${current.value.slice(0, 1)}`);
Object.assign(error, current.loc.start);
throw error;
};
var unexpected_end = () => {
const error = new SyntaxError("Unexpected end of JSON input");
Object.assign(error, last ? last.loc.end : {
line: 1,
column: 0
});
throw error;
};
var next = () => {
const new_token = tokens[++index];
inline = current && new_token && current.loc.end.line === new_token.loc.start.line || false;
last = current;
current = new_token;
};
var type = () => {
if (!current) {
unexpected_end();
}
return current.type === "Punctuator" ? current.value : current.type;
};
var is = (t) => type() === t;
var expect = (a) => {
if (!is(a)) {
unexpected();
}
};
var set_comments_host = (new_host) => {
previous_hosts.push(comments_host);
comments_host = new_host;
};
var restore_comments_host = () => {
comments_host = previous_hosts.pop();
};
var assign_after_comments = () => {
if (!unassigned_comments) {
return;
}
const after_comments = [];
for (const comment of unassigned_comments) {
if (comment.inline) {
after_comments.push(comment);
} else {
break;
}
}
const { length } = after_comments;
if (!length) {
return;
}
if (length === unassigned_comments.length) {
unassigned_comments = null;
} else {
unassigned_comments.splice(0, length);
}
define2(comments_host, symbolFor(PREFIX_AFTER), after_comments);
};
var assign_comments = (prefix) => {
if (!unassigned_comments) {
return;
}
define2(comments_host, symbolFor(prefix), unassigned_comments);
unassigned_comments = null;
};
var parse_comments = (prefix) => {
const comments = [];
while (current && (is("LineComment") || is("BlockComment"))) {
const comment = {
...current,
inline
};
comments.push(comment);
next();
}
if (remove_comments) {
return;
}
if (!comments.length) {
return;
}
if (prefix) {
define2(comments_host, symbolFor(prefix), comments);
return;
}
unassigned_comments = comments;
};
var set_prop = (prop, push) => {
if (push) {
previous_props.push(last_prop);
}
last_prop = prop;
};
var restore_prop = () => {
last_prop = previous_props.pop();
};
var parse_object = () => {
const obj = {};
set_comments_host(obj);
set_prop(UNDEFINED, true);
let started = false;
let name;
parse_comments();
while (!is(CURLY_BRACKET_CLOSE)) {
if (started) {
assign_comments(PREFIX_AFTER_VALUE);
expect(COMMA);
next();
parse_comments();
assign_after_comments();
if (is(CURLY_BRACKET_CLOSE)) {
break;
}
}
started = true;
expect("String");
name = JSON.parse(current.value);
set_prop(name);
assign_comments(PREFIX_BEFORE);
next();
parse_comments(PREFIX_AFTER_PROP);
expect(COLON);
next();
parse_comments(PREFIX_AFTER_COLON);
obj[name] = transform(name, walk());
parse_comments();
}
if (started) {
assign_comments(PREFIX_AFTER);
}
next();
last_prop = void 0;
if (!started) {
assign_comments(PREFIX_BEFORE);
}
restore_comments_host();
restore_prop();
return obj;
};
var parse_array = () => {
const array = new CommentArray();
set_comments_host(array);
set_prop(UNDEFINED, true);
let started = false;
let i = 0;
parse_comments();
while (!is(BRACKET_CLOSE)) {
if (started) {
assign_comments(PREFIX_AFTER_VALUE);
expect(COMMA);
next();
parse_comments();
assign_after_comments();
if (is(BRACKET_CLOSE)) {
break;
}
}
started = true;
set_prop(i);
assign_comments(PREFIX_BEFORE);
array[i] = transform(i, walk());
i++;
parse_comments();
}
if (started) {
assign_comments(PREFIX_AFTER);
}
next();
last_prop = void 0;
if (!started) {
assign_comments(PREFIX_BEFORE);
}
restore_comments_host();
restore_prop();
return array;
};
function walk() {
let tt = type();
if (tt === CURLY_BRACKET_OPEN) {
next();
return parse_object();
}
if (tt === BRACKET_OPEN) {
next();
return parse_array();
}
let negative = EMPTY;
if (tt === MINUS) {
next();
tt = type();
negative = MINUS;
}
let v;
switch (tt) {
case "String":
case "Boolean":
case "Null":
case "Numeric":
v = current.value;
next();
return JSON.parse(negative + v);
default:
}
}
var isObject = (subject) => Object(subject) === subject;
var parse3 = (code, rev, no_comments) => {
clean();
tokens = tokenize(code);
reviver = rev;
remove_comments = no_comments;
if (!tokens.length) {
unexpected_end();
}
index = -1;
next();
set_comments_host({});
parse_comments(PREFIX_BEFORE_ALL);
let result = walk();
parse_comments(PREFIX_AFTER_ALL);
if (current) {
unexpected();
}
if (!no_comments && result !== null) {
if (!isObject(result)) {
result = new Object(result);
}
assign_non_prop_comments(result, comments_host);
}
restore_comments_host();
result = transform("", result);
free();
return result;
};
module2.exports = {
parse: parse3,
tokenize
};
}
});
// ../../node_modules/repeat-string/index.js
var require_repeat_string = __commonJS({
"../../node_modules/repeat-string/index.js"(exports2, module2) {
"use strict";
init_esm_shims();
var res = "";
var cache;
module2.exports = repeat;
function repeat(str, num) {
if (typeof str !== "string") {
throw new TypeError("expected a string");
}
if (num === 1) return str;
if (num === 2) return str + str;
var max = str.length * num;
if (cache !== str || typeof cache === "undefined") {
cache = str;
res = "";
} else if (res.length >= max) {
return res.substr(0, max);
}
while (max > res.length && num > 1) {
if (num & 1) {
res += str;
}
num >>= 1;
str += str;
}
res += str;
res = res.substr(0, max);
return res;
}
}
});
// ../../node_modules/comment-json/src/stringify.js
var require_stringify = __commonJS({
"../../node_modules/comment-json/src/stringify.js"(exports2, module2) {
"use strict";
init_esm_shims();
var {
isArray,
isObject,
isFunction,
isNumber,
isString
} = require_util();
var repeat = require_repeat_string();
var {
PREFIX_BEFORE_ALL,
PREFIX_BEFORE,
PREFIX_AFTER_PROP,
PREFIX_AFTER_COLON,
PREFIX_AFTER_VALUE,
PREFIX_AFTER,
PREFIX_AFTER_ALL,
BRACKET_OPEN,
BRACKET_CLOSE,
CURLY_BRACKET_OPEN,
CURLY_BRACKET_CLOSE,
COLON,
COMMA,
EMPTY,
UNDEFINED
} = require_common();
var ESCAPABLE = /[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
var SPACE = " ";
var LF = "\n";
var STR_NULL = "null";
var BEFORE = (prop) => `${PREFIX_BEFORE}:${prop}`;
var AFTER_PROP = (prop) => `${PREFIX_AFTER_PROP}:${prop}`;
var AFTER_COLON = (prop) => `${PREFIX_AFTER_COLON}:${prop}`;
var AFTER_VALUE = (prop) => `${PREFIX_AFTER_VALUE}:${prop}`;
var AFTER = (prop) => `${PREFIX_AFTER}:${prop}`;
var meta = {
"\b": "\\b",
" ": "\\t",
"\n": "\\n",
"\f": "\\f",
"\r": "\\r",
'"': '\\"',
"\\": "\\\\"
};
var escape = (string) => {
ESCAPABLE.lastIndex = 0;
if (!ESCAPABLE.test(string)) {
return string;
}
return string.replace(ESCAPABLE, (a) => {
const c = meta[a];
return typeof c === "string" ? c : a;
});
};
var quote = (string) => `"${escape(string)}"`;
var comment_stringify = (value, line) => line ? `//${value}` : `/*${value}*/`;
var process_comments = (host, symbol_tag, deeper_gap, display_block) => {
const comments = host[Symbol.for(symbol_tag)];
if (!comments || !comments.length) {
return EMPTY;
}
let is_line_comment = false;
const str = comments.reduce((prev, {
inline,
type,
value
}) => {
const delimiter = inline ? SPACE : LF + deeper_gap;
is_line_comment = type === "LineComment";
return prev + delimiter + comment_stringify(value, is_line_comment);
}, EMPTY);
return display_block || is_line_comment ? str + LF + deeper_gap : str;
};
var replacer = null;
var indent = EMPTY;
var clean = () => {
replacer = null;
indent = EMPTY;
};
var join8 = (one, two, gap) => one ? two ? one + two.trim() + LF + gap : one.trimRight() + LF + gap : two ? two.trimRight() + LF + gap : EMPTY;
var join_content = (inside, value, gap) => {
const comment = process_comments(value, PREFIX_BEFORE, gap + indent, true);
return join8(comment, inside, gap);
};
var array_stringify = (value, gap) => {
const deeper_gap = gap + indent;
const { length } = value;
let inside = EMPTY;
let after_comma = EMPTY;
for (let i = 0; i < length; i++) {
if (i !== 0) {
inside += COMMA;
}
const before = join8(
after_comma,
process_comments(value, BEFORE(i), deeper_gap),
deeper_gap
);
inside += before || LF + deeper_gap;
inside += stringify3(i, value, deeper_gap) || STR_NULL;
inside += process_comments(value, AFTER_VALUE(i), deeper_gap);
after_comma = process_comments(value, AFTER(i), deeper_gap);
}
inside += join8(
after_comma,
process_comments(value, PREFIX_AFTER, deeper_gap),
deeper_gap
);
return BRACKET_OPEN + join_content(inside, value, gap) + BRACKET_CLOSE;
};
var object_stringify = (value, gap) => {
if (!value) {
return "null";
}
const deeper_gap = gap + indent;
let inside = EMPTY;
let after_comma = EMPTY;
let first = true;
const keys = isArray(replacer) ? replacer : Object.keys(value);
const iteratee = (key) => {
const sv = stringify3(key, value, deeper_gap);
if (sv === UNDEFINED) {
return;
}
if (!first) {
inside += COMMA;
}
first = false;
const before = join8(
after_comma,
process_comments(value, BEFORE(key), deeper_gap),
deeper_gap
);
inside += before || LF + deeper_gap;
inside += quote(key) + process_comments(value, AFTER_PROP(key), deeper_gap) + COLON + process_comments(value, AFTER_COLON(key), deeper_gap) + SPACE + sv + process_comments(value, AFTER_VALUE(key), deeper_gap);
after_comma = process_comments(value, AFTER(key), deeper_gap);
};
keys.forEach(iteratee);
inside += join8(
after_comma,
process_comments(value, PREFIX_AFTER, deeper_gap),
deeper_gap
);
return CURLY_BRACKET_OPEN + join_content(inside, value, gap) + CURLY_BRACKET_CLOSE;
};
function stringify3(key, holder, gap) {
let value = holder[key];
if (isObject(value) && isFunction(value.toJSON)) {
value = value.toJSON(key);
}
if (isFunction(replacer)) {
value = replacer.call(holder, key, value);
}
switch (typeof value) {
case "string":
return quote(value);
case "number":
return Number.isFinite(value) ? String(value) : STR_NULL;
case "boolean":
case "null":
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case "object":
return isArray(value) ? array_stringify(value, gap) : object_stringify(value, gap);
// undefined
default:
}
}
var get_indent = (space) => isString(space) ? space : isNumber(space) ? repeat(SPACE, space) : EMPTY;
var { toString } = Object.prototype;
var PRIMITIVE_OBJECT_TYPES = [
"[object Number]",
"[object String]",
"[object Boolean]"
];
var is_primitive_object = (subject) => {
if (typeof subject !== "object") {
return false;
}
const str = toString.call(subject);
return PRIMITIVE_OBJECT_TYPES.includes(str);
};