cmux/node_modules/@vercel/next/dist/adapter/index.js
2026-01-29 17:36:26 -08:00

11228 lines
395 KiB
JavaScript

"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// ../../node_modules/.pnpm/async-sema@3.1.1/node_modules/async-sema/lib/index.js
var require_lib = __commonJS({
"../../node_modules/.pnpm/async-sema@3.1.1/node_modules/async-sema/lib/index.js"(exports2) {
"use strict";
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.RateLimit = exports2.Sema = void 0;
var events_1 = __importDefault(require("events"));
function arrayMove(src, srcIndex, dst, dstIndex, len) {
for (let j = 0; j < len; ++j) {
dst[j + dstIndex] = src[j + srcIndex];
src[j + srcIndex] = void 0;
}
}
function pow2AtLeast(n) {
n = n >>> 0;
n = n - 1;
n = n | n >> 1;
n = n | n >> 2;
n = n | n >> 4;
n = n | n >> 8;
n = n | n >> 16;
return n + 1;
}
function getCapacity(capacity) {
return pow2AtLeast(Math.min(Math.max(16, capacity), 1073741824));
}
var Deque = class {
constructor(capacity) {
this._capacity = getCapacity(capacity);
this._length = 0;
this._front = 0;
this.arr = [];
}
push(item) {
const length = this._length;
this.checkCapacity(length + 1);
const i = this._front + length & this._capacity - 1;
this.arr[i] = item;
this._length = length + 1;
return length + 1;
}
pop() {
const length = this._length;
if (length === 0) {
return void 0;
}
const i = this._front + length - 1 & this._capacity - 1;
const ret = this.arr[i];
this.arr[i] = void 0;
this._length = length - 1;
return ret;
}
shift() {
const length = this._length;
if (length === 0) {
return void 0;
}
const front = this._front;
const ret = this.arr[front];
this.arr[front] = void 0;
this._front = front + 1 & this._capacity - 1;
this._length = length - 1;
return ret;
}
get length() {
return this._length;
}
checkCapacity(size) {
if (this._capacity < size) {
this.resizeTo(getCapacity(this._capacity * 1.5 + 16));
}
}
resizeTo(capacity) {
const oldCapacity = this._capacity;
this._capacity = capacity;
const front = this._front;
const length = this._length;
if (front + length > oldCapacity) {
const moveItemsCount = front + length & oldCapacity - 1;
arrayMove(this.arr, 0, this.arr, oldCapacity, moveItemsCount);
}
}
};
var ReleaseEmitter = class extends events_1.default {
};
function isFn(x) {
return typeof x === "function";
}
function defaultInit() {
return "1";
}
var Sema2 = class {
constructor(nr, { initFn = defaultInit, pauseFn, resumeFn, capacity = 10 } = {}) {
if (isFn(pauseFn) !== isFn(resumeFn)) {
throw new Error("pauseFn and resumeFn must be both set for pausing");
}
this.nrTokens = nr;
this.free = new Deque(nr);
this.waiting = new Deque(capacity);
this.releaseEmitter = new ReleaseEmitter();
this.noTokens = initFn === defaultInit;
this.pauseFn = pauseFn;
this.resumeFn = resumeFn;
this.paused = false;
this.releaseEmitter.on("release", (token) => {
const p = this.waiting.shift();
if (p) {
p.resolve(token);
} else {
if (this.resumeFn && this.paused) {
this.paused = false;
this.resumeFn();
}
this.free.push(token);
}
});
for (let i = 0; i < nr; i++) {
this.free.push(initFn());
}
}
tryAcquire() {
return this.free.pop();
}
async acquire() {
let token = this.tryAcquire();
if (token !== void 0) {
return token;
}
return new Promise((resolve, reject) => {
if (this.pauseFn && !this.paused) {
this.paused = true;
this.pauseFn();
}
this.waiting.push({ resolve, reject });
});
}
release(token) {
this.releaseEmitter.emit("release", this.noTokens ? "1" : token);
}
drain() {
const a = new Array(this.nrTokens);
for (let i = 0; i < this.nrTokens; i++) {
a[i] = this.acquire();
}
return Promise.all(a);
}
nrWaiting() {
return this.waiting.length;
}
};
exports2.Sema = Sema2;
function RateLimit(rps, { timeUnit = 1e3, uniformDistribution = false } = {}) {
const sema = new Sema2(uniformDistribution ? 1 : rps);
const delay = uniformDistribution ? timeUnit / rps : timeUnit;
return async function rl() {
await sema.acquire();
setTimeout(() => sema.release(), delay);
};
}
exports2.RateLimit = RateLimit;
}
});
// ../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
var require_universalify = __commonJS({
"../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js"(exports2) {
"use strict";
exports2.fromCallback = function(fn) {
return Object.defineProperty(function(...args) {
if (typeof args[args.length - 1] === "function") fn.apply(this, args);
else {
return new Promise((resolve, reject) => {
args.push((err, res) => err != null ? reject(err) : resolve(res));
fn.apply(this, args);
});
}
}, "name", { value: fn.name });
};
exports2.fromPromise = function(fn) {
return Object.defineProperty(function(...args) {
const cb = args[args.length - 1];
if (typeof cb !== "function") return fn.apply(this, args);
else {
args.pop();
fn.apply(this, args).then((r) => cb(null, r), cb);
}
}, "name", { value: fn.name });
};
}
});
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
var require_polyfills = __commonJS({
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
var constants = require("constants");
var origCwd = process.cwd;
var cwd = null;
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
process.cwd = function() {
if (!cwd)
cwd = origCwd.call(process);
return cwd;
};
try {
process.cwd();
} catch (er) {
}
if (typeof process.chdir === "function") {
chdir = process.chdir;
process.chdir = function(d) {
cwd = null;
chdir.call(process, d);
};
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
}
var chdir;
module2.exports = patch;
function patch(fs4) {
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
patchLchmod(fs4);
}
if (!fs4.lutimes) {
patchLutimes(fs4);
}
fs4.chown = chownFix(fs4.chown);
fs4.fchown = chownFix(fs4.fchown);
fs4.lchown = chownFix(fs4.lchown);
fs4.chmod = chmodFix(fs4.chmod);
fs4.fchmod = chmodFix(fs4.fchmod);
fs4.lchmod = chmodFix(fs4.lchmod);
fs4.chownSync = chownFixSync(fs4.chownSync);
fs4.fchownSync = chownFixSync(fs4.fchownSync);
fs4.lchownSync = chownFixSync(fs4.lchownSync);
fs4.chmodSync = chmodFixSync(fs4.chmodSync);
fs4.fchmodSync = chmodFixSync(fs4.fchmodSync);
fs4.lchmodSync = chmodFixSync(fs4.lchmodSync);
fs4.stat = statFix(fs4.stat);
fs4.fstat = statFix(fs4.fstat);
fs4.lstat = statFix(fs4.lstat);
fs4.statSync = statFixSync(fs4.statSync);
fs4.fstatSync = statFixSync(fs4.fstatSync);
fs4.lstatSync = statFixSync(fs4.lstatSync);
if (fs4.chmod && !fs4.lchmod) {
fs4.lchmod = function(path3, mode, cb) {
if (cb) process.nextTick(cb);
};
fs4.lchmodSync = function() {
};
}
if (fs4.chown && !fs4.lchown) {
fs4.lchown = function(path3, uid, gid, cb) {
if (cb) process.nextTick(cb);
};
fs4.lchownSync = function() {
};
}
if (platform === "win32") {
fs4.rename = typeof fs4.rename !== "function" ? fs4.rename : (function(fs$rename) {
function rename(from, to, cb) {
var start = Date.now();
var backoff = 0;
fs$rename(from, to, function CB(er) {
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
setTimeout(function() {
fs4.stat(to, function(stater, st) {
if (stater && stater.code === "ENOENT")
fs$rename(from, to, CB);
else
cb(er);
});
}, backoff);
if (backoff < 100)
backoff += 10;
return;
}
if (cb) cb(er);
});
}
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
return rename;
})(fs4.rename);
}
fs4.read = typeof fs4.read !== "function" ? fs4.read : (function(fs$read) {
function read(fd, buffer, offset, length, position, callback_) {
var callback;
if (callback_ && typeof callback_ === "function") {
var eagCounter = 0;
callback = function(er, _, __) {
if (er && er.code === "EAGAIN" && eagCounter < 10) {
eagCounter++;
return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
}
callback_.apply(this, arguments);
};
}
return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
}
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
return read;
})(fs4.read);
fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : /* @__PURE__ */ (function(fs$readSync) {
return function(fd, buffer, offset, length, position) {
var eagCounter = 0;
while (true) {
try {
return fs$readSync.call(fs4, fd, buffer, offset, length, position);
} catch (er) {
if (er.code === "EAGAIN" && eagCounter < 10) {
eagCounter++;
continue;
}
throw er;
}
}
};
})(fs4.readSync);
function patchLchmod(fs5) {
fs5.lchmod = function(path3, mode, callback) {
fs5.open(
path3,
constants.O_WRONLY | constants.O_SYMLINK,
mode,
function(err, fd) {
if (err) {
if (callback) callback(err);
return;
}
fs5.fchmod(fd, mode, function(err2) {
fs5.close(fd, function(err22) {
if (callback) callback(err2 || err22);
});
});
}
);
};
fs5.lchmodSync = function(path3, mode) {
var fd = fs5.openSync(path3, constants.O_WRONLY | constants.O_SYMLINK, mode);
var threw = true;
var ret;
try {
ret = fs5.fchmodSync(fd, mode);
threw = false;
} finally {
if (threw) {
try {
fs5.closeSync(fd);
} catch (er) {
}
} else {
fs5.closeSync(fd);
}
}
return ret;
};
}
function patchLutimes(fs5) {
if (constants.hasOwnProperty("O_SYMLINK") && fs5.futimes) {
fs5.lutimes = function(path3, at, mt, cb) {
fs5.open(path3, constants.O_SYMLINK, function(er, fd) {
if (er) {
if (cb) cb(er);
return;
}
fs5.futimes(fd, at, mt, function(er2) {
fs5.close(fd, function(er22) {
if (cb) cb(er2 || er22);
});
});
});
};
fs5.lutimesSync = function(path3, at, mt) {
var fd = fs5.openSync(path3, constants.O_SYMLINK);
var ret;
var threw = true;
try {
ret = fs5.futimesSync(fd, at, mt);
threw = false;
} finally {
if (threw) {
try {
fs5.closeSync(fd);
} catch (er) {
}
} else {
fs5.closeSync(fd);
}
}
return ret;
};
} else if (fs5.futimes) {
fs5.lutimes = function(_a, _b, _c, cb) {
if (cb) process.nextTick(cb);
};
fs5.lutimesSync = function() {
};
}
}
function chmodFix(orig) {
if (!orig) return orig;
return function(target, mode, cb) {
return orig.call(fs4, target, mode, function(er) {
if (chownErOk(er)) er = null;
if (cb) cb.apply(this, arguments);
});
};
}
function chmodFixSync(orig) {
if (!orig) return orig;
return function(target, mode) {
try {
return orig.call(fs4, target, mode);
} catch (er) {
if (!chownErOk(er)) throw er;
}
};
}
function chownFix(orig) {
if (!orig) return orig;
return function(target, uid, gid, cb) {
return orig.call(fs4, target, uid, gid, function(er) {
if (chownErOk(er)) er = null;
if (cb) cb.apply(this, arguments);
});
};
}
function chownFixSync(orig) {
if (!orig) return orig;
return function(target, uid, gid) {
try {
return orig.call(fs4, target, uid, gid);
} catch (er) {
if (!chownErOk(er)) throw er;
}
};
}
function statFix(orig) {
if (!orig) return orig;
return function(target, options, cb) {
if (typeof options === "function") {
cb = options;
options = null;
}
function callback(er, stats) {
if (stats) {
if (stats.uid < 0) stats.uid += 4294967296;
if (stats.gid < 0) stats.gid += 4294967296;
}
if (cb) cb.apply(this, arguments);
}
return options ? orig.call(fs4, target, options, callback) : orig.call(fs4, target, callback);
};
}
function statFixSync(orig) {
if (!orig) return orig;
return function(target, options) {
var stats = options ? orig.call(fs4, target, options) : orig.call(fs4, target);
if (stats) {
if (stats.uid < 0) stats.uid += 4294967296;
if (stats.gid < 0) stats.gid += 4294967296;
}
return stats;
};
}
function chownErOk(er) {
if (!er)
return true;
if (er.code === "ENOSYS")
return true;
var nonroot = !process.getuid || process.getuid() !== 0;
if (nonroot) {
if (er.code === "EINVAL" || er.code === "EPERM")
return true;
}
return false;
}
}
}
});
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
var require_legacy_streams = __commonJS({
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
var Stream = require("stream").Stream;
module2.exports = legacy;
function legacy(fs4) {
return {
ReadStream,
WriteStream
};
function ReadStream(path3, options) {
if (!(this instanceof ReadStream)) return new ReadStream(path3, options);
Stream.call(this);
var self = this;
this.path = path3;
this.fd = null;
this.readable = true;
this.paused = false;
this.flags = "r";
this.mode = 438;
this.bufferSize = 64 * 1024;
options = options || {};
var keys = Object.keys(options);
for (var index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.encoding) this.setEncoding(this.encoding);
if (this.start !== void 0) {
if ("number" !== typeof this.start) {
throw TypeError("start must be a Number");
}
if (this.end === void 0) {
this.end = Infinity;
} else if ("number" !== typeof this.end) {
throw TypeError("end must be a Number");
}
if (this.start > this.end) {
throw new Error("start must be <= end");
}
this.pos = this.start;
}
if (this.fd !== null) {
process.nextTick(function() {
self._read();
});
return;
}
fs4.open(this.path, this.flags, this.mode, function(err, fd) {
if (err) {
self.emit("error", err);
self.readable = false;
return;
}
self.fd = fd;
self.emit("open", fd);
self._read();
});
}
function WriteStream(path3, options) {
if (!(this instanceof WriteStream)) return new WriteStream(path3, options);
Stream.call(this);
this.path = path3;
this.fd = null;
this.writable = true;
this.flags = "w";
this.encoding = "binary";
this.mode = 438;
this.bytesWritten = 0;
options = options || {};
var keys = Object.keys(options);
for (var index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.start !== void 0) {
if ("number" !== typeof this.start) {
throw TypeError("start must be a Number");
}
if (this.start < 0) {
throw new Error("start must be >= zero");
}
this.pos = this.start;
}
this.busy = false;
this._queue = [];
if (this.fd === null) {
this._open = fs4.open;
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
this.flush();
}
}
}
}
});
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
var require_clone = __commonJS({
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports2, module2) {
"use strict";
module2.exports = clone;
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
return obj.__proto__;
};
function clone(obj) {
if (obj === null || typeof obj !== "object")
return obj;
if (obj instanceof Object)
var copy2 = { __proto__: getPrototypeOf(obj) };
else
var copy2 = /* @__PURE__ */ Object.create(null);
Object.getOwnPropertyNames(obj).forEach(function(key) {
Object.defineProperty(copy2, key, Object.getOwnPropertyDescriptor(obj, key));
});
return copy2;
}
}
});
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
var require_graceful_fs = __commonJS({
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
var fs4 = require("fs");
var polyfills = require_polyfills();
var legacy = require_legacy_streams();
var clone = require_clone();
var util = require("util");
var gracefulQueue;
var previousSymbol;
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
gracefulQueue = Symbol.for("graceful-fs.queue");
previousSymbol = Symbol.for("graceful-fs.previous");
} else {
gracefulQueue = "___graceful-fs.queue";
previousSymbol = "___graceful-fs.previous";
}
function noop() {
}
function publishQueue(context, queue2) {
Object.defineProperty(context, gracefulQueue, {
get: function() {
return queue2;
}
});
}
var debug = noop;
if (util.debuglog)
debug = util.debuglog("gfs4");
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
debug = function() {
var m = util.format.apply(util, arguments);
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
console.error(m);
};
if (!fs4[gracefulQueue]) {
queue = global[gracefulQueue] || [];
publishQueue(fs4, queue);
fs4.close = (function(fs$close) {
function close(fd, cb) {
return fs$close.call(fs4, fd, function(err) {
if (!err) {
resetQueue();
}
if (typeof cb === "function")
cb.apply(this, arguments);
});
}
Object.defineProperty(close, previousSymbol, {
value: fs$close
});
return close;
})(fs4.close);
fs4.closeSync = (function(fs$closeSync) {
function closeSync(fd) {
fs$closeSync.apply(fs4, arguments);
resetQueue();
}
Object.defineProperty(closeSync, previousSymbol, {
value: fs$closeSync
});
return closeSync;
})(fs4.closeSync);
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
process.on("exit", function() {
debug(fs4[gracefulQueue]);
require("assert").equal(fs4[gracefulQueue].length, 0);
});
}
}
var queue;
if (!global[gracefulQueue]) {
publishQueue(global, fs4[gracefulQueue]);
}
module2.exports = patch(clone(fs4));
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs4.__patched) {
module2.exports = patch(fs4);
fs4.__patched = true;
}
function patch(fs5) {
polyfills(fs5);
fs5.gracefulify = patch;
fs5.createReadStream = createReadStream;
fs5.createWriteStream = createWriteStream;
var fs$readFile = fs5.readFile;
fs5.readFile = readFile2;
function readFile2(path3, options, cb) {
if (typeof options === "function")
cb = options, options = null;
return go$readFile(path3, options, cb);
function go$readFile(path4, options2, cb2, startTime) {
return fs$readFile(path4, options2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$readFile, [path4, options2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$writeFile = fs5.writeFile;
fs5.writeFile = writeFile;
function writeFile(path3, data, options, cb) {
if (typeof options === "function")
cb = options, options = null;
return go$writeFile(path3, data, options, cb);
function go$writeFile(path4, data2, options2, cb2, startTime) {
return fs$writeFile(path4, data2, options2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$writeFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$appendFile = fs5.appendFile;
if (fs$appendFile)
fs5.appendFile = appendFile;
function appendFile(path3, data, options, cb) {
if (typeof options === "function")
cb = options, options = null;
return go$appendFile(path3, data, options, cb);
function go$appendFile(path4, data2, options2, cb2, startTime) {
return fs$appendFile(path4, data2, options2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$appendFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$copyFile = fs5.copyFile;
if (fs$copyFile)
fs5.copyFile = copyFile;
function copyFile(src, dest, flags, cb) {
if (typeof flags === "function") {
cb = flags;
flags = 0;
}
return go$copyFile(src, dest, flags, cb);
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
return fs$copyFile(src2, dest2, flags2, function(err) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
var fs$readdir = fs5.readdir;
fs5.readdir = readdir;
var noReaddirOptionVersions = /^v[0-5]\./;
function readdir(path3, options, cb) {
if (typeof options === "function")
cb = options, options = null;
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path4, options2, cb2, startTime) {
return fs$readdir(path4, fs$readdirCallback(
path4,
options2,
cb2,
startTime
));
} : function go$readdir2(path4, options2, cb2, startTime) {
return fs$readdir(path4, options2, fs$readdirCallback(
path4,
options2,
cb2,
startTime
));
};
return go$readdir(path3, options, cb);
function fs$readdirCallback(path4, options2, cb2, startTime) {
return function(err, files) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([
go$readdir,
[path4, options2, cb2],
err,
startTime || Date.now(),
Date.now()
]);
else {
if (files && files.sort)
files.sort();
if (typeof cb2 === "function")
cb2.call(this, err, files);
}
};
}
}
if (process.version.substr(0, 4) === "v0.8") {
var legStreams = legacy(fs5);
ReadStream = legStreams.ReadStream;
WriteStream = legStreams.WriteStream;
}
var fs$ReadStream = fs5.ReadStream;
if (fs$ReadStream) {
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
ReadStream.prototype.open = ReadStream$open;
}
var fs$WriteStream = fs5.WriteStream;
if (fs$WriteStream) {
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
WriteStream.prototype.open = WriteStream$open;
}
Object.defineProperty(fs5, "ReadStream", {
get: function() {
return ReadStream;
},
set: function(val) {
ReadStream = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(fs5, "WriteStream", {
get: function() {
return WriteStream;
},
set: function(val) {
WriteStream = val;
},
enumerable: true,
configurable: true
});
var FileReadStream = ReadStream;
Object.defineProperty(fs5, "FileReadStream", {
get: function() {
return FileReadStream;
},
set: function(val) {
FileReadStream = val;
},
enumerable: true,
configurable: true
});
var FileWriteStream = WriteStream;
Object.defineProperty(fs5, "FileWriteStream", {
get: function() {
return FileWriteStream;
},
set: function(val) {
FileWriteStream = val;
},
enumerable: true,
configurable: true
});
function ReadStream(path3, options) {
if (this instanceof ReadStream)
return fs$ReadStream.apply(this, arguments), this;
else
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
}
function ReadStream$open() {
var that = this;
open(that.path, that.flags, that.mode, function(err, fd) {
if (err) {
if (that.autoClose)
that.destroy();
that.emit("error", err);
} else {
that.fd = fd;
that.emit("open", fd);
that.read();
}
});
}
function WriteStream(path3, options) {
if (this instanceof WriteStream)
return fs$WriteStream.apply(this, arguments), this;
else
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
}
function WriteStream$open() {
var that = this;
open(that.path, that.flags, that.mode, function(err, fd) {
if (err) {
that.destroy();
that.emit("error", err);
} else {
that.fd = fd;
that.emit("open", fd);
}
});
}
function createReadStream(path3, options) {
return new fs5.ReadStream(path3, options);
}
function createWriteStream(path3, options) {
return new fs5.WriteStream(path3, options);
}
var fs$open = fs5.open;
fs5.open = open;
function open(path3, flags, mode, cb) {
if (typeof mode === "function")
cb = mode, mode = null;
return go$open(path3, flags, mode, cb);
function go$open(path4, flags2, mode2, cb2, startTime) {
return fs$open(path4, flags2, mode2, function(err, fd) {
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
enqueue([go$open, [path4, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
else {
if (typeof cb2 === "function")
cb2.apply(this, arguments);
}
});
}
}
return fs5;
}
function enqueue(elem) {
debug("ENQUEUE", elem[0].name, elem[1]);
fs4[gracefulQueue].push(elem);
retry();
}
var retryTimer;
function resetQueue() {
var now = Date.now();
for (var i = 0; i < fs4[gracefulQueue].length; ++i) {
if (fs4[gracefulQueue][i].length > 2) {
fs4[gracefulQueue][i][3] = now;
fs4[gracefulQueue][i][4] = now;
}
}
retry();
}
function retry() {
clearTimeout(retryTimer);
retryTimer = void 0;
if (fs4[gracefulQueue].length === 0)
return;
var elem = fs4[gracefulQueue].shift();
var fn = elem[0];
var args = elem[1];
var err = elem[2];
var startTime = elem[3];
var lastTime = elem[4];
if (startTime === void 0) {
debug("RETRY", fn.name, args);
fn.apply(null, args);
} else if (Date.now() - startTime >= 6e4) {
debug("TIMEOUT", fn.name, args);
var cb = args.pop();
if (typeof cb === "function")
cb.call(null, err);
} else {
var sinceAttempt = Date.now() - lastTime;
var sinceStart = Math.max(lastTime - startTime, 1);
var desiredDelay = Math.min(sinceStart * 1.2, 100);
if (sinceAttempt >= desiredDelay) {
debug("RETRY", fn.name, args);
fn.apply(null, args.concat([startTime]));
} else {
fs4[gracefulQueue].push(elem);
}
}
if (retryTimer === void 0) {
retryTimer = setTimeout(retry, 0);
}
}
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js
var require_fs = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js"(exports2) {
"use strict";
var u = require_universalify().fromCallback;
var fs4 = require_graceful_fs();
var api = [
"access",
"appendFile",
"chmod",
"chown",
"close",
"copyFile",
"fchmod",
"fchown",
"fdatasync",
"fstat",
"fsync",
"ftruncate",
"futimes",
"lchmod",
"lchown",
"link",
"lstat",
"mkdir",
"mkdtemp",
"open",
"opendir",
"readdir",
"readFile",
"readlink",
"realpath",
"rename",
"rm",
"rmdir",
"stat",
"symlink",
"truncate",
"unlink",
"utimes",
"writeFile"
].filter((key) => {
return typeof fs4[key] === "function";
});
Object.assign(exports2, fs4);
api.forEach((method) => {
exports2[method] = u(fs4[method]);
});
exports2.exists = function(filename, callback) {
if (typeof callback === "function") {
return fs4.exists(filename, callback);
}
return new Promise((resolve) => {
return fs4.exists(filename, resolve);
});
};
exports2.read = function(fd, buffer, offset, length, position, callback) {
if (typeof callback === "function") {
return fs4.read(fd, buffer, offset, length, position, callback);
}
return new Promise((resolve, reject) => {
fs4.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
if (err) return reject(err);
resolve({ bytesRead, buffer: buffer2 });
});
});
};
exports2.write = function(fd, buffer, ...args) {
if (typeof args[args.length - 1] === "function") {
return fs4.write(fd, buffer, ...args);
}
return new Promise((resolve, reject) => {
fs4.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
if (err) return reject(err);
resolve({ bytesWritten, buffer: buffer2 });
});
});
};
exports2.readv = function(fd, buffers, ...args) {
if (typeof args[args.length - 1] === "function") {
return fs4.readv(fd, buffers, ...args);
}
return new Promise((resolve, reject) => {
fs4.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
if (err) return reject(err);
resolve({ bytesRead, buffers: buffers2 });
});
});
};
exports2.writev = function(fd, buffers, ...args) {
if (typeof args[args.length - 1] === "function") {
return fs4.writev(fd, buffers, ...args);
}
return new Promise((resolve, reject) => {
fs4.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
if (err) return reject(err);
resolve({ bytesWritten, buffers: buffers2 });
});
});
};
if (typeof fs4.realpath.native === "function") {
exports2.realpath.native = u(fs4.realpath.native);
} else {
process.emitWarning(
"fs.realpath.native is not a function. Is fs being monkey-patched?",
"Warning",
"fs-extra-WARN0003"
);
}
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js
var require_utils = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports2, module2) {
"use strict";
var path3 = require("path");
module2.exports.checkPath = function checkPath(pth) {
if (process.platform === "win32") {
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path3.parse(pth).root, ""));
if (pathHasInvalidWinCharacters) {
const error = new Error(`Path contains invalid characters: ${pth}`);
error.code = "EINVAL";
throw error;
}
}
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js
var require_make_dir = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports2, module2) {
"use strict";
var fs4 = require_fs();
var { checkPath } = require_utils();
var getMode = (options) => {
const defaults = { mode: 511 };
if (typeof options === "number") return options;
return { ...defaults, ...options }.mode;
};
module2.exports.makeDir = async (dir, options) => {
checkPath(dir);
return fs4.mkdir(dir, {
mode: getMode(options),
recursive: true
});
};
module2.exports.makeDirSync = (dir, options) => {
checkPath(dir);
return fs4.mkdirSync(dir, {
mode: getMode(options),
recursive: true
});
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js
var require_mkdirs = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports2, module2) {
"use strict";
var u = require_universalify().fromPromise;
var { makeDir: _makeDir, makeDirSync } = require_make_dir();
var makeDir = u(_makeDir);
module2.exports = {
mkdirs: makeDir,
mkdirsSync: makeDirSync,
// alias
mkdirp: makeDir,
mkdirpSync: makeDirSync,
ensureDir: makeDir,
ensureDirSync: makeDirSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js
var require_path_exists = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js"(exports2, module2) {
"use strict";
var u = require_universalify().fromPromise;
var fs4 = require_fs();
function pathExists(path3) {
return fs4.access(path3).then(() => true).catch(() => false);
}
module2.exports = {
pathExists: u(pathExists),
pathExistsSync: fs4.existsSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js
var require_utimes = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) {
"use strict";
var fs4 = require_fs();
var u = require_universalify().fromPromise;
async function utimesMillis(path3, atime, mtime) {
const fd = await fs4.open(path3, "r+");
let closeErr = null;
try {
await fs4.futimes(fd, atime, mtime);
} finally {
try {
await fs4.close(fd);
} catch (e) {
closeErr = e;
}
}
if (closeErr) {
throw closeErr;
}
}
function utimesMillisSync(path3, atime, mtime) {
const fd = fs4.openSync(path3, "r+");
fs4.futimesSync(fd, atime, mtime);
return fs4.closeSync(fd);
}
module2.exports = {
utimesMillis: u(utimesMillis),
utimesMillisSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js
var require_stat = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js"(exports2, module2) {
"use strict";
var fs4 = require_fs();
var path3 = require("path");
var u = require_universalify().fromPromise;
function getStats(src, dest, opts) {
const statFunc = opts.dereference ? (file) => fs4.stat(file, { bigint: true }) : (file) => fs4.lstat(file, { bigint: true });
return Promise.all([
statFunc(src),
statFunc(dest).catch((err) => {
if (err.code === "ENOENT") return null;
throw err;
})
]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
}
function getStatsSync(src, dest, opts) {
let destStat;
const statFunc = opts.dereference ? (file) => fs4.statSync(file, { bigint: true }) : (file) => fs4.lstatSync(file, { bigint: true });
const srcStat = statFunc(src);
try {
destStat = statFunc(dest);
} catch (err) {
if (err.code === "ENOENT") return { srcStat, destStat: null };
throw err;
}
return { srcStat, destStat };
}
async function checkPaths(src, dest, funcName, opts) {
const { srcStat, destStat } = await getStats(src, dest, opts);
if (destStat) {
if (areIdentical(srcStat, destStat)) {
const srcBaseName = path3.basename(src);
const destBaseName = path3.basename(dest);
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
return { srcStat, destStat, isChangingCase: true };
}
throw new Error("Source and destination must not be the same.");
}
if (srcStat.isDirectory() && !destStat.isDirectory()) {
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
}
if (!srcStat.isDirectory() && destStat.isDirectory()) {
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
}
}
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
throw new Error(errMsg(src, dest, funcName));
}
return { srcStat, destStat };
}
function checkPathsSync(src, dest, funcName, opts) {
const { srcStat, destStat } = getStatsSync(src, dest, opts);
if (destStat) {
if (areIdentical(srcStat, destStat)) {
const srcBaseName = path3.basename(src);
const destBaseName = path3.basename(dest);
if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
return { srcStat, destStat, isChangingCase: true };
}
throw new Error("Source and destination must not be the same.");
}
if (srcStat.isDirectory() && !destStat.isDirectory()) {
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
}
if (!srcStat.isDirectory() && destStat.isDirectory()) {
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
}
}
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
throw new Error(errMsg(src, dest, funcName));
}
return { srcStat, destStat };
}
async function checkParentPaths(src, srcStat, dest, funcName) {
const srcParent = path3.resolve(path3.dirname(src));
const destParent = path3.resolve(path3.dirname(dest));
if (destParent === srcParent || destParent === path3.parse(destParent).root) return;
let destStat;
try {
destStat = await fs4.stat(destParent, { bigint: true });
} catch (err) {
if (err.code === "ENOENT") return;
throw err;
}
if (areIdentical(srcStat, destStat)) {
throw new Error(errMsg(src, dest, funcName));
}
return checkParentPaths(src, srcStat, destParent, funcName);
}
function checkParentPathsSync(src, srcStat, dest, funcName) {
const srcParent = path3.resolve(path3.dirname(src));
const destParent = path3.resolve(path3.dirname(dest));
if (destParent === srcParent || destParent === path3.parse(destParent).root) return;
let destStat;
try {
destStat = fs4.statSync(destParent, { bigint: true });
} catch (err) {
if (err.code === "ENOENT") return;
throw err;
}
if (areIdentical(srcStat, destStat)) {
throw new Error(errMsg(src, dest, funcName));
}
return checkParentPathsSync(src, srcStat, destParent, funcName);
}
function areIdentical(srcStat, destStat) {
return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
}
function isSrcSubdir(src, dest) {
const srcArr = path3.resolve(src).split(path3.sep).filter((i) => i);
const destArr = path3.resolve(dest).split(path3.sep).filter((i) => i);
return srcArr.every((cur, i) => destArr[i] === cur);
}
function errMsg(src, dest, funcName) {
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
}
module2.exports = {
// checkPaths
checkPaths: u(checkPaths),
checkPathsSync,
// checkParent
checkParentPaths: u(checkParentPaths),
checkParentPathsSync,
// Misc
isSrcSubdir,
areIdentical
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js
var require_copy = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) {
"use strict";
var fs4 = require_fs();
var path3 = require("path");
var { mkdirs } = require_mkdirs();
var { pathExists } = require_path_exists();
var { utimesMillis } = require_utimes();
var stat = require_stat();
async function copy2(src, dest, opts = {}) {
if (typeof opts === "function") {
opts = { filter: opts };
}
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
if (opts.preserveTimestamps && process.arch === "ia32") {
process.emitWarning(
"Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
"Warning",
"fs-extra-WARN0001"
);
}
const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
await stat.checkParentPaths(src, srcStat, dest, "copy");
const include = await runFilter(src, dest, opts);
if (!include) return;
const destParent = path3.dirname(dest);
const dirExists = await pathExists(destParent);
if (!dirExists) {
await mkdirs(destParent);
}
await getStatsAndPerformCopy(destStat, src, dest, opts);
}
async function runFilter(src, dest, opts) {
if (!opts.filter) return true;
return opts.filter(src, dest);
}
async function getStatsAndPerformCopy(destStat, src, dest, opts) {
const statFn = opts.dereference ? fs4.stat : fs4.lstat;
const srcStat = await statFn(src);
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
throw new Error(`Unknown file: ${src}`);
}
async function onFile(srcStat, destStat, src, dest, opts) {
if (!destStat) return copyFile(srcStat, src, dest, opts);
if (opts.overwrite) {
await fs4.unlink(dest);
return copyFile(srcStat, src, dest, opts);
}
if (opts.errorOnExist) {
throw new Error(`'${dest}' already exists`);
}
}
async function copyFile(srcStat, src, dest, opts) {
await fs4.copyFile(src, dest);
if (opts.preserveTimestamps) {
if (fileIsNotWritable(srcStat.mode)) {
await makeFileWritable(dest, srcStat.mode);
}
const updatedSrcStat = await fs4.stat(src);
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
}
return fs4.chmod(dest, srcStat.mode);
}
function fileIsNotWritable(srcMode) {
return (srcMode & 128) === 0;
}
function makeFileWritable(dest, srcMode) {
return fs4.chmod(dest, srcMode | 128);
}
async function onDir(srcStat, destStat, src, dest, opts) {
if (!destStat) {
await fs4.mkdir(dest);
}
const items = await fs4.readdir(src);
await Promise.all(items.map(async (item) => {
const srcItem = path3.join(src, item);
const destItem = path3.join(dest, item);
const include = await runFilter(srcItem, destItem, opts);
if (!include) return;
const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts);
}));
if (!destStat) {
await fs4.chmod(dest, srcStat.mode);
}
}
async function onLink(destStat, src, dest, opts) {
let resolvedSrc = await fs4.readlink(src);
if (opts.dereference) {
resolvedSrc = path3.resolve(process.cwd(), resolvedSrc);
}
if (!destStat) {
return fs4.symlink(resolvedSrc, dest);
}
let resolvedDest = null;
try {
resolvedDest = await fs4.readlink(dest);
} catch (e) {
if (e.code === "EINVAL" || e.code === "UNKNOWN") return fs4.symlink(resolvedSrc, dest);
throw e;
}
if (opts.dereference) {
resolvedDest = path3.resolve(process.cwd(), resolvedDest);
}
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
}
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
}
await fs4.unlink(dest);
return fs4.symlink(resolvedSrc, dest);
}
module2.exports = copy2;
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js
var require_copy_sync = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js"(exports2, module2) {
"use strict";
var fs4 = require_graceful_fs();
var path3 = require("path");
var mkdirsSync = require_mkdirs().mkdirsSync;
var utimesMillisSync = require_utimes().utimesMillisSync;
var stat = require_stat();
function copySync(src, dest, opts) {
if (typeof opts === "function") {
opts = { filter: opts };
}
opts = opts || {};
opts.clobber = "clobber" in opts ? !!opts.clobber : true;
opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
if (opts.preserveTimestamps && process.arch === "ia32") {
process.emitWarning(
"Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
"Warning",
"fs-extra-WARN0002"
);
}
const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
stat.checkParentPathsSync(src, srcStat, dest, "copy");
if (opts.filter && !opts.filter(src, dest)) return;
const destParent = path3.dirname(dest);
if (!fs4.existsSync(destParent)) mkdirsSync(destParent);
return getStats(destStat, src, dest, opts);
}
function getStats(destStat, src, dest, opts) {
const statSync = opts.dereference ? fs4.statSync : fs4.lstatSync;
const srcStat = statSync(src);
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
throw new Error(`Unknown file: ${src}`);
}
function onFile(srcStat, destStat, src, dest, opts) {
if (!destStat) return copyFile(srcStat, src, dest, opts);
return mayCopyFile(srcStat, src, dest, opts);
}
function mayCopyFile(srcStat, src, dest, opts) {
if (opts.overwrite) {
fs4.unlinkSync(dest);
return copyFile(srcStat, src, dest, opts);
} else if (opts.errorOnExist) {
throw new Error(`'${dest}' already exists`);
}
}
function copyFile(srcStat, src, dest, opts) {
fs4.copyFileSync(src, dest);
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
return setDestMode(dest, srcStat.mode);
}
function handleTimestamps(srcMode, src, dest) {
if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
return setDestTimestamps(src, dest);
}
function fileIsNotWritable(srcMode) {
return (srcMode & 128) === 0;
}
function makeFileWritable(dest, srcMode) {
return setDestMode(dest, srcMode | 128);
}
function setDestMode(dest, srcMode) {
return fs4.chmodSync(dest, srcMode);
}
function setDestTimestamps(src, dest) {
const updatedSrcStat = fs4.statSync(src);
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
}
function onDir(srcStat, destStat, src, dest, opts) {
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
return copyDir(src, dest, opts);
}
function mkDirAndCopy(srcMode, src, dest, opts) {
fs4.mkdirSync(dest);
copyDir(src, dest, opts);
return setDestMode(dest, srcMode);
}
function copyDir(src, dest, opts) {
fs4.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
}
function copyDirItem(item, src, dest, opts) {
const srcItem = path3.join(src, item);
const destItem = path3.join(dest, item);
if (opts.filter && !opts.filter(srcItem, destItem)) return;
const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
return getStats(destStat, srcItem, destItem, opts);
}
function onLink(destStat, src, dest, opts) {
let resolvedSrc = fs4.readlinkSync(src);
if (opts.dereference) {
resolvedSrc = path3.resolve(process.cwd(), resolvedSrc);
}
if (!destStat) {
return fs4.symlinkSync(resolvedSrc, dest);
} else {
let resolvedDest;
try {
resolvedDest = fs4.readlinkSync(dest);
} catch (err) {
if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs4.symlinkSync(resolvedSrc, dest);
throw err;
}
if (opts.dereference) {
resolvedDest = path3.resolve(process.cwd(), resolvedDest);
}
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
}
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
}
return copyLink(resolvedSrc, dest);
}
}
function copyLink(resolvedSrc, dest) {
fs4.unlinkSync(dest);
return fs4.symlinkSync(resolvedSrc, dest);
}
module2.exports = copySync;
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js
var require_copy2 = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js"(exports2, module2) {
"use strict";
var u = require_universalify().fromPromise;
module2.exports = {
copy: u(require_copy()),
copySync: require_copy_sync()
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js
var require_remove = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js"(exports2, module2) {
"use strict";
var fs4 = require_graceful_fs();
var u = require_universalify().fromCallback;
function remove(path3, callback) {
fs4.rm(path3, { recursive: true, force: true }, callback);
}
function removeSync(path3) {
fs4.rmSync(path3, { recursive: true, force: true });
}
module2.exports = {
remove: u(remove),
removeSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js
var require_empty = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js"(exports2, module2) {
"use strict";
var u = require_universalify().fromPromise;
var fs4 = require_fs();
var path3 = require("path");
var mkdir = require_mkdirs();
var remove = require_remove();
var emptyDir = u(async function emptyDir2(dir) {
let items;
try {
items = await fs4.readdir(dir);
} catch {
return mkdir.mkdirs(dir);
}
return Promise.all(items.map((item) => remove.remove(path3.join(dir, item))));
});
function emptyDirSync(dir) {
let items;
try {
items = fs4.readdirSync(dir);
} catch {
return mkdir.mkdirsSync(dir);
}
items.forEach((item) => {
item = path3.join(dir, item);
remove.removeSync(item);
});
}
module2.exports = {
emptyDirSync,
emptydirSync: emptyDirSync,
emptyDir,
emptydir: emptyDir
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js
var require_file = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) {
"use strict";
var u = require_universalify().fromPromise;
var path3 = require("path");
var fs4 = require_fs();
var mkdir = require_mkdirs();
async function createFile(file) {
let stats;
try {
stats = await fs4.stat(file);
} catch {
}
if (stats && stats.isFile()) return;
const dir = path3.dirname(file);
let dirStats = null;
try {
dirStats = await fs4.stat(dir);
} catch (err) {
if (err.code === "ENOENT") {
await mkdir.mkdirs(dir);
await fs4.writeFile(file, "");
return;
} else {
throw err;
}
}
if (dirStats.isDirectory()) {
await fs4.writeFile(file, "");
} else {
await fs4.readdir(dir);
}
}
function createFileSync(file) {
let stats;
try {
stats = fs4.statSync(file);
} catch {
}
if (stats && stats.isFile()) return;
const dir = path3.dirname(file);
try {
if (!fs4.statSync(dir).isDirectory()) {
fs4.readdirSync(dir);
}
} catch (err) {
if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
else throw err;
}
fs4.writeFileSync(file, "");
}
module2.exports = {
createFile: u(createFile),
createFileSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js
var require_link = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) {
"use strict";
var u = require_universalify().fromPromise;
var path3 = require("path");
var fs4 = require_fs();
var mkdir = require_mkdirs();
var { pathExists } = require_path_exists();
var { areIdentical } = require_stat();
async function createLink(srcpath, dstpath) {
let dstStat;
try {
dstStat = await fs4.lstat(dstpath);
} catch {
}
let srcStat;
try {
srcStat = await fs4.lstat(srcpath);
} catch (err) {
err.message = err.message.replace("lstat", "ensureLink");
throw err;
}
if (dstStat && areIdentical(srcStat, dstStat)) return;
const dir = path3.dirname(dstpath);
const dirExists = await pathExists(dir);
if (!dirExists) {
await mkdir.mkdirs(dir);
}
await fs4.link(srcpath, dstpath);
}
function createLinkSync(srcpath, dstpath) {
let dstStat;
try {
dstStat = fs4.lstatSync(dstpath);
} catch {
}
try {
const srcStat = fs4.lstatSync(srcpath);
if (dstStat && areIdentical(srcStat, dstStat)) return;
} catch (err) {
err.message = err.message.replace("lstat", "ensureLink");
throw err;
}
const dir = path3.dirname(dstpath);
const dirExists = fs4.existsSync(dir);
if (dirExists) return fs4.linkSync(srcpath, dstpath);
mkdir.mkdirsSync(dir);
return fs4.linkSync(srcpath, dstpath);
}
module2.exports = {
createLink: u(createLink),
createLinkSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js
var require_symlink_paths = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) {
"use strict";
var path3 = require("path");
var fs4 = require_fs();
var { pathExists } = require_path_exists();
var u = require_universalify().fromPromise;
async function symlinkPaths(srcpath, dstpath) {
if (path3.isAbsolute(srcpath)) {
try {
await fs4.lstat(srcpath);
} catch (err) {
err.message = err.message.replace("lstat", "ensureSymlink");
throw err;
}
return {
toCwd: srcpath,
toDst: srcpath
};
}
const dstdir = path3.dirname(dstpath);
const relativeToDst = path3.join(dstdir, srcpath);
const exists = await pathExists(relativeToDst);
if (exists) {
return {
toCwd: relativeToDst,
toDst: srcpath
};
}
try {
await fs4.lstat(srcpath);
} catch (err) {
err.message = err.message.replace("lstat", "ensureSymlink");
throw err;
}
return {
toCwd: srcpath,
toDst: path3.relative(dstdir, srcpath)
};
}
function symlinkPathsSync(srcpath, dstpath) {
if (path3.isAbsolute(srcpath)) {
const exists2 = fs4.existsSync(srcpath);
if (!exists2) throw new Error("absolute srcpath does not exist");
return {
toCwd: srcpath,
toDst: srcpath
};
}
const dstdir = path3.dirname(dstpath);
const relativeToDst = path3.join(dstdir, srcpath);
const exists = fs4.existsSync(relativeToDst);
if (exists) {
return {
toCwd: relativeToDst,
toDst: srcpath
};
}
const srcExists = fs4.existsSync(srcpath);
if (!srcExists) throw new Error("relative srcpath does not exist");
return {
toCwd: srcpath,
toDst: path3.relative(dstdir, srcpath)
};
}
module2.exports = {
symlinkPaths: u(symlinkPaths),
symlinkPathsSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js
var require_symlink_type = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) {
"use strict";
var fs4 = require_fs();
var u = require_universalify().fromPromise;
async function symlinkType(srcpath, type) {
if (type) return type;
let stats;
try {
stats = await fs4.lstat(srcpath);
} catch {
return "file";
}
return stats && stats.isDirectory() ? "dir" : "file";
}
function symlinkTypeSync(srcpath, type) {
if (type) return type;
let stats;
try {
stats = fs4.lstatSync(srcpath);
} catch {
return "file";
}
return stats && stats.isDirectory() ? "dir" : "file";
}
module2.exports = {
symlinkType: u(symlinkType),
symlinkTypeSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js
var require_symlink = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) {
"use strict";
var u = require_universalify().fromPromise;
var path3 = require("path");
var fs4 = require_fs();
var { mkdirs, mkdirsSync } = require_mkdirs();
var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
var { symlinkType, symlinkTypeSync } = require_symlink_type();
var { pathExists } = require_path_exists();
var { areIdentical } = require_stat();
async function createSymlink(srcpath, dstpath, type) {
let stats;
try {
stats = await fs4.lstat(dstpath);
} catch {
}
if (stats && stats.isSymbolicLink()) {
const [srcStat, dstStat] = await Promise.all([
fs4.stat(srcpath),
fs4.stat(dstpath)
]);
if (areIdentical(srcStat, dstStat)) return;
}
const relative = await symlinkPaths(srcpath, dstpath);
srcpath = relative.toDst;
const toType = await symlinkType(relative.toCwd, type);
const dir = path3.dirname(dstpath);
if (!await pathExists(dir)) {
await mkdirs(dir);
}
return fs4.symlink(srcpath, dstpath, toType);
}
function createSymlinkSync(srcpath, dstpath, type) {
let stats;
try {
stats = fs4.lstatSync(dstpath);
} catch {
}
if (stats && stats.isSymbolicLink()) {
const srcStat = fs4.statSync(srcpath);
const dstStat = fs4.statSync(dstpath);
if (areIdentical(srcStat, dstStat)) return;
}
const relative = symlinkPathsSync(srcpath, dstpath);
srcpath = relative.toDst;
type = symlinkTypeSync(relative.toCwd, type);
const dir = path3.dirname(dstpath);
const exists = fs4.existsSync(dir);
if (exists) return fs4.symlinkSync(srcpath, dstpath, type);
mkdirsSync(dir);
return fs4.symlinkSync(srcpath, dstpath, type);
}
module2.exports = {
createSymlink: u(createSymlink),
createSymlinkSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js
var require_ensure = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js"(exports2, module2) {
"use strict";
var { createFile, createFileSync } = require_file();
var { createLink, createLinkSync } = require_link();
var { createSymlink, createSymlinkSync } = require_symlink();
module2.exports = {
// file
createFile,
createFileSync,
ensureFile: createFile,
ensureFileSync: createFileSync,
// link
createLink,
createLinkSync,
ensureLink: createLink,
ensureLinkSync: createLinkSync,
// symlink
createSymlink,
createSymlinkSync,
ensureSymlink: createSymlink,
ensureSymlinkSync: createSymlinkSync
};
}
});
// ../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js
var require_utils2 = __commonJS({
"../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/utils.js"(exports2, module2) {
function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
const EOF = finalEOL ? EOL : "";
const str = JSON.stringify(obj, replacer, spaces);
return str.replace(/\n/g, EOL) + EOF;
}
function stripBom(content) {
if (Buffer.isBuffer(content)) content = content.toString("utf8");
return content.replace(/^\uFEFF/, "");
}
module2.exports = { stringify, stripBom };
}
});
// ../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/index.js
var require_jsonfile = __commonJS({
"../../node_modules/.pnpm/jsonfile@6.2.0/node_modules/jsonfile/index.js"(exports2, module2) {
var _fs;
try {
_fs = require_graceful_fs();
} catch (_) {
_fs = require("fs");
}
var universalify = require_universalify();
var { stringify, stripBom } = require_utils2();
async function _readFile(file, options = {}) {
if (typeof options === "string") {
options = { encoding: options };
}
const fs4 = options.fs || _fs;
const shouldThrow = "throws" in options ? options.throws : true;
let data = await universalify.fromCallback(fs4.readFile)(file, options);
data = stripBom(data);
let obj;
try {
obj = JSON.parse(data, options ? options.reviver : null);
} catch (err) {
if (shouldThrow) {
err.message = `${file}: ${err.message}`;
throw err;
} else {
return null;
}
}
return obj;
}
var readFile2 = universalify.fromPromise(_readFile);
function readFileSync(file, options = {}) {
if (typeof options === "string") {
options = { encoding: options };
}
const fs4 = options.fs || _fs;
const shouldThrow = "throws" in options ? options.throws : true;
try {
let content = fs4.readFileSync(file, options);
content = stripBom(content);
return JSON.parse(content, options.reviver);
} catch (err) {
if (shouldThrow) {
err.message = `${file}: ${err.message}`;
throw err;
} else {
return null;
}
}
}
async function _writeFile(file, obj, options = {}) {
const fs4 = options.fs || _fs;
const str = stringify(obj, options);
await universalify.fromCallback(fs4.writeFile)(file, str, options);
}
var writeFile = universalify.fromPromise(_writeFile);
function writeFileSync(file, obj, options = {}) {
const fs4 = options.fs || _fs;
const str = stringify(obj, options);
return fs4.writeFileSync(file, str, options);
}
module2.exports = {
readFile: readFile2,
readFileSync,
writeFile,
writeFileSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js
var require_jsonfile2 = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js"(exports2, module2) {
"use strict";
var jsonFile = require_jsonfile();
module2.exports = {
// jsonfile exports
readJson: jsonFile.readFile,
readJsonSync: jsonFile.readFileSync,
writeJson: jsonFile.writeFile,
writeJsonSync: jsonFile.writeFileSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js
var require_output_file = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) {
"use strict";
var u = require_universalify().fromPromise;
var fs4 = require_fs();
var path3 = require("path");
var mkdir = require_mkdirs();
var pathExists = require_path_exists().pathExists;
async function outputFile(file, data, encoding = "utf-8") {
const dir = path3.dirname(file);
if (!await pathExists(dir)) {
await mkdir.mkdirs(dir);
}
return fs4.writeFile(file, data, encoding);
}
function outputFileSync(file, ...args) {
const dir = path3.dirname(file);
if (!fs4.existsSync(dir)) {
mkdir.mkdirsSync(dir);
}
fs4.writeFileSync(file, ...args);
}
module2.exports = {
outputFile: u(outputFile),
outputFileSync
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js
var require_output_json = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js"(exports2, module2) {
"use strict";
var { stringify } = require_utils2();
var { outputFile } = require_output_file();
async function outputJson(file, data, options = {}) {
const str = stringify(data, options);
await outputFile(file, str, options);
}
module2.exports = outputJson;
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js
var require_output_json_sync = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports2, module2) {
"use strict";
var { stringify } = require_utils2();
var { outputFileSync } = require_output_file();
function outputJsonSync(file, data, options) {
const str = stringify(data, options);
outputFileSync(file, str, options);
}
module2.exports = outputJsonSync;
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js
var require_json = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js"(exports2, module2) {
"use strict";
var u = require_universalify().fromPromise;
var jsonFile = require_jsonfile2();
jsonFile.outputJson = u(require_output_json());
jsonFile.outputJsonSync = require_output_json_sync();
jsonFile.outputJSON = jsonFile.outputJson;
jsonFile.outputJSONSync = jsonFile.outputJsonSync;
jsonFile.writeJSON = jsonFile.writeJson;
jsonFile.writeJSONSync = jsonFile.writeJsonSync;
jsonFile.readJSON = jsonFile.readJson;
jsonFile.readJSONSync = jsonFile.readJsonSync;
module2.exports = jsonFile;
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js
var require_move = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
"use strict";
var fs4 = require_fs();
var path3 = require("path");
var { copy: copy2 } = require_copy2();
var { remove } = require_remove();
var { mkdirp } = require_mkdirs();
var { pathExists } = require_path_exists();
var stat = require_stat();
async function move(src, dest, opts = {}) {
const overwrite = opts.overwrite || opts.clobber || false;
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
await stat.checkParentPaths(src, srcStat, dest, "move");
const destParent = path3.dirname(dest);
const parsedParentPath = path3.parse(destParent);
if (parsedParentPath.root !== destParent) {
await mkdirp(destParent);
}
return doRename(src, dest, overwrite, isChangingCase);
}
async function doRename(src, dest, overwrite, isChangingCase) {
if (!isChangingCase) {
if (overwrite) {
await remove(dest);
} else if (await pathExists(dest)) {
throw new Error("dest already exists.");
}
}
try {
await fs4.rename(src, dest);
} catch (err) {
if (err.code !== "EXDEV") {
throw err;
}
await moveAcrossDevice(src, dest, overwrite);
}
}
async function moveAcrossDevice(src, dest, overwrite) {
const opts = {
overwrite,
errorOnExist: true,
preserveTimestamps: true
};
await copy2(src, dest, opts);
return remove(src);
}
module2.exports = move;
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js
var require_move_sync = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js"(exports2, module2) {
"use strict";
var fs4 = require_graceful_fs();
var path3 = require("path");
var copySync = require_copy2().copySync;
var removeSync = require_remove().removeSync;
var mkdirpSync = require_mkdirs().mkdirpSync;
var stat = require_stat();
function moveSync(src, dest, opts) {
opts = opts || {};
const overwrite = opts.overwrite || opts.clobber || false;
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
stat.checkParentPathsSync(src, srcStat, dest, "move");
if (!isParentRoot(dest)) mkdirpSync(path3.dirname(dest));
return doRename(src, dest, overwrite, isChangingCase);
}
function isParentRoot(dest) {
const parent = path3.dirname(dest);
const parsedPath = path3.parse(parent);
return parsedPath.root === parent;
}
function doRename(src, dest, overwrite, isChangingCase) {
if (isChangingCase) return rename(src, dest, overwrite);
if (overwrite) {
removeSync(dest);
return rename(src, dest, overwrite);
}
if (fs4.existsSync(dest)) throw new Error("dest already exists.");
return rename(src, dest, overwrite);
}
function rename(src, dest, overwrite) {
try {
fs4.renameSync(src, dest);
} catch (err) {
if (err.code !== "EXDEV") throw err;
return moveAcrossDevice(src, dest, overwrite);
}
}
function moveAcrossDevice(src, dest, overwrite) {
const opts = {
overwrite,
errorOnExist: true,
preserveTimestamps: true
};
copySync(src, dest, opts);
return removeSync(src);
}
module2.exports = moveSync;
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js
var require_move2 = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js"(exports2, module2) {
"use strict";
var u = require_universalify().fromPromise;
module2.exports = {
move: u(require_move()),
moveSync: require_move_sync()
};
}
});
// ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js
var require_lib2 = __commonJS({
"../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js"(exports2, module2) {
"use strict";
module2.exports = {
// Export promiseified graceful-fs:
...require_fs(),
// Export extra methods:
...require_copy2(),
...require_empty(),
...require_ensure(),
...require_json(),
...require_mkdirs(),
...require_move2(),
...require_output_file(),
...require_path_exists(),
...require_remove()
};
}
});
// ../../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/cjs/_interop_require_default.cjs
var require_interop_require_default = __commonJS({
"../../node_modules/.pnpm/@swc+helpers@0.5.15/node_modules/@swc/helpers/cjs/_interop_require_default.cjs"(exports2) {
"use strict";
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
exports2._ = _interop_require_default;
}
});
// ../../node_modules/.pnpm/next@16.1.1-canary.18_react-dom@19.1.1_react@19.1.1__react@19.1.1/node_modules/next/dist/shared/lib/modern-browserslist-target.js
var require_modern_browserslist_target = __commonJS({
"../../node_modules/.pnpm/next@16.1.1-canary.18_react-dom@19.1.1_react@19.1.1__react@19.1.1/node_modules/next/dist/shared/lib/modern-browserslist-target.js"(exports2, module2) {
"use strict";
var MODERN_BROWSERSLIST_TARGET = [
"chrome 111",
"edge 111",
"firefox 111",
"safari 16.4"
];
module2.exports = MODERN_BROWSERSLIST_TARGET;
}
});
// ../../node_modules/.pnpm/next@16.1.1-canary.18_react-dom@19.1.1_react@19.1.1__react@19.1.1/node_modules/next/dist/shared/lib/entry-constants.js
var require_entry_constants = __commonJS({
"../../node_modules/.pnpm/next@16.1.1-canary.18_react-dom@19.1.1_react@19.1.1__react@19.1.1/node_modules/next/dist/shared/lib/entry-constants.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
function _export(target, all) {
for (var name in all) Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports2, {
UNDERSCORE_GLOBAL_ERROR_ROUTE: function() {
return UNDERSCORE_GLOBAL_ERROR_ROUTE;
},
UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY: function() {
return UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY;
},
UNDERSCORE_NOT_FOUND_ROUTE: function() {
return UNDERSCORE_NOT_FOUND_ROUTE;
},
UNDERSCORE_NOT_FOUND_ROUTE_ENTRY: function() {
return UNDERSCORE_NOT_FOUND_ROUTE_ENTRY;
}
});
var UNDERSCORE_NOT_FOUND_ROUTE = "/_not-found";
var UNDERSCORE_NOT_FOUND_ROUTE_ENTRY = `${UNDERSCORE_NOT_FOUND_ROUTE}/page`;
var UNDERSCORE_GLOBAL_ERROR_ROUTE = "/_global-error";
var UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY = `${UNDERSCORE_GLOBAL_ERROR_ROUTE}/page`;
}
});
// ../../node_modules/.pnpm/next@16.1.1-canary.18_react-dom@19.1.1_react@19.1.1__react@19.1.1/node_modules/next/dist/shared/lib/constants.js
var require_constants = __commonJS({
"../../node_modules/.pnpm/next@16.1.1-canary.18_react-dom@19.1.1_react@19.1.1__react@19.1.1/node_modules/next/dist/shared/lib/constants.js"(exports2, module2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
function _export(target, all) {
for (var name in all) Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports2, {
APP_CLIENT_INTERNALS: function() {
return APP_CLIENT_INTERNALS;
},
APP_PATHS_MANIFEST: function() {
return APP_PATHS_MANIFEST;
},
APP_PATH_ROUTES_MANIFEST: function() {
return APP_PATH_ROUTES_MANIFEST;
},
AdapterOutputType: function() {
return AdapterOutputType2;
},
BARREL_OPTIMIZATION_PREFIX: function() {
return BARREL_OPTIMIZATION_PREFIX;
},
BLOCKED_PAGES: function() {
return BLOCKED_PAGES;
},
BUILD_ID_FILE: function() {
return BUILD_ID_FILE;
},
BUILD_MANIFEST: function() {
return BUILD_MANIFEST;
},
CLIENT_PUBLIC_FILES_PATH: function() {
return CLIENT_PUBLIC_FILES_PATH;
},
CLIENT_REFERENCE_MANIFEST: function() {
return CLIENT_REFERENCE_MANIFEST;
},
CLIENT_STATIC_FILES_PATH: function() {
return CLIENT_STATIC_FILES_PATH;
},
CLIENT_STATIC_FILES_RUNTIME_MAIN: function() {
return CLIENT_STATIC_FILES_RUNTIME_MAIN;
},
CLIENT_STATIC_FILES_RUNTIME_MAIN_APP: function() {
return CLIENT_STATIC_FILES_RUNTIME_MAIN_APP;
},
CLIENT_STATIC_FILES_RUNTIME_POLYFILLS: function() {
return CLIENT_STATIC_FILES_RUNTIME_POLYFILLS;
},
CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL: function() {
return CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL;
},
CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH: function() {
return CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH;
},
CLIENT_STATIC_FILES_RUNTIME_WEBPACK: function() {
return CLIENT_STATIC_FILES_RUNTIME_WEBPACK;
},
COMPILER_INDEXES: function() {
return COMPILER_INDEXES;
},
COMPILER_NAMES: function() {
return COMPILER_NAMES;
},
CONFIG_FILES: function() {
return CONFIG_FILES;
},
DEFAULT_RUNTIME_WEBPACK: function() {
return DEFAULT_RUNTIME_WEBPACK;
},
DEFAULT_SANS_SERIF_FONT: function() {
return DEFAULT_SANS_SERIF_FONT;
},
DEFAULT_SERIF_FONT: function() {
return DEFAULT_SERIF_FONT;
},
DEV_CLIENT_MIDDLEWARE_MANIFEST: function() {
return DEV_CLIENT_MIDDLEWARE_MANIFEST;
},
DEV_CLIENT_PAGES_MANIFEST: function() {
return DEV_CLIENT_PAGES_MANIFEST;
},
DYNAMIC_CSS_MANIFEST: function() {
return DYNAMIC_CSS_MANIFEST;
},
EDGE_RUNTIME_WEBPACK: function() {
return EDGE_RUNTIME_WEBPACK;
},
EDGE_UNSUPPORTED_NODE_APIS: function() {
return EDGE_UNSUPPORTED_NODE_APIS;
},
EXPORT_DETAIL: function() {
return EXPORT_DETAIL;
},
EXPORT_MARKER: function() {
return EXPORT_MARKER;
},
FUNCTIONS_CONFIG_MANIFEST: function() {
return FUNCTIONS_CONFIG_MANIFEST;
},
IMAGES_MANIFEST: function() {
return IMAGES_MANIFEST;
},
INTERCEPTION_ROUTE_REWRITE_MANIFEST: function() {
return INTERCEPTION_ROUTE_REWRITE_MANIFEST;
},
MIDDLEWARE_BUILD_MANIFEST: function() {
return MIDDLEWARE_BUILD_MANIFEST;
},
MIDDLEWARE_MANIFEST: function() {
return MIDDLEWARE_MANIFEST;
},
MIDDLEWARE_REACT_LOADABLE_MANIFEST: function() {
return MIDDLEWARE_REACT_LOADABLE_MANIFEST;
},
MODERN_BROWSERSLIST_TARGET: function() {
return _modernbrowserslisttarget.default;
},
NEXT_BUILTIN_DOCUMENT: function() {
return NEXT_BUILTIN_DOCUMENT;
},
NEXT_FONT_MANIFEST: function() {
return NEXT_FONT_MANIFEST;
},
PAGES_MANIFEST: function() {
return PAGES_MANIFEST;
},
PHASE_ANALYZE: function() {
return PHASE_ANALYZE;
},
PHASE_DEVELOPMENT_SERVER: function() {
return PHASE_DEVELOPMENT_SERVER;
},
PHASE_EXPORT: function() {
return PHASE_EXPORT;
},
PHASE_INFO: function() {
return PHASE_INFO;
},
PHASE_PRODUCTION_BUILD: function() {
return PHASE_PRODUCTION_BUILD;
},
PHASE_PRODUCTION_SERVER: function() {
return PHASE_PRODUCTION_SERVER;
},
PHASE_TEST: function() {
return PHASE_TEST;
},
PRERENDER_MANIFEST: function() {
return PRERENDER_MANIFEST;
},
REACT_LOADABLE_MANIFEST: function() {
return REACT_LOADABLE_MANIFEST;
},
ROUTES_MANIFEST: function() {
return ROUTES_MANIFEST;
},
RSC_MODULE_TYPES: function() {
return RSC_MODULE_TYPES;
},
SERVER_DIRECTORY: function() {
return SERVER_DIRECTORY;
},
SERVER_FILES_MANIFEST: function() {
return SERVER_FILES_MANIFEST;
},
SERVER_PROPS_ID: function() {
return SERVER_PROPS_ID;
},
SERVER_REFERENCE_MANIFEST: function() {
return SERVER_REFERENCE_MANIFEST;
},
STATIC_PROPS_ID: function() {
return STATIC_PROPS_ID;
},
STATIC_STATUS_PAGES: function() {
return STATIC_STATUS_PAGES;
},
STRING_LITERAL_DROP_BUNDLE: function() {
return STRING_LITERAL_DROP_BUNDLE;
},
SUBRESOURCE_INTEGRITY_MANIFEST: function() {
return SUBRESOURCE_INTEGRITY_MANIFEST;
},
SYSTEM_ENTRYPOINTS: function() {
return SYSTEM_ENTRYPOINTS;
},
TRACE_OUTPUT_VERSION: function() {
return TRACE_OUTPUT_VERSION;
},
TURBOPACK_CLIENT_BUILD_MANIFEST: function() {
return TURBOPACK_CLIENT_BUILD_MANIFEST;
},
TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST: function() {
return TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST;
},
TURBO_TRACE_DEFAULT_MEMORY_LIMIT: function() {
return TURBO_TRACE_DEFAULT_MEMORY_LIMIT;
},
UNDERSCORE_GLOBAL_ERROR_ROUTE: function() {
return _entryconstants.UNDERSCORE_GLOBAL_ERROR_ROUTE;
},
UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY: function() {
return _entryconstants.UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY;
},
UNDERSCORE_NOT_FOUND_ROUTE: function() {
return _entryconstants.UNDERSCORE_NOT_FOUND_ROUTE;
},
UNDERSCORE_NOT_FOUND_ROUTE_ENTRY: function() {
return _entryconstants.UNDERSCORE_NOT_FOUND_ROUTE_ENTRY;
},
WEBPACK_STATS: function() {
return WEBPACK_STATS;
}
});
var _interop_require_default = require_interop_require_default();
var _modernbrowserslisttarget = /* @__PURE__ */ _interop_require_default._(require_modern_browserslist_target());
var _entryconstants = require_entry_constants();
var COMPILER_NAMES = {
client: "client",
server: "server",
edgeServer: "edge-server"
};
var COMPILER_INDEXES = {
[COMPILER_NAMES.client]: 0,
[COMPILER_NAMES.server]: 1,
[COMPILER_NAMES.edgeServer]: 2
};
var AdapterOutputType2 = /* @__PURE__ */ (function(AdapterOutputType3) {
AdapterOutputType3["PAGES"] = "PAGES";
AdapterOutputType3["PAGES_API"] = "PAGES_API";
AdapterOutputType3["APP_PAGE"] = "APP_PAGE";
AdapterOutputType3["APP_ROUTE"] = "APP_ROUTE";
AdapterOutputType3["PRERENDER"] = "PRERENDER";
AdapterOutputType3["STATIC_FILE"] = "STATIC_FILE";
AdapterOutputType3["MIDDLEWARE"] = "MIDDLEWARE";
return AdapterOutputType3;
})({});
var PHASE_EXPORT = "phase-export";
var PHASE_ANALYZE = "phase-analyze";
var PHASE_PRODUCTION_BUILD = "phase-production-build";
var PHASE_PRODUCTION_SERVER = "phase-production-server";
var PHASE_DEVELOPMENT_SERVER = "phase-development-server";
var PHASE_TEST = "phase-test";
var PHASE_INFO = "phase-info";
var PAGES_MANIFEST = "pages-manifest.json";
var WEBPACK_STATS = "webpack-stats.json";
var APP_PATHS_MANIFEST = "app-paths-manifest.json";
var APP_PATH_ROUTES_MANIFEST = "app-path-routes-manifest.json";
var BUILD_MANIFEST = "build-manifest.json";
var FUNCTIONS_CONFIG_MANIFEST = "functions-config-manifest.json";
var SUBRESOURCE_INTEGRITY_MANIFEST = "subresource-integrity-manifest";
var NEXT_FONT_MANIFEST = "next-font-manifest";
var EXPORT_MARKER = "export-marker.json";
var EXPORT_DETAIL = "export-detail.json";
var PRERENDER_MANIFEST = "prerender-manifest.json";
var ROUTES_MANIFEST = "routes-manifest.json";
var IMAGES_MANIFEST = "images-manifest.json";
var SERVER_FILES_MANIFEST = "required-server-files";
var DEV_CLIENT_PAGES_MANIFEST = "_devPagesManifest.json";
var MIDDLEWARE_MANIFEST = "middleware-manifest.json";
var TURBOPACK_CLIENT_MIDDLEWARE_MANIFEST = "_clientMiddlewareManifest.json";
var TURBOPACK_CLIENT_BUILD_MANIFEST = "client-build-manifest.json";
var DEV_CLIENT_MIDDLEWARE_MANIFEST = "_devMiddlewareManifest.json";
var REACT_LOADABLE_MANIFEST = "react-loadable-manifest.json";
var SERVER_DIRECTORY = "server";
var CONFIG_FILES = [
"next.config.js",
"next.config.mjs",
"next.config.ts",
// process.features can be undefined on Edge runtime
// TODO: Remove `as any` once we bump @types/node to v22.10.0+
...process?.features?.typescript ? [
"next.config.mts"
] : []
];
var BUILD_ID_FILE = "BUILD_ID";
var BLOCKED_PAGES = [
"/_document",
"/_app",
"/_error"
];
var CLIENT_PUBLIC_FILES_PATH = "public";
var CLIENT_STATIC_FILES_PATH = "static";
var STRING_LITERAL_DROP_BUNDLE = "__NEXT_DROP_CLIENT_FILE__";
var NEXT_BUILTIN_DOCUMENT = "__NEXT_BUILTIN_DOCUMENT__";
var BARREL_OPTIMIZATION_PREFIX = "__barrel_optimize__";
var CLIENT_REFERENCE_MANIFEST = "client-reference-manifest";
var SERVER_REFERENCE_MANIFEST = "server-reference-manifest";
var MIDDLEWARE_BUILD_MANIFEST = "middleware-build-manifest";
var MIDDLEWARE_REACT_LOADABLE_MANIFEST = "middleware-react-loadable-manifest";
var INTERCEPTION_ROUTE_REWRITE_MANIFEST = "interception-route-rewrite-manifest";
var DYNAMIC_CSS_MANIFEST = "dynamic-css-manifest";
var CLIENT_STATIC_FILES_RUNTIME_MAIN = `main`;
var CLIENT_STATIC_FILES_RUNTIME_MAIN_APP = `${CLIENT_STATIC_FILES_RUNTIME_MAIN}-app`;
var APP_CLIENT_INTERNALS = "app-pages-internals";
var CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH = `react-refresh`;
var CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `webpack`;
var CLIENT_STATIC_FILES_RUNTIME_POLYFILLS = "polyfills";
var CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL = Symbol(CLIENT_STATIC_FILES_RUNTIME_POLYFILLS);
var DEFAULT_RUNTIME_WEBPACK = "webpack-runtime";
var EDGE_RUNTIME_WEBPACK = "edge-runtime-webpack";
var STATIC_PROPS_ID = "__N_SSG";
var SERVER_PROPS_ID = "__N_SSP";
var DEFAULT_SERIF_FONT = {
name: "Times New Roman",
xAvgCharWidth: 821,
azAvgWidth: 854.3953488372093,
unitsPerEm: 2048
};
var DEFAULT_SANS_SERIF_FONT = {
name: "Arial",
xAvgCharWidth: 904,
azAvgWidth: 934.5116279069767,
unitsPerEm: 2048
};
var STATIC_STATUS_PAGES = [
"/500"
];
var TRACE_OUTPUT_VERSION = 1;
var TURBO_TRACE_DEFAULT_MEMORY_LIMIT = 6e3;
var RSC_MODULE_TYPES = {
client: "client",
server: "server"
};
var EDGE_UNSUPPORTED_NODE_APIS = [
"clearImmediate",
"setImmediate",
"BroadcastChannel",
"ByteLengthQueuingStrategy",
"CompressionStream",
"CountQueuingStrategy",
"DecompressionStream",
"DomException",
"MessageChannel",
"MessageEvent",
"MessagePort",
"ReadableByteStreamController",
"ReadableStreamBYOBRequest",
"ReadableStreamDefaultController",
"TransformStreamDefaultController",
"WritableStreamDefaultController"
];
var SYSTEM_ENTRYPOINTS = /* @__PURE__ */ new Set([
CLIENT_STATIC_FILES_RUNTIME_MAIN,
CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH,
CLIENT_STATIC_FILES_RUNTIME_MAIN_APP
]);
if ((typeof exports2.default === "function" || typeof exports2.default === "object" && exports2.default !== null) && typeof exports2.default.__esModule === "undefined") {
Object.defineProperty(exports2.default, "__esModule", { value: true });
Object.assign(exports2.default, exports2);
module2.exports = exports2.default;
}
}
});
// ../../node_modules/.pnpm/bytes@3.1.2/node_modules/bytes/index.js
var require_bytes = __commonJS({
"../../node_modules/.pnpm/bytes@3.1.2/node_modules/bytes/index.js"(exports2, module2) {
"use strict";
module2.exports = bytes2;
module2.exports.format = format;
module2.exports.parse = parse;
var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
var map = {
b: 1,
kb: 1 << 10,
mb: 1 << 20,
gb: 1 << 30,
tb: Math.pow(1024, 4),
pb: Math.pow(1024, 5)
};
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
function bytes2(value, options) {
if (typeof value === "string") {
return parse(value);
}
if (typeof value === "number") {
return format(value, options);
}
return null;
}
function format(value, options) {
if (!Number.isFinite(value)) {
return null;
}
var mag = Math.abs(value);
var thousandsSeparator = options && options.thousandsSeparator || "";
var unitSeparator = options && options.unitSeparator || "";
var decimalPlaces = options && options.decimalPlaces !== void 0 ? options.decimalPlaces : 2;
var fixedDecimals = Boolean(options && options.fixedDecimals);
var unit = options && options.unit || "";
if (!unit || !map[unit.toLowerCase()]) {
if (mag >= map.pb) {
unit = "PB";
} else if (mag >= map.tb) {
unit = "TB";
} else if (mag >= map.gb) {
unit = "GB";
} else if (mag >= map.mb) {
unit = "MB";
} else if (mag >= map.kb) {
unit = "KB";
} else {
unit = "B";
}
}
var val = value / map[unit.toLowerCase()];
var str = val.toFixed(decimalPlaces);
if (!fixedDecimals) {
str = str.replace(formatDecimalsRegExp, "$1");
}
if (thousandsSeparator) {
str = str.split(".").map(function(s, i) {
return i === 0 ? s.replace(formatThousandsRegExp, thousandsSeparator) : s;
}).join(".");
}
return str + unitSeparator + unit;
}
function parse(val) {
if (typeof val === "number" && !isNaN(val)) {
return val;
}
if (typeof val !== "string") {
return null;
}
var results = parseRegExp.exec(val);
var floatValue;
var unit = "b";
if (!results) {
floatValue = parseInt(val, 10);
unit = "b";
} else {
floatValue = parseFloat(results[1]);
unit = results[4].toLowerCase();
}
if (isNaN(floatValue)) {
return null;
}
return Math.floor(map[unit] * floatValue);
}
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/Source.js
var require_Source = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/Source.js"(exports2, module2) {
"use strict";
var Source = class {
source() {
throw new Error("Abstract");
}
buffer() {
const source = this.source();
if (Buffer.isBuffer(source)) return source;
return Buffer.from(source, "utf-8");
}
size() {
return this.buffer().length;
}
map(options) {
return null;
}
sourceAndMap(options) {
return {
source: this.source(),
map: this.map(options)
};
}
updateHash(hash) {
throw new Error("Abstract");
}
};
module2.exports = Source;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/getGeneratedSourceInfo.js
var require_getGeneratedSourceInfo = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/getGeneratedSourceInfo.js"(exports2, module2) {
"use strict";
var CHAR_CODE_NEW_LINE = "\n".charCodeAt(0);
var getGeneratedSourceInfo = (source) => {
if (source === void 0) {
return {};
}
const lastLineStart = source.lastIndexOf("\n");
if (lastLineStart === -1) {
return {
generatedLine: 1,
generatedColumn: source.length,
source
};
}
let generatedLine = 2;
for (let i = 0; i < lastLineStart; i++) {
if (source.charCodeAt(i) === CHAR_CODE_NEW_LINE) generatedLine++;
}
return {
generatedLine,
generatedColumn: source.length - lastLineStart - 1,
source
};
};
module2.exports = getGeneratedSourceInfo;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/splitIntoLines.js
var require_splitIntoLines = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/splitIntoLines.js"(exports2, module2) {
var splitIntoLines = (str) => {
const results = [];
const len = str.length;
let i = 0;
for (; i < len; ) {
const cc = str.charCodeAt(i);
if (cc === 10) {
results.push("\n");
i++;
} else {
let j = i + 1;
while (j < len && str.charCodeAt(j) !== 10) j++;
results.push(str.slice(i, j + 1));
i = j + 1;
}
}
return results;
};
module2.exports = splitIntoLines;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/streamChunksOfRawSource.js
var require_streamChunksOfRawSource = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/streamChunksOfRawSource.js"(exports2, module2) {
"use strict";
var getGeneratedSourceInfo = require_getGeneratedSourceInfo();
var splitIntoLines = require_splitIntoLines();
var streamChunksOfRawSource = (source, onChunk, onSource, onName) => {
let line = 1;
const matches = splitIntoLines(source);
let match;
for (match of matches) {
onChunk(match, line, 0, -1, -1, -1, -1);
line++;
}
return matches.length === 0 || match.endsWith("\n") ? {
generatedLine: matches.length + 1,
generatedColumn: 0
} : {
generatedLine: matches.length,
generatedColumn: match.length
};
};
module2.exports = (source, onChunk, onSource, onName, finalSource) => {
return finalSource ? getGeneratedSourceInfo(source) : streamChunksOfRawSource(source, onChunk, onSource, onName);
};
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/RawSource.js
var require_RawSource = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/RawSource.js"(exports2, module2) {
"use strict";
var streamChunksOfRawSource = require_streamChunksOfRawSource();
var Source = require_Source();
var RawSource = class extends Source {
constructor(value, convertToString = false) {
super();
const isBuffer = Buffer.isBuffer(value);
if (!isBuffer && typeof value !== "string") {
throw new TypeError("argument 'value' must be either string of Buffer");
}
this._valueIsBuffer = !convertToString && isBuffer;
this._value = convertToString && isBuffer ? void 0 : value;
this._valueAsBuffer = isBuffer ? value : void 0;
this._valueAsString = isBuffer ? void 0 : value;
}
isBuffer() {
return this._valueIsBuffer;
}
source() {
if (this._value === void 0) {
this._value = this._valueAsBuffer.toString("utf-8");
}
return this._value;
}
buffer() {
if (this._valueAsBuffer === void 0) {
this._valueAsBuffer = Buffer.from(this._value, "utf-8");
}
return this._valueAsBuffer;
}
map(options) {
return null;
}
/**
* @param {object} options options
* @param {function(string, number, number, number, number, number, number): void} onChunk called for each chunk of code
* @param {function(number, string, string)} onSource called for each source
* @param {function(number, string)} onName called for each name
* @returns {void}
*/
streamChunks(options, onChunk, onSource, onName) {
if (this._value === void 0) {
this._value = Buffer.from(this._valueAsBuffer, "utf-8");
}
if (this._valueAsString === void 0) {
this._valueAsString = typeof this._value === "string" ? this._value : this._value.toString("utf-8");
}
return streamChunksOfRawSource(
this._valueAsString,
onChunk,
onSource,
onName,
!!(options && options.finalSource)
);
}
updateHash(hash) {
if (this._valueAsBuffer === void 0) {
this._valueAsBuffer = Buffer.from(this._value, "utf-8");
}
hash.update("RawSource");
hash.update(this._valueAsBuffer);
}
};
module2.exports = RawSource;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/createMappingsSerializer.js
var require_createMappingsSerializer = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/createMappingsSerializer.js"(exports2, module2) {
"use strict";
var ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(
""
);
var CONTINUATION_BIT = 32;
var createMappingsSerializer = (options) => {
const linesOnly = options && options.columns === false;
return linesOnly ? createLinesOnlyMappingsSerializer() : createFullMappingsSerializer();
};
var createFullMappingsSerializer = () => {
let currentLine = 1;
let currentColumn = 0;
let currentSourceIndex = 0;
let currentOriginalLine = 1;
let currentOriginalColumn = 0;
let currentNameIndex = 0;
let activeMapping = false;
let activeName = false;
let initial = true;
return (generatedLine, generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex) => {
if (activeMapping && currentLine === generatedLine) {
if (sourceIndex === currentSourceIndex && originalLine === currentOriginalLine && originalColumn === currentOriginalColumn && !activeName && nameIndex < 0) {
return "";
}
} else {
if (sourceIndex < 0) {
return "";
}
}
let str;
if (currentLine < generatedLine) {
str = ";".repeat(generatedLine - currentLine);
currentLine = generatedLine;
currentColumn = 0;
initial = false;
} else if (initial) {
str = "";
initial = false;
} else {
str = ",";
}
const writeValue = (value) => {
const sign = value >>> 31 & 1;
const mask = value >> 31;
const absValue = value + mask ^ mask;
let data = absValue << 1 | sign;
for (; ; ) {
const sextet = data & 31;
data >>= 5;
if (data === 0) {
str += ALPHABET[sextet];
break;
} else {
str += ALPHABET[sextet | CONTINUATION_BIT];
}
}
};
writeValue(generatedColumn - currentColumn);
currentColumn = generatedColumn;
if (sourceIndex >= 0) {
activeMapping = true;
if (sourceIndex === currentSourceIndex) {
str += "A";
} else {
writeValue(sourceIndex - currentSourceIndex);
currentSourceIndex = sourceIndex;
}
writeValue(originalLine - currentOriginalLine);
currentOriginalLine = originalLine;
if (originalColumn === currentOriginalColumn) {
str += "A";
} else {
writeValue(originalColumn - currentOriginalColumn);
currentOriginalColumn = originalColumn;
}
if (nameIndex >= 0) {
writeValue(nameIndex - currentNameIndex);
currentNameIndex = nameIndex;
activeName = true;
} else {
activeName = false;
}
} else {
activeMapping = false;
}
return str;
};
};
var createLinesOnlyMappingsSerializer = () => {
let lastWrittenLine = 0;
let currentLine = 1;
let currentSourceIndex = 0;
let currentOriginalLine = 1;
return (generatedLine, _generatedColumn, sourceIndex, originalLine, _originalColumn, _nameIndex) => {
if (sourceIndex < 0) {
return "";
}
if (lastWrittenLine === generatedLine) {
return "";
}
let str;
const writeValue = (value) => {
const sign = value >>> 31 & 1;
const mask = value >> 31;
const absValue = value + mask ^ mask;
let data = absValue << 1 | sign;
for (; ; ) {
const sextet = data & 31;
data >>= 5;
if (data === 0) {
str += ALPHABET[sextet];
break;
} else {
str += ALPHABET[sextet | CONTINUATION_BIT];
}
}
};
lastWrittenLine = generatedLine;
if (generatedLine === currentLine + 1) {
currentLine = generatedLine;
if (sourceIndex === currentSourceIndex) {
currentSourceIndex = sourceIndex;
if (originalLine === currentOriginalLine + 1) {
currentOriginalLine = originalLine;
return ";AACA";
} else {
str = ";AA";
writeValue(originalLine - currentOriginalLine);
currentOriginalLine = originalLine;
return str + "A";
}
} else {
str = ";A";
writeValue(sourceIndex - currentSourceIndex);
currentSourceIndex = sourceIndex;
writeValue(originalLine - currentOriginalLine);
currentOriginalLine = originalLine;
return str + "A";
}
} else {
str = ";".repeat(generatedLine - currentLine);
currentLine = generatedLine;
if (sourceIndex === currentSourceIndex) {
currentSourceIndex = sourceIndex;
if (originalLine === currentOriginalLine + 1) {
currentOriginalLine = originalLine;
return str + "AACA";
} else {
str += "AA";
writeValue(originalLine - currentOriginalLine);
currentOriginalLine = originalLine;
return str + "A";
}
} else {
str += "A";
writeValue(sourceIndex - currentSourceIndex);
currentSourceIndex = sourceIndex;
writeValue(originalLine - currentOriginalLine);
currentOriginalLine = originalLine;
return str + "A";
}
}
};
};
module2.exports = createMappingsSerializer;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/getFromStreamChunks.js
var require_getFromStreamChunks = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/getFromStreamChunks.js"(exports2) {
"use strict";
var createMappingsSerializer = require_createMappingsSerializer();
exports2.getSourceAndMap = (inputSource, options) => {
let code = "";
let mappings = "";
let sources = [];
let sourcesContent = [];
let names = [];
const addMapping = createMappingsSerializer(options);
const { source } = inputSource.streamChunks(
Object.assign({}, options, { finalSource: true }),
(chunk, generatedLine, generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex) => {
if (chunk !== void 0) code += chunk;
mappings += addMapping(
generatedLine,
generatedColumn,
sourceIndex,
originalLine,
originalColumn,
nameIndex
);
},
(sourceIndex, source2, sourceContent) => {
while (sources.length < sourceIndex) {
sources.push(null);
}
sources[sourceIndex] = source2;
if (sourceContent !== void 0) {
while (sourcesContent.length < sourceIndex) {
sourcesContent.push(null);
}
sourcesContent[sourceIndex] = sourceContent;
}
},
(nameIndex, name) => {
while (names.length < nameIndex) {
names.push(null);
}
names[nameIndex] = name;
}
);
return {
source: source !== void 0 ? source : code,
map: mappings.length > 0 ? {
version: 3,
file: "x",
mappings,
sources,
sourcesContent: sourcesContent.length > 0 ? sourcesContent : void 0,
names
} : null
};
};
exports2.getMap = (source, options) => {
let mappings = "";
let sources = [];
let sourcesContent = [];
let names = [];
const addMapping = createMappingsSerializer(options);
source.streamChunks(
Object.assign({}, options, { source: false, finalSource: true }),
(chunk, generatedLine, generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex) => {
mappings += addMapping(
generatedLine,
generatedColumn,
sourceIndex,
originalLine,
originalColumn,
nameIndex
);
},
(sourceIndex, source2, sourceContent) => {
while (sources.length < sourceIndex) {
sources.push(null);
}
sources[sourceIndex] = source2;
if (sourceContent !== void 0) {
while (sourcesContent.length < sourceIndex) {
sourcesContent.push(null);
}
sourcesContent[sourceIndex] = sourceContent;
}
},
(nameIndex, name) => {
while (names.length < nameIndex) {
names.push(null);
}
names[nameIndex] = name;
}
);
return mappings.length > 0 ? {
version: 3,
file: "x",
mappings,
sources,
sourcesContent: sourcesContent.length > 0 ? sourcesContent : void 0,
names
} : null;
};
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/splitIntoPotentialTokens.js
var require_splitIntoPotentialTokens = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/splitIntoPotentialTokens.js"(exports2, module2) {
var splitIntoPotentialTokens = (str) => {
const len = str.length;
if (len === 0) return null;
const results = [];
let i = 0;
for (; i < len; ) {
const s = i;
block: {
let cc = str.charCodeAt(i);
while (cc !== 10 && cc !== 59 && cc !== 123 && cc !== 125) {
if (++i >= len) break block;
cc = str.charCodeAt(i);
}
while (cc === 59 || cc === 32 || cc === 123 || cc === 125 || cc === 13 || cc === 9) {
if (++i >= len) break block;
cc = str.charCodeAt(i);
}
if (cc === 10) {
i++;
}
}
results.push(str.slice(s, i));
}
return results;
};
module2.exports = splitIntoPotentialTokens;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/OriginalSource.js
var require_OriginalSource = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/OriginalSource.js"(exports2, module2) {
"use strict";
var { getMap, getSourceAndMap } = require_getFromStreamChunks();
var splitIntoLines = require_splitIntoLines();
var getGeneratedSourceInfo = require_getGeneratedSourceInfo();
var Source = require_Source();
var splitIntoPotentialTokens = require_splitIntoPotentialTokens();
var OriginalSource2 = class extends Source {
constructor(value, name) {
super();
const isBuffer = Buffer.isBuffer(value);
this._value = isBuffer ? void 0 : value;
this._valueAsBuffer = isBuffer ? value : void 0;
this._name = name;
}
getName() {
return this._name;
}
source() {
if (this._value === void 0) {
this._value = this._valueAsBuffer.toString("utf-8");
}
return this._value;
}
buffer() {
if (this._valueAsBuffer === void 0) {
this._valueAsBuffer = Buffer.from(this._value, "utf-8");
}
return this._valueAsBuffer;
}
map(options) {
return getMap(this, options);
}
sourceAndMap(options) {
return getSourceAndMap(this, options);
}
/**
* @param {object} options options
* @param {function(string, number, number, number, number, number, number): void} onChunk called for each chunk of code
* @param {function(number, string, string)} onSource called for each source
* @param {function(number, string)} onName called for each name
* @returns {void}
*/
streamChunks(options, onChunk, onSource, onName) {
if (this._value === void 0) {
this._value = this._valueAsBuffer.toString("utf-8");
}
onSource(0, this._name, this._value);
const finalSource = !!(options && options.finalSource);
if (!options || options.columns !== false) {
const matches = splitIntoPotentialTokens(this._value);
let line = 1;
let column = 0;
if (matches !== null) {
for (const match of matches) {
const isEndOfLine = match.endsWith("\n");
if (isEndOfLine && match.length === 1) {
if (!finalSource) onChunk(match, line, column, -1, -1, -1, -1);
} else {
const chunk = finalSource ? void 0 : match;
onChunk(chunk, line, column, 0, line, column, -1);
}
if (isEndOfLine) {
line++;
column = 0;
} else {
column += match.length;
}
}
}
return {
generatedLine: line,
generatedColumn: column,
source: finalSource ? this._value : void 0
};
} else if (finalSource) {
const result = getGeneratedSourceInfo(this._value);
const { generatedLine, generatedColumn } = result;
if (generatedColumn === 0) {
for (let line = 1; line < generatedLine; line++)
onChunk(void 0, line, 0, 0, line, 0, -1);
} else {
for (let line = 1; line <= generatedLine; line++)
onChunk(void 0, line, 0, 0, line, 0, -1);
}
return result;
} else {
let line = 1;
const matches = splitIntoLines(this._value);
let match;
for (match of matches) {
onChunk(finalSource ? void 0 : match, line, 0, 0, line, 0, -1);
line++;
}
return matches.length === 0 || match.endsWith("\n") ? {
generatedLine: matches.length + 1,
generatedColumn: 0,
source: finalSource ? this._value : void 0
} : {
generatedLine: matches.length,
generatedColumn: match.length,
source: finalSource ? this._value : void 0
};
}
}
updateHash(hash) {
if (this._valueAsBuffer === void 0) {
this._valueAsBuffer = Buffer.from(this._value, "utf-8");
}
hash.update("OriginalSource");
hash.update(this._valueAsBuffer);
hash.update(this._name || "");
}
};
module2.exports = OriginalSource2;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/getSource.js
var require_getSource = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/getSource.js"(exports2, module2) {
"use strict";
var getSource = (sourceMap, index) => {
if (index < 0) return null;
const { sourceRoot, sources } = sourceMap;
const source = sources[index];
if (!sourceRoot) return source;
if (sourceRoot.endsWith("/")) return sourceRoot + source;
return sourceRoot + "/" + source;
};
module2.exports = getSource;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/readMappings.js
var require_readMappings = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/readMappings.js"(exports2, module2) {
"use strict";
var ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var CONTINUATION_BIT = 32;
var END_SEGMENT_BIT = 64;
var NEXT_LINE = END_SEGMENT_BIT | 1;
var INVALID = END_SEGMENT_BIT | 2;
var DATA_MASK = 31;
var ccToValue = new Uint8Array("z".charCodeAt(0) + 1);
{
ccToValue.fill(INVALID);
for (let i = 0; i < ALPHABET.length; i++) {
ccToValue[ALPHABET.charCodeAt(i)] = i;
}
ccToValue[",".charCodeAt(0)] = END_SEGMENT_BIT;
ccToValue[";".charCodeAt(0)] = NEXT_LINE;
}
var ccMax = ccToValue.length - 1;
var readMappings = (mappings, onMapping) => {
const currentData = new Uint32Array([0, 0, 1, 0, 0]);
let currentDataPos = 0;
let currentValue = 0;
let currentValuePos = 0;
let generatedLine = 1;
let generatedColumn = -1;
for (let i = 0; i < mappings.length; i++) {
const cc = mappings.charCodeAt(i);
if (cc > ccMax) continue;
const value = ccToValue[cc];
if ((value & END_SEGMENT_BIT) !== 0) {
if (currentData[0] > generatedColumn) {
if (currentDataPos === 1) {
onMapping(generatedLine, currentData[0], -1, -1, -1, -1);
} else if (currentDataPos === 4) {
onMapping(
generatedLine,
currentData[0],
currentData[1],
currentData[2],
currentData[3],
-1
);
} else if (currentDataPos === 5) {
onMapping(
generatedLine,
currentData[0],
currentData[1],
currentData[2],
currentData[3],
currentData[4]
);
}
generatedColumn = currentData[0];
}
currentDataPos = 0;
if (value === NEXT_LINE) {
generatedLine++;
currentData[0] = 0;
generatedColumn = -1;
}
} else if ((value & CONTINUATION_BIT) === 0) {
currentValue |= value << currentValuePos;
const finalValue = currentValue & 1 ? -(currentValue >> 1) : currentValue >> 1;
currentData[currentDataPos++] += finalValue;
currentValuePos = 0;
currentValue = 0;
} else {
currentValue |= (value & DATA_MASK) << currentValuePos;
currentValuePos += 5;
}
}
if (currentDataPos === 1) {
onMapping(generatedLine, currentData[0], -1, -1, -1, -1);
} else if (currentDataPos === 4) {
onMapping(
generatedLine,
currentData[0],
currentData[1],
currentData[2],
currentData[3],
-1
);
} else if (currentDataPos === 5) {
onMapping(
generatedLine,
currentData[0],
currentData[1],
currentData[2],
currentData[3],
currentData[4]
);
}
};
module2.exports = readMappings;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/streamChunksOfSourceMap.js
var require_streamChunksOfSourceMap = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/streamChunksOfSourceMap.js"(exports2, module2) {
"use strict";
var getGeneratedSourceInfo = require_getGeneratedSourceInfo();
var getSource = require_getSource();
var readMappings = require_readMappings();
var splitIntoLines = require_splitIntoLines();
var streamChunksOfSourceMapFull = (source, sourceMap, onChunk, onSource, onName) => {
const lines = splitIntoLines(source);
if (lines.length === 0) {
return {
generatedLine: 1,
generatedColumn: 0
};
}
const { sources, sourcesContent, names, mappings } = sourceMap;
for (let i = 0; i < sources.length; i++) {
onSource(
i,
getSource(sourceMap, i),
sourcesContent && sourcesContent[i] || void 0
);
}
if (names) {
for (let i = 0; i < names.length; i++) {
onName(i, names[i]);
}
}
const lastLine = lines[lines.length - 1];
const lastNewLine = lastLine.endsWith("\n");
const finalLine = lastNewLine ? lines.length + 1 : lines.length;
const finalColumn = lastNewLine ? 0 : lastLine.length;
let currentGeneratedLine = 1;
let currentGeneratedColumn = 0;
let mappingActive = false;
let activeMappingSourceIndex = -1;
let activeMappingOriginalLine = -1;
let activeMappingOriginalColumn = -1;
let activeMappingNameIndex = -1;
const onMapping = (generatedLine, generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex) => {
if (mappingActive && currentGeneratedLine <= lines.length) {
let chunk;
const mappingLine = currentGeneratedLine;
const mappingColumn = currentGeneratedColumn;
const line = lines[currentGeneratedLine - 1];
if (generatedLine !== currentGeneratedLine) {
chunk = line.slice(currentGeneratedColumn);
currentGeneratedLine++;
currentGeneratedColumn = 0;
} else {
chunk = line.slice(currentGeneratedColumn, generatedColumn);
currentGeneratedColumn = generatedColumn;
}
if (chunk) {
onChunk(
chunk,
mappingLine,
mappingColumn,
activeMappingSourceIndex,
activeMappingOriginalLine,
activeMappingOriginalColumn,
activeMappingNameIndex
);
}
mappingActive = false;
}
if (generatedLine > currentGeneratedLine && currentGeneratedColumn > 0) {
if (currentGeneratedLine <= lines.length) {
const chunk = lines[currentGeneratedLine - 1].slice(
currentGeneratedColumn
);
onChunk(
chunk,
currentGeneratedLine,
currentGeneratedColumn,
-1,
-1,
-1,
-1
);
}
currentGeneratedLine++;
currentGeneratedColumn = 0;
}
while (generatedLine > currentGeneratedLine) {
if (currentGeneratedLine <= lines.length) {
onChunk(
lines[currentGeneratedLine - 1],
currentGeneratedLine,
0,
-1,
-1,
-1,
-1
);
}
currentGeneratedLine++;
}
if (generatedColumn > currentGeneratedColumn) {
if (currentGeneratedLine <= lines.length) {
const chunk = lines[currentGeneratedLine - 1].slice(
currentGeneratedColumn,
generatedColumn
);
onChunk(
chunk,
currentGeneratedLine,
currentGeneratedColumn,
-1,
-1,
-1,
-1
);
}
currentGeneratedColumn = generatedColumn;
}
if (sourceIndex >= 0 && (generatedLine < finalLine || generatedLine === finalLine && generatedColumn < finalColumn)) {
mappingActive = true;
activeMappingSourceIndex = sourceIndex;
activeMappingOriginalLine = originalLine;
activeMappingOriginalColumn = originalColumn;
activeMappingNameIndex = nameIndex;
}
};
readMappings(mappings, onMapping);
onMapping(finalLine, finalColumn, -1, -1, -1, -1);
return {
generatedLine: finalLine,
generatedColumn: finalColumn
};
};
var streamChunksOfSourceMapLinesFull = (source, sourceMap, onChunk, onSource, _onName) => {
const lines = splitIntoLines(source);
if (lines.length === 0) {
return {
generatedLine: 1,
generatedColumn: 0
};
}
const { sources, sourcesContent, mappings } = sourceMap;
for (let i = 0; i < sources.length; i++) {
onSource(
i,
getSource(sourceMap, i),
sourcesContent && sourcesContent[i] || void 0
);
}
let currentGeneratedLine = 1;
const onMapping = (generatedLine, _generatedColumn, sourceIndex, originalLine, originalColumn, _nameIndex) => {
if (sourceIndex < 0 || generatedLine < currentGeneratedLine || generatedLine > lines.length) {
return;
}
while (generatedLine > currentGeneratedLine) {
if (currentGeneratedLine <= lines.length) {
onChunk(
lines[currentGeneratedLine - 1],
currentGeneratedLine,
0,
-1,
-1,
-1,
-1
);
}
currentGeneratedLine++;
}
if (generatedLine <= lines.length) {
onChunk(
lines[generatedLine - 1],
generatedLine,
0,
sourceIndex,
originalLine,
originalColumn,
-1
);
currentGeneratedLine++;
}
};
readMappings(mappings, onMapping);
for (; currentGeneratedLine <= lines.length; currentGeneratedLine++) {
onChunk(
lines[currentGeneratedLine - 1],
currentGeneratedLine,
0,
-1,
-1,
-1,
-1
);
}
const lastLine = lines[lines.length - 1];
const lastNewLine = lastLine.endsWith("\n");
const finalLine = lastNewLine ? lines.length + 1 : lines.length;
const finalColumn = lastNewLine ? 0 : lastLine.length;
return {
generatedLine: finalLine,
generatedColumn: finalColumn
};
};
var streamChunksOfSourceMapFinal = (source, sourceMap, onChunk, onSource, onName) => {
const result = getGeneratedSourceInfo(source);
const { generatedLine: finalLine, generatedColumn: finalColumn } = result;
if (finalLine === 1 && finalColumn === 0) return result;
const { sources, sourcesContent, names, mappings } = sourceMap;
for (let i = 0; i < sources.length; i++) {
onSource(
i,
getSource(sourceMap, i),
sourcesContent && sourcesContent[i] || void 0
);
}
if (names) {
for (let i = 0; i < names.length; i++) {
onName(i, names[i]);
}
}
let mappingActiveLine = 0;
const onMapping = (generatedLine, generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex) => {
if (generatedLine >= finalLine && (generatedColumn >= finalColumn || generatedLine > finalLine)) {
return;
}
if (sourceIndex >= 0) {
onChunk(
void 0,
generatedLine,
generatedColumn,
sourceIndex,
originalLine,
originalColumn,
nameIndex
);
mappingActiveLine = generatedLine;
} else if (mappingActiveLine === generatedLine) {
onChunk(void 0, generatedLine, generatedColumn, -1, -1, -1, -1);
mappingActiveLine = 0;
}
};
readMappings(mappings, onMapping);
return result;
};
var streamChunksOfSourceMapLinesFinal = (source, sourceMap, onChunk, onSource, _onName) => {
const result = getGeneratedSourceInfo(source);
const { generatedLine, generatedColumn } = result;
if (generatedLine === 1 && generatedColumn === 0) {
return {
generatedLine: 1,
generatedColumn: 0
};
}
const { sources, sourcesContent, mappings } = sourceMap;
for (let i = 0; i < sources.length; i++) {
onSource(
i,
getSource(sourceMap, i),
sourcesContent && sourcesContent[i] || void 0
);
}
const finalLine = generatedColumn === 0 ? generatedLine - 1 : generatedLine;
let currentGeneratedLine = 1;
const onMapping = (generatedLine2, _generatedColumn, sourceIndex, originalLine, originalColumn, _nameIndex) => {
if (sourceIndex >= 0 && currentGeneratedLine <= generatedLine2 && generatedLine2 <= finalLine) {
onChunk(
void 0,
generatedLine2,
0,
sourceIndex,
originalLine,
originalColumn,
-1
);
currentGeneratedLine = generatedLine2 + 1;
}
};
readMappings(mappings, onMapping);
return result;
};
module2.exports = (source, sourceMap, onChunk, onSource, onName, finalSource, columns) => {
if (columns) {
return finalSource ? streamChunksOfSourceMapFinal(
source,
sourceMap,
onChunk,
onSource,
onName
) : streamChunksOfSourceMapFull(
source,
sourceMap,
onChunk,
onSource,
onName
);
} else {
return finalSource ? streamChunksOfSourceMapLinesFinal(
source,
sourceMap,
onChunk,
onSource,
onName
) : streamChunksOfSourceMapLinesFull(
source,
sourceMap,
onChunk,
onSource,
onName
);
}
};
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/streamChunksOfCombinedSourceMap.js
var require_streamChunksOfCombinedSourceMap = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/streamChunksOfCombinedSourceMap.js"(exports2, module2) {
"use strict";
var streamChunksOfSourceMap = require_streamChunksOfSourceMap();
var splitIntoLines = require_splitIntoLines();
var streamChunksOfCombinedSourceMap = (source, sourceMap, innerSourceName, innerSource, innerSourceMap, removeInnerSource, onChunk, onSource, onName, finalSource, columns) => {
let sourceMapping = /* @__PURE__ */ new Map();
let nameMapping = /* @__PURE__ */ new Map();
const sourceIndexMapping = [];
const nameIndexMapping = [];
const nameIndexValueMapping = [];
let innerSourceIndex = -2;
const innerSourceIndexMapping = [];
const innerSourceIndexValueMapping = [];
const innerSourceContents = [];
const innerSourceContentLines = [];
const innerNameIndexMapping = [];
const innerNameIndexValueMapping = [];
const innerSourceMapLineData = [];
const findInnerMapping = (line, column) => {
if (line > innerSourceMapLineData.length) return -1;
const { mappingsData } = innerSourceMapLineData[line - 1];
let l = 0;
let r = mappingsData.length / 5;
while (l < r) {
let m = l + r >> 1;
if (mappingsData[m * 5] <= column) {
l = m + 1;
} else {
r = m;
}
}
if (l === 0) return -1;
return l - 1;
};
return streamChunksOfSourceMap(
source,
sourceMap,
(chunk, generatedLine, generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex) => {
if (sourceIndex === innerSourceIndex) {
const idx = findInnerMapping(originalLine, originalColumn);
if (idx !== -1) {
const { chunks, mappingsData } = innerSourceMapLineData[originalLine - 1];
const mi = idx * 5;
const innerSourceIndex2 = mappingsData[mi + 1];
const innerOriginalLine = mappingsData[mi + 2];
let innerOriginalColumn = mappingsData[mi + 3];
let innerNameIndex = mappingsData[mi + 4];
if (innerSourceIndex2 >= 0) {
const innerChunk = chunks[idx];
const innerGeneratedColumn = mappingsData[mi];
const locationInChunk = originalColumn - innerGeneratedColumn;
if (locationInChunk > 0) {
let originalSourceLines = innerSourceIndex2 < innerSourceContentLines.length ? innerSourceContentLines[innerSourceIndex2] : null;
if (originalSourceLines === void 0) {
const originalSource = innerSourceContents[innerSourceIndex2];
originalSourceLines = originalSource ? splitIntoLines(originalSource) : null;
innerSourceContentLines[innerSourceIndex2] = originalSourceLines;
}
if (originalSourceLines !== null) {
const originalChunk = innerOriginalLine <= originalSourceLines.length ? originalSourceLines[innerOriginalLine - 1].slice(
innerOriginalColumn,
innerOriginalColumn + locationInChunk
) : "";
if (innerChunk.slice(0, locationInChunk) === originalChunk) {
innerOriginalColumn += locationInChunk;
innerNameIndex = -1;
}
}
}
let sourceIndex2 = innerSourceIndex2 < innerSourceIndexMapping.length ? innerSourceIndexMapping[innerSourceIndex2] : -2;
if (sourceIndex2 === -2) {
const [source2, sourceContent] = innerSourceIndex2 < innerSourceIndexValueMapping.length ? innerSourceIndexValueMapping[innerSourceIndex2] : [null, void 0];
let globalIndex = sourceMapping.get(source2);
if (globalIndex === void 0) {
sourceMapping.set(source2, globalIndex = sourceMapping.size);
onSource(globalIndex, source2, sourceContent);
}
sourceIndex2 = globalIndex;
innerSourceIndexMapping[innerSourceIndex2] = sourceIndex2;
}
let finalNameIndex = -1;
if (innerNameIndex >= 0) {
finalNameIndex = innerNameIndex < innerNameIndexMapping.length ? innerNameIndexMapping[innerNameIndex] : -2;
if (finalNameIndex === -2) {
const name = innerNameIndex < innerNameIndexValueMapping.length ? innerNameIndexValueMapping[innerNameIndex] : void 0;
if (name) {
let globalIndex = nameMapping.get(name);
if (globalIndex === void 0) {
nameMapping.set(name, globalIndex = nameMapping.size);
onName(globalIndex, name);
}
finalNameIndex = globalIndex;
} else {
finalNameIndex = -1;
}
innerNameIndexMapping[innerNameIndex] = finalNameIndex;
}
} else if (nameIndex >= 0) {
let originalSourceLines = innerSourceContentLines[innerSourceIndex2];
if (originalSourceLines === void 0) {
const originalSource = innerSourceContents[innerSourceIndex2];
originalSourceLines = originalSource ? splitIntoLines(originalSource) : null;
innerSourceContentLines[innerSourceIndex2] = originalSourceLines;
}
if (originalSourceLines !== null) {
const name = nameIndexValueMapping[nameIndex];
const originalName = innerOriginalLine <= originalSourceLines.length ? originalSourceLines[innerOriginalLine - 1].slice(
innerOriginalColumn,
innerOriginalColumn + name.length
) : "";
if (name === originalName) {
finalNameIndex = nameIndex < nameIndexMapping.length ? nameIndexMapping[nameIndex] : -2;
if (finalNameIndex === -2) {
const name2 = nameIndexValueMapping[nameIndex];
if (name2) {
let globalIndex = nameMapping.get(name2);
if (globalIndex === void 0) {
nameMapping.set(name2, globalIndex = nameMapping.size);
onName(globalIndex, name2);
}
finalNameIndex = globalIndex;
} else {
finalNameIndex = -1;
}
nameIndexMapping[nameIndex] = finalNameIndex;
}
}
}
}
onChunk(
chunk,
generatedLine,
generatedColumn,
sourceIndex2,
innerOriginalLine,
innerOriginalColumn,
finalNameIndex
);
return;
}
}
if (removeInnerSource) {
onChunk(chunk, generatedLine, generatedColumn, -1, -1, -1, -1);
return;
} else {
if (sourceIndexMapping[sourceIndex] === -2) {
let globalIndex = sourceMapping.get(innerSourceName);
if (globalIndex === void 0) {
sourceMapping.set(source, globalIndex = sourceMapping.size);
onSource(globalIndex, innerSourceName, innerSource);
}
sourceIndexMapping[sourceIndex] = globalIndex;
}
}
}
const finalSourceIndex = sourceIndex < 0 || sourceIndex >= sourceIndexMapping.length ? -1 : sourceIndexMapping[sourceIndex];
if (finalSourceIndex < 0) {
onChunk(chunk, generatedLine, generatedColumn, -1, -1, -1, -1);
} else {
let finalNameIndex = -1;
if (nameIndex >= 0 && nameIndex < nameIndexMapping.length) {
finalNameIndex = nameIndexMapping[nameIndex];
if (finalNameIndex === -2) {
const name = nameIndexValueMapping[nameIndex];
let globalIndex = nameMapping.get(name);
if (globalIndex === void 0) {
nameMapping.set(name, globalIndex = nameMapping.size);
onName(globalIndex, name);
}
finalNameIndex = globalIndex;
nameIndexMapping[nameIndex] = finalNameIndex;
}
}
onChunk(
chunk,
generatedLine,
generatedColumn,
finalSourceIndex,
originalLine,
originalColumn,
finalNameIndex
);
}
},
(i, source2, sourceContent) => {
if (source2 === innerSourceName) {
innerSourceIndex = i;
if (innerSource !== void 0) sourceContent = innerSource;
else innerSource = sourceContent;
sourceIndexMapping[i] = -2;
streamChunksOfSourceMap(
sourceContent,
innerSourceMap,
(chunk, generatedLine, generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex) => {
while (innerSourceMapLineData.length < generatedLine) {
innerSourceMapLineData.push({
mappingsData: [],
chunks: []
});
}
const data = innerSourceMapLineData[generatedLine - 1];
data.mappingsData.push(
generatedColumn,
sourceIndex,
originalLine,
originalColumn,
nameIndex
);
data.chunks.push(chunk);
},
(i2, source3, sourceContent2) => {
innerSourceContents[i2] = sourceContent2;
innerSourceContentLines[i2] = void 0;
innerSourceIndexMapping[i2] = -2;
innerSourceIndexValueMapping[i2] = [source3, sourceContent2];
},
(i2, name) => {
innerNameIndexMapping[i2] = -2;
innerNameIndexValueMapping[i2] = name;
},
false,
columns
);
} else {
let globalIndex = sourceMapping.get(source2);
if (globalIndex === void 0) {
sourceMapping.set(source2, globalIndex = sourceMapping.size);
onSource(globalIndex, source2, sourceContent);
}
sourceIndexMapping[i] = globalIndex;
}
},
(i, name) => {
nameIndexMapping[i] = -2;
nameIndexValueMapping[i] = name;
},
finalSource,
columns
);
};
module2.exports = streamChunksOfCombinedSourceMap;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/SourceMapSource.js
var require_SourceMapSource = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/SourceMapSource.js"(exports2, module2) {
"use strict";
var Source = require_Source();
var streamChunksOfSourceMap = require_streamChunksOfSourceMap();
var streamChunksOfCombinedSourceMap = require_streamChunksOfCombinedSourceMap();
var { getMap, getSourceAndMap } = require_getFromStreamChunks();
var SourceMapSource2 = class extends Source {
constructor(value, name, sourceMap, originalSource, innerSourceMap, removeOriginalSource) {
super();
const valueIsBuffer = Buffer.isBuffer(value);
this._valueAsString = valueIsBuffer ? void 0 : value;
this._valueAsBuffer = valueIsBuffer ? value : void 0;
this._name = name;
this._hasSourceMap = !!sourceMap;
const sourceMapIsBuffer = Buffer.isBuffer(sourceMap);
const sourceMapIsString = typeof sourceMap === "string";
this._sourceMapAsObject = sourceMapIsBuffer || sourceMapIsString ? void 0 : sourceMap;
this._sourceMapAsString = sourceMapIsString ? sourceMap : void 0;
this._sourceMapAsBuffer = sourceMapIsBuffer ? sourceMap : void 0;
this._hasOriginalSource = !!originalSource;
const originalSourceIsBuffer = Buffer.isBuffer(originalSource);
this._originalSourceAsString = originalSourceIsBuffer ? void 0 : originalSource;
this._originalSourceAsBuffer = originalSourceIsBuffer ? originalSource : void 0;
this._hasInnerSourceMap = !!innerSourceMap;
const innerSourceMapIsBuffer = Buffer.isBuffer(innerSourceMap);
const innerSourceMapIsString = typeof innerSourceMap === "string";
this._innerSourceMapAsObject = innerSourceMapIsBuffer || innerSourceMapIsString ? void 0 : innerSourceMap;
this._innerSourceMapAsString = innerSourceMapIsString ? innerSourceMap : void 0;
this._innerSourceMapAsBuffer = innerSourceMapIsBuffer ? innerSourceMap : void 0;
this._removeOriginalSource = removeOriginalSource;
}
_ensureValueBuffer() {
if (this._valueAsBuffer === void 0) {
this._valueAsBuffer = Buffer.from(this._valueAsString, "utf-8");
}
}
_ensureValueString() {
if (this._valueAsString === void 0) {
this._valueAsString = this._valueAsBuffer.toString("utf-8");
}
}
_ensureOriginalSourceBuffer() {
if (this._originalSourceAsBuffer === void 0 && this._hasOriginalSource) {
this._originalSourceAsBuffer = Buffer.from(
this._originalSourceAsString,
"utf-8"
);
}
}
_ensureOriginalSourceString() {
if (this._originalSourceAsString === void 0 && this._hasOriginalSource) {
this._originalSourceAsString = this._originalSourceAsBuffer.toString(
"utf-8"
);
}
}
_ensureInnerSourceMapObject() {
if (this._innerSourceMapAsObject === void 0 && this._hasInnerSourceMap) {
this._ensureInnerSourceMapString();
this._innerSourceMapAsObject = JSON.parse(this._innerSourceMapAsString);
}
}
_ensureInnerSourceMapBuffer() {
if (this._innerSourceMapAsBuffer === void 0 && this._hasInnerSourceMap) {
this._ensureInnerSourceMapString();
this._innerSourceMapAsBuffer = Buffer.from(
this._innerSourceMapAsString,
"utf-8"
);
}
}
_ensureInnerSourceMapString() {
if (this._innerSourceMapAsString === void 0 && this._hasInnerSourceMap) {
if (this._innerSourceMapAsBuffer !== void 0) {
this._innerSourceMapAsString = this._innerSourceMapAsBuffer.toString(
"utf-8"
);
} else {
this._innerSourceMapAsString = JSON.stringify(
this._innerSourceMapAsObject
);
}
}
}
_ensureSourceMapObject() {
if (this._sourceMapAsObject === void 0) {
this._ensureSourceMapString();
this._sourceMapAsObject = JSON.parse(this._sourceMapAsString);
}
}
_ensureSourceMapBuffer() {
if (this._sourceMapAsBuffer === void 0) {
this._ensureSourceMapString();
this._sourceMapAsBuffer = Buffer.from(this._sourceMapAsString, "utf-8");
}
}
_ensureSourceMapString() {
if (this._sourceMapAsString === void 0) {
if (this._sourceMapAsBuffer !== void 0) {
this._sourceMapAsString = this._sourceMapAsBuffer.toString("utf-8");
} else {
this._sourceMapAsString = JSON.stringify(this._sourceMapAsObject);
}
}
}
getArgsAsBuffers() {
this._ensureValueBuffer();
this._ensureSourceMapBuffer();
this._ensureOriginalSourceBuffer();
this._ensureInnerSourceMapBuffer();
return [
this._valueAsBuffer,
this._name,
this._sourceMapAsBuffer,
this._originalSourceAsBuffer,
this._innerSourceMapAsBuffer,
this._removeOriginalSource
];
}
buffer() {
this._ensureValueBuffer();
return this._valueAsBuffer;
}
source() {
this._ensureValueString();
return this._valueAsString;
}
map(options) {
if (!this._hasInnerSourceMap) {
this._ensureSourceMapObject();
return this._sourceMapAsObject;
}
return getMap(this, options);
}
sourceAndMap(options) {
if (!this._hasInnerSourceMap) {
this._ensureValueString();
this._ensureSourceMapObject();
return {
source: this._valueAsString,
map: this._sourceMapAsObject
};
}
return getSourceAndMap(this, options);
}
streamChunks(options, onChunk, onSource, onName) {
this._ensureValueString();
this._ensureSourceMapObject();
this._ensureOriginalSourceString();
if (this._hasInnerSourceMap) {
this._ensureInnerSourceMapObject();
return streamChunksOfCombinedSourceMap(
this._valueAsString,
this._sourceMapAsObject,
this._name,
this._originalSourceAsString,
this._innerSourceMapAsObject,
this._removeOriginalSource,
onChunk,
onSource,
onName,
!!(options && options.finalSource),
!!(options && options.columns !== false)
);
} else {
return streamChunksOfSourceMap(
this._valueAsString,
this._sourceMapAsObject,
onChunk,
onSource,
onName,
!!(options && options.finalSource),
!!(options && options.columns !== false)
);
}
}
updateHash(hash) {
this._ensureValueBuffer();
this._ensureSourceMapBuffer();
this._ensureOriginalSourceBuffer();
this._ensureInnerSourceMapBuffer();
hash.update("SourceMapSource");
hash.update(this._valueAsBuffer);
hash.update(this._sourceMapAsBuffer);
if (this._hasOriginalSource) {
hash.update(this._originalSourceAsBuffer);
}
if (this._hasInnerSourceMap) {
hash.update(this._innerSourceMapAsBuffer);
}
hash.update(this._removeOriginalSource ? "true" : "false");
}
};
module2.exports = SourceMapSource2;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/streamChunks.js
var require_streamChunks = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/streamChunks.js"(exports2, module2) {
"use strict";
var streamChunksOfRawSource = require_streamChunksOfRawSource();
var streamChunksOfSourceMap = require_streamChunksOfSourceMap();
module2.exports = (source, options, onChunk, onSource, onName) => {
if (typeof source.streamChunks === "function") {
return source.streamChunks(options, onChunk, onSource, onName);
} else {
const sourceAndMap = source.sourceAndMap(options);
if (sourceAndMap.map) {
return streamChunksOfSourceMap(
sourceAndMap.source,
sourceAndMap.map,
onChunk,
onSource,
onName,
!!(options && options.finalSource),
!!(options && options.columns !== false)
);
} else {
return streamChunksOfRawSource(
sourceAndMap.source,
onChunk,
onSource,
onName,
!!(options && options.finalSource)
);
}
}
};
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/streamAndGetSourceAndMap.js
var require_streamAndGetSourceAndMap = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/helpers/streamAndGetSourceAndMap.js"(exports2, module2) {
"use strict";
var createMappingsSerializer = require_createMappingsSerializer();
var streamChunks = require_streamChunks();
var streamAndGetSourceAndMap = (inputSource, options, onChunk, onSource, onName) => {
let code = "";
let mappings = "";
let sources = [];
let sourcesContent = [];
let names = [];
const addMapping = createMappingsSerializer(
Object.assign({}, options, { columns: true })
);
const finalSource = !!(options && options.finalSource);
const { generatedLine, generatedColumn, source } = streamChunks(
inputSource,
options,
(chunk, generatedLine2, generatedColumn2, sourceIndex, originalLine, originalColumn, nameIndex) => {
if (chunk !== void 0) code += chunk;
mappings += addMapping(
generatedLine2,
generatedColumn2,
sourceIndex,
originalLine,
originalColumn,
nameIndex
);
return onChunk(
finalSource ? void 0 : chunk,
generatedLine2,
generatedColumn2,
sourceIndex,
originalLine,
originalColumn,
nameIndex
);
},
(sourceIndex, source2, sourceContent) => {
while (sources.length < sourceIndex) {
sources.push(null);
}
sources[sourceIndex] = source2;
if (sourceContent !== void 0) {
while (sourcesContent.length < sourceIndex) {
sourcesContent.push(null);
}
sourcesContent[sourceIndex] = sourceContent;
}
return onSource(sourceIndex, source2, sourceContent);
},
(nameIndex, name) => {
while (names.length < nameIndex) {
names.push(null);
}
names[nameIndex] = name;
return onName(nameIndex, name);
}
);
const resultSource = source !== void 0 ? source : code;
return {
result: {
generatedLine,
generatedColumn,
source: finalSource ? resultSource : void 0
},
source: resultSource,
map: mappings.length > 0 ? {
version: 3,
file: "x",
mappings,
sources,
sourcesContent: sourcesContent.length > 0 ? sourcesContent : void 0,
names
} : null
};
};
module2.exports = streamAndGetSourceAndMap;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/CachedSource.js
var require_CachedSource = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/CachedSource.js"(exports2, module2) {
"use strict";
var Source = require_Source();
var streamChunksOfSourceMap = require_streamChunksOfSourceMap();
var streamChunksOfRawSource = require_streamChunksOfRawSource();
var streamAndGetSourceAndMap = require_streamAndGetSourceAndMap();
var mapToBufferedMap = (map) => {
if (typeof map !== "object" || !map) return map;
const bufferedMap = Object.assign({}, map);
if (map.mappings) {
bufferedMap.mappings = Buffer.from(map.mappings, "utf-8");
}
if (map.sourcesContent) {
bufferedMap.sourcesContent = map.sourcesContent.map(
(str) => str && Buffer.from(str, "utf-8")
);
}
return bufferedMap;
};
var bufferedMapToMap = (bufferedMap) => {
if (typeof bufferedMap !== "object" || !bufferedMap) return bufferedMap;
const map = Object.assign({}, bufferedMap);
if (bufferedMap.mappings) {
map.mappings = bufferedMap.mappings.toString("utf-8");
}
if (bufferedMap.sourcesContent) {
map.sourcesContent = bufferedMap.sourcesContent.map(
(buffer) => buffer && buffer.toString("utf-8")
);
}
return map;
};
var CachedSource = class extends Source {
constructor(source, cachedData) {
super();
this._source = source;
this._cachedSourceType = cachedData ? cachedData.source : void 0;
this._cachedSource = void 0;
this._cachedBuffer = cachedData ? cachedData.buffer : void 0;
this._cachedSize = cachedData ? cachedData.size : void 0;
this._cachedMaps = cachedData ? cachedData.maps : /* @__PURE__ */ new Map();
this._cachedHashUpdate = cachedData ? cachedData.hash : void 0;
}
getCachedData() {
const bufferedMaps = /* @__PURE__ */ new Map();
for (const pair of this._cachedMaps) {
let cacheEntry = pair[1];
if (cacheEntry.bufferedMap === void 0) {
cacheEntry.bufferedMap = mapToBufferedMap(
this._getMapFromCacheEntry(cacheEntry)
);
}
bufferedMaps.set(pair[0], {
map: void 0,
bufferedMap: cacheEntry.bufferedMap
});
}
if (this._cachedSource) {
this.buffer();
}
return {
buffer: this._cachedBuffer,
source: this._cachedSourceType !== void 0 ? this._cachedSourceType : typeof this._cachedSource === "string" ? true : Buffer.isBuffer(this._cachedSource) ? false : void 0,
size: this._cachedSize,
maps: bufferedMaps,
hash: this._cachedHashUpdate
};
}
originalLazy() {
return this._source;
}
original() {
if (typeof this._source === "function") this._source = this._source();
return this._source;
}
source() {
const source = this._getCachedSource();
if (source !== void 0) return source;
return this._cachedSource = this.original().source();
}
_getMapFromCacheEntry(cacheEntry) {
if (cacheEntry.map !== void 0) {
return cacheEntry.map;
} else if (cacheEntry.bufferedMap !== void 0) {
return cacheEntry.map = bufferedMapToMap(cacheEntry.bufferedMap);
}
}
_getCachedSource() {
if (this._cachedSource !== void 0) return this._cachedSource;
if (this._cachedBuffer && this._cachedSourceType !== void 0) {
return this._cachedSource = this._cachedSourceType ? this._cachedBuffer.toString("utf-8") : this._cachedBuffer;
}
}
buffer() {
if (this._cachedBuffer !== void 0) return this._cachedBuffer;
if (this._cachedSource !== void 0) {
if (Buffer.isBuffer(this._cachedSource)) {
return this._cachedBuffer = this._cachedSource;
}
return this._cachedBuffer = Buffer.from(this._cachedSource, "utf-8");
}
if (typeof this.original().buffer === "function") {
return this._cachedBuffer = this.original().buffer();
}
const bufferOrString = this.source();
if (Buffer.isBuffer(bufferOrString)) {
return this._cachedBuffer = bufferOrString;
}
return this._cachedBuffer = Buffer.from(bufferOrString, "utf-8");
}
size() {
if (this._cachedSize !== void 0) return this._cachedSize;
if (this._cachedBuffer !== void 0) {
return this._cachedSize = this._cachedBuffer.length;
}
const source = this._getCachedSource();
if (source !== void 0) {
return this._cachedSize = Buffer.byteLength(source);
}
return this._cachedSize = this.original().size();
}
sourceAndMap(options) {
const key = options ? JSON.stringify(options) : "{}";
const cacheEntry = this._cachedMaps.get(key);
if (cacheEntry !== void 0) {
const map2 = this._getMapFromCacheEntry(cacheEntry);
return { source: this.source(), map: map2 };
}
let source = this._getCachedSource();
let map;
if (source !== void 0) {
map = this.original().map(options);
} else {
const sourceAndMap = this.original().sourceAndMap(options);
source = sourceAndMap.source;
map = sourceAndMap.map;
this._cachedSource = source;
}
this._cachedMaps.set(key, {
map,
bufferedMap: void 0
});
return { source, map };
}
streamChunks(options, onChunk, onSource, onName) {
const key = options ? JSON.stringify(options) : "{}";
if (this._cachedMaps.has(key) && (this._cachedBuffer !== void 0 || this._cachedSource !== void 0)) {
const { source: source2, map: map2 } = this.sourceAndMap(options);
if (map2) {
return streamChunksOfSourceMap(
source2,
map2,
onChunk,
onSource,
onName,
!!(options && options.finalSource),
true
);
} else {
return streamChunksOfRawSource(
source2,
onChunk,
onSource,
onName,
!!(options && options.finalSource)
);
}
}
const { result, source, map } = streamAndGetSourceAndMap(
this.original(),
options,
onChunk,
onSource,
onName
);
this._cachedSource = source;
this._cachedMaps.set(key, {
map,
bufferedMap: void 0
});
return result;
}
map(options) {
const key = options ? JSON.stringify(options) : "{}";
const cacheEntry = this._cachedMaps.get(key);
if (cacheEntry !== void 0) {
return this._getMapFromCacheEntry(cacheEntry);
}
const map = this.original().map(options);
this._cachedMaps.set(key, {
map,
bufferedMap: void 0
});
return map;
}
updateHash(hash) {
if (this._cachedHashUpdate !== void 0) {
for (const item of this._cachedHashUpdate) hash.update(item);
return;
}
const update = [];
let currentString = void 0;
const tracker = {
update: (item) => {
if (typeof item === "string" && item.length < 10240) {
if (currentString === void 0) {
currentString = item;
} else {
currentString += item;
if (currentString.length > 102400) {
update.push(Buffer.from(currentString));
currentString = void 0;
}
}
} else {
if (currentString !== void 0) {
update.push(Buffer.from(currentString));
currentString = void 0;
}
update.push(item);
}
}
};
this.original().updateHash(tracker);
if (currentString !== void 0) {
update.push(Buffer.from(currentString));
}
for (const item of update) hash.update(item);
this._cachedHashUpdate = update;
}
};
module2.exports = CachedSource;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/ConcatSource.js
var require_ConcatSource = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/ConcatSource.js"(exports2, module2) {
"use strict";
var Source = require_Source();
var RawSource = require_RawSource();
var streamChunks = require_streamChunks();
var { getMap, getSourceAndMap } = require_getFromStreamChunks();
var stringsAsRawSources = /* @__PURE__ */ new WeakSet();
var ConcatSource3 = class _ConcatSource extends Source {
constructor() {
super();
this._children = [];
for (let i = 0; i < arguments.length; i++) {
const item = arguments[i];
if (item instanceof _ConcatSource) {
for (const child of item._children) {
this._children.push(child);
}
} else {
this._children.push(item);
}
}
this._isOptimized = arguments.length === 0;
}
getChildren() {
if (!this._isOptimized) this._optimize();
return this._children;
}
add(item) {
if (item instanceof _ConcatSource) {
for (const child of item._children) {
this._children.push(child);
}
} else {
this._children.push(item);
}
this._isOptimized = false;
}
addAllSkipOptimizing(items) {
for (const item of items) {
this._children.push(item);
}
}
buffer() {
if (!this._isOptimized) this._optimize();
const buffers = [];
for (const child of this._children) {
if (typeof child.buffer === "function") {
buffers.push(child.buffer());
} else {
const bufferOrString = child.source();
if (Buffer.isBuffer(bufferOrString)) {
buffers.push(bufferOrString);
} else {
buffers.push(Buffer.from(bufferOrString, "utf-8"));
}
}
}
return Buffer.concat(buffers);
}
source() {
if (!this._isOptimized) this._optimize();
let source = "";
for (const child of this._children) {
source += child.source();
}
return source;
}
size() {
if (!this._isOptimized) this._optimize();
let size = 0;
for (const child of this._children) {
size += child.size();
}
return size;
}
map(options) {
return getMap(this, options);
}
sourceAndMap(options) {
return getSourceAndMap(this, options);
}
streamChunks(options, onChunk, onSource, onName) {
if (!this._isOptimized) this._optimize();
if (this._children.length === 1)
return this._children[0].streamChunks(options, onChunk, onSource, onName);
let currentLineOffset = 0;
let currentColumnOffset = 0;
let sourceMapping = /* @__PURE__ */ new Map();
let nameMapping = /* @__PURE__ */ new Map();
const finalSource = !!(options && options.finalSource);
let code = "";
let needToCloseMapping = false;
for (const item of this._children) {
const sourceIndexMapping = [];
const nameIndexMapping = [];
let lastMappingLine = 0;
const { generatedLine, generatedColumn, source } = streamChunks(
item,
options,
// eslint-disable-next-line no-loop-func
(chunk, generatedLine2, generatedColumn2, sourceIndex, originalLine, originalColumn, nameIndex) => {
const line = generatedLine2 + currentLineOffset;
const column = generatedLine2 === 1 ? generatedColumn2 + currentColumnOffset : generatedColumn2;
if (needToCloseMapping) {
if (generatedLine2 !== 1 || generatedColumn2 !== 0) {
onChunk(
void 0,
currentLineOffset + 1,
currentColumnOffset,
-1,
-1,
-1,
-1
);
}
needToCloseMapping = false;
}
const resultSourceIndex = sourceIndex < 0 || sourceIndex >= sourceIndexMapping.length ? -1 : sourceIndexMapping[sourceIndex];
const resultNameIndex = nameIndex < 0 || nameIndex >= nameIndexMapping.length ? -1 : nameIndexMapping[nameIndex];
lastMappingLine = resultSourceIndex < 0 ? 0 : generatedLine2;
if (finalSource) {
if (chunk !== void 0) code += chunk;
if (resultSourceIndex >= 0) {
onChunk(
void 0,
line,
column,
resultSourceIndex,
originalLine,
originalColumn,
resultNameIndex
);
}
} else {
if (resultSourceIndex < 0) {
onChunk(chunk, line, column, -1, -1, -1, -1);
} else {
onChunk(
chunk,
line,
column,
resultSourceIndex,
originalLine,
originalColumn,
resultNameIndex
);
}
}
},
(i, source2, sourceContent) => {
let globalIndex = sourceMapping.get(source2);
if (globalIndex === void 0) {
sourceMapping.set(source2, globalIndex = sourceMapping.size);
onSource(globalIndex, source2, sourceContent);
}
sourceIndexMapping[i] = globalIndex;
},
(i, name) => {
let globalIndex = nameMapping.get(name);
if (globalIndex === void 0) {
nameMapping.set(name, globalIndex = nameMapping.size);
onName(globalIndex, name);
}
nameIndexMapping[i] = globalIndex;
}
);
if (source !== void 0) code += source;
if (needToCloseMapping) {
if (generatedLine !== 1 || generatedColumn !== 0) {
onChunk(
void 0,
currentLineOffset + 1,
currentColumnOffset,
-1,
-1,
-1,
-1
);
needToCloseMapping = false;
}
}
if (generatedLine > 1) {
currentColumnOffset = generatedColumn;
} else {
currentColumnOffset += generatedColumn;
}
needToCloseMapping = needToCloseMapping || finalSource && lastMappingLine === generatedLine;
currentLineOffset += generatedLine - 1;
}
return {
generatedLine: currentLineOffset + 1,
generatedColumn: currentColumnOffset,
source: finalSource ? code : void 0
};
}
updateHash(hash) {
if (!this._isOptimized) this._optimize();
hash.update("ConcatSource");
for (const item of this._children) {
item.updateHash(hash);
}
}
_optimize() {
const newChildren = [];
let currentString = void 0;
let currentRawSources = void 0;
const addStringToRawSources = (string) => {
if (currentRawSources === void 0) {
currentRawSources = string;
} else if (Array.isArray(currentRawSources)) {
currentRawSources.push(string);
} else {
currentRawSources = [
typeof currentRawSources === "string" ? currentRawSources : currentRawSources.source(),
string
];
}
};
const addSourceToRawSources = (source) => {
if (currentRawSources === void 0) {
currentRawSources = source;
} else if (Array.isArray(currentRawSources)) {
currentRawSources.push(source.source());
} else {
currentRawSources = [
typeof currentRawSources === "string" ? currentRawSources : currentRawSources.source(),
source.source()
];
}
};
const mergeRawSources = () => {
if (Array.isArray(currentRawSources)) {
const rawSource = new RawSource(currentRawSources.join(""));
stringsAsRawSources.add(rawSource);
newChildren.push(rawSource);
} else if (typeof currentRawSources === "string") {
const rawSource = new RawSource(currentRawSources);
stringsAsRawSources.add(rawSource);
newChildren.push(rawSource);
} else {
newChildren.push(currentRawSources);
}
};
for (const child of this._children) {
if (typeof child === "string") {
if (currentString === void 0) {
currentString = child;
} else {
currentString += child;
}
} else {
if (currentString !== void 0) {
addStringToRawSources(currentString);
currentString = void 0;
}
if (stringsAsRawSources.has(child)) {
addSourceToRawSources(child);
} else {
if (currentRawSources !== void 0) {
mergeRawSources();
currentRawSources = void 0;
}
newChildren.push(child);
}
}
}
if (currentString !== void 0) {
addStringToRawSources(currentString);
}
if (currentRawSources !== void 0) {
mergeRawSources();
}
this._children = newChildren;
this._isOptimized = true;
}
};
module2.exports = ConcatSource3;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/ReplaceSource.js
var require_ReplaceSource = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/ReplaceSource.js"(exports2, module2) {
"use strict";
var { getMap, getSourceAndMap } = require_getFromStreamChunks();
var streamChunks = require_streamChunks();
var Source = require_Source();
var splitIntoLines = require_splitIntoLines();
var hasStableSort = typeof process === "object" && process.versions && typeof process.versions.v8 === "string" && !/^[0-6]\./.test(process.versions.v8);
var MAX_SOURCE_POSITION = 536870912;
var Replacement = class {
constructor(start, end, content, name) {
this.start = start;
this.end = end;
this.content = content;
this.name = name;
if (!hasStableSort) {
this.index = -1;
}
}
};
var ReplaceSource = class extends Source {
constructor(source, name) {
super();
this._source = source;
this._name = name;
this._replacements = [];
this._isSorted = true;
}
getName() {
return this._name;
}
getReplacements() {
this._sortReplacements();
return this._replacements;
}
replace(start, end, newValue, name) {
if (typeof newValue !== "string")
throw new Error(
"insertion must be a string, but is a " + typeof newValue
);
this._replacements.push(new Replacement(start, end, newValue, name));
this._isSorted = false;
}
insert(pos, newValue, name) {
if (typeof newValue !== "string")
throw new Error(
"insertion must be a string, but is a " + typeof newValue + ": " + newValue
);
this._replacements.push(new Replacement(pos, pos - 1, newValue, name));
this._isSorted = false;
}
source() {
if (this._replacements.length === 0) {
return this._source.source();
}
let current = this._source.source();
let pos = 0;
const result = [];
this._sortReplacements();
for (const replacement of this._replacements) {
const start = Math.floor(replacement.start);
const end = Math.floor(replacement.end + 1);
if (pos < start) {
const offset = start - pos;
result.push(current.slice(0, offset));
current = current.slice(offset);
pos = start;
}
result.push(replacement.content);
if (pos < end) {
const offset = end - pos;
current = current.slice(offset);
pos = end;
}
}
result.push(current);
return result.join("");
}
map(options) {
if (this._replacements.length === 0) {
return this._source.map(options);
}
return getMap(this, options);
}
sourceAndMap(options) {
if (this._replacements.length === 0) {
return this._source.sourceAndMap(options);
}
return getSourceAndMap(this, options);
}
original() {
return this._source;
}
_sortReplacements() {
if (this._isSorted) return;
if (hasStableSort) {
this._replacements.sort(function(a, b) {
const diff1 = a.start - b.start;
if (diff1 !== 0) return diff1;
const diff2 = a.end - b.end;
if (diff2 !== 0) return diff2;
return 0;
});
} else {
this._replacements.forEach((repl, i) => repl.index = i);
this._replacements.sort(function(a, b) {
const diff1 = a.start - b.start;
if (diff1 !== 0) return diff1;
const diff2 = a.end - b.end;
if (diff2 !== 0) return diff2;
return a.index - b.index;
});
}
this._isSorted = true;
}
streamChunks(options, onChunk, onSource, onName) {
this._sortReplacements();
const repls = this._replacements;
let pos = 0;
let i = 0;
let replacmentEnd = -1;
let nextReplacement = i < repls.length ? Math.floor(repls[i].start) : MAX_SOURCE_POSITION;
let generatedLineOffset = 0;
let generatedColumnOffset = 0;
let generatedColumnOffsetLine = 0;
const sourceContents = [];
const nameMapping = /* @__PURE__ */ new Map();
const nameIndexMapping = [];
const checkOriginalContent = (sourceIndex, line2, column, expectedChunk) => {
let content = sourceIndex < sourceContents.length ? sourceContents[sourceIndex] : void 0;
if (content === void 0) return false;
if (typeof content === "string") {
content = splitIntoLines(content);
sourceContents[sourceIndex] = content;
}
const contentLine = line2 <= content.length ? content[line2 - 1] : null;
if (contentLine === null) return false;
return contentLine.slice(column, column + expectedChunk.length) === expectedChunk;
};
let { generatedLine, generatedColumn } = streamChunks(
this._source,
Object.assign({}, options, { finalSource: false }),
(chunk, generatedLine2, generatedColumn2, sourceIndex, originalLine, originalColumn, nameIndex) => {
let chunkPos = 0;
let endPos = pos + chunk.length;
if (replacmentEnd > pos) {
if (replacmentEnd >= endPos) {
const line3 = generatedLine2 + generatedLineOffset;
if (chunk.endsWith("\n")) {
generatedLineOffset--;
if (generatedColumnOffsetLine === line3) {
generatedColumnOffset += generatedColumn2;
}
} else if (generatedColumnOffsetLine === line3) {
generatedColumnOffset -= chunk.length;
} else {
generatedColumnOffset = -chunk.length;
generatedColumnOffsetLine = line3;
}
pos = endPos;
return;
}
chunkPos = replacmentEnd - pos;
if (checkOriginalContent(
sourceIndex,
originalLine,
originalColumn,
chunk.slice(0, chunkPos)
)) {
originalColumn += chunkPos;
}
pos += chunkPos;
const line2 = generatedLine2 + generatedLineOffset;
if (generatedColumnOffsetLine === line2) {
generatedColumnOffset -= chunkPos;
} else {
generatedColumnOffset = -chunkPos;
generatedColumnOffsetLine = line2;
}
generatedColumn2 += chunkPos;
}
if (nextReplacement < endPos) {
do {
let line2 = generatedLine2 + generatedLineOffset;
if (nextReplacement > pos) {
const offset2 = nextReplacement - pos;
const chunkSlice = chunk.slice(chunkPos, chunkPos + offset2);
onChunk(
chunkSlice,
line2,
generatedColumn2 + (line2 === generatedColumnOffsetLine ? generatedColumnOffset : 0),
sourceIndex,
originalLine,
originalColumn,
nameIndex < 0 || nameIndex >= nameIndexMapping.length ? -1 : nameIndexMapping[nameIndex]
);
generatedColumn2 += offset2;
chunkPos += offset2;
pos = nextReplacement;
if (checkOriginalContent(
sourceIndex,
originalLine,
originalColumn,
chunkSlice
)) {
originalColumn += chunkSlice.length;
}
}
const { content, name } = repls[i];
let matches2 = splitIntoLines(content);
let replacementNameIndex = nameIndex;
if (sourceIndex >= 0 && name) {
let globalIndex = nameMapping.get(name);
if (globalIndex === void 0) {
globalIndex = nameMapping.size;
nameMapping.set(name, globalIndex);
onName(globalIndex, name);
}
replacementNameIndex = globalIndex;
}
for (let m = 0; m < matches2.length; m++) {
const contentLine = matches2[m];
onChunk(
contentLine,
line2,
generatedColumn2 + (line2 === generatedColumnOffsetLine ? generatedColumnOffset : 0),
sourceIndex,
originalLine,
originalColumn,
replacementNameIndex
);
replacementNameIndex = -1;
if (m === matches2.length - 1 && !contentLine.endsWith("\n")) {
if (generatedColumnOffsetLine === line2) {
generatedColumnOffset += contentLine.length;
} else {
generatedColumnOffset = contentLine.length;
generatedColumnOffsetLine = line2;
}
} else {
generatedLineOffset++;
line2++;
generatedColumnOffset = -generatedColumn2;
generatedColumnOffsetLine = line2;
}
}
replacmentEnd = Math.max(
replacmentEnd,
Math.floor(repls[i].end + 1)
);
i++;
nextReplacement = i < repls.length ? Math.floor(repls[i].start) : MAX_SOURCE_POSITION;
const offset = chunk.length - endPos + replacmentEnd - chunkPos;
if (offset > 0) {
if (replacmentEnd >= endPos) {
let line4 = generatedLine2 + generatedLineOffset;
if (chunk.endsWith("\n")) {
generatedLineOffset--;
if (generatedColumnOffsetLine === line4) {
generatedColumnOffset += generatedColumn2;
}
} else if (generatedColumnOffsetLine === line4) {
generatedColumnOffset -= chunk.length - chunkPos;
} else {
generatedColumnOffset = chunkPos - chunk.length;
generatedColumnOffsetLine = line4;
}
pos = endPos;
return;
}
const line3 = generatedLine2 + generatedLineOffset;
if (checkOriginalContent(
sourceIndex,
originalLine,
originalColumn,
chunk.slice(chunkPos, chunkPos + offset)
)) {
originalColumn += offset;
}
chunkPos += offset;
pos += offset;
if (generatedColumnOffsetLine === line3) {
generatedColumnOffset -= offset;
} else {
generatedColumnOffset = -offset;
generatedColumnOffsetLine = line3;
}
generatedColumn2 += offset;
}
} while (nextReplacement < endPos);
}
if (chunkPos < chunk.length) {
const chunkSlice = chunkPos === 0 ? chunk : chunk.slice(chunkPos);
const line2 = generatedLine2 + generatedLineOffset;
onChunk(
chunkSlice,
line2,
generatedColumn2 + (line2 === generatedColumnOffsetLine ? generatedColumnOffset : 0),
sourceIndex,
originalLine,
originalColumn,
nameIndex < 0 ? -1 : nameIndexMapping[nameIndex]
);
}
pos = endPos;
},
(sourceIndex, source, sourceContent) => {
while (sourceContents.length < sourceIndex)
sourceContents.push(void 0);
sourceContents[sourceIndex] = sourceContent;
onSource(sourceIndex, source, sourceContent);
},
(nameIndex, name) => {
let globalIndex = nameMapping.get(name);
if (globalIndex === void 0) {
globalIndex = nameMapping.size;
nameMapping.set(name, globalIndex);
onName(globalIndex, name);
}
nameIndexMapping[nameIndex] = globalIndex;
}
);
let remainer = "";
for (; i < repls.length; i++) {
remainer += repls[i].content;
}
let line = generatedLine + generatedLineOffset;
let matches = splitIntoLines(remainer);
for (let m = 0; m < matches.length; m++) {
const contentLine = matches[m];
onChunk(
contentLine,
line,
generatedColumn + (line === generatedColumnOffsetLine ? generatedColumnOffset : 0),
-1,
-1,
-1,
-1
);
if (m === matches.length - 1 && !contentLine.endsWith("\n")) {
if (generatedColumnOffsetLine === line) {
generatedColumnOffset += contentLine.length;
} else {
generatedColumnOffset = contentLine.length;
generatedColumnOffsetLine = line;
}
} else {
generatedLineOffset++;
line++;
generatedColumnOffset = -generatedColumn;
generatedColumnOffsetLine = line;
}
}
return {
generatedLine: line,
generatedColumn: generatedColumn + (line === generatedColumnOffsetLine ? generatedColumnOffset : 0)
};
}
updateHash(hash) {
this._sortReplacements();
hash.update("ReplaceSource");
this._source.updateHash(hash);
hash.update(this._name || "");
for (const repl of this._replacements) {
hash.update(`${repl.start}${repl.end}${repl.content}${repl.name}`);
}
}
};
module2.exports = ReplaceSource;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/PrefixSource.js
var require_PrefixSource = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/PrefixSource.js"(exports2, module2) {
"use strict";
var Source = require_Source();
var RawSource = require_RawSource();
var streamChunks = require_streamChunks();
var { getMap, getSourceAndMap } = require_getFromStreamChunks();
var REPLACE_REGEX = /\n(?=.|\s)/g;
var PrefixSource = class extends Source {
constructor(prefix, source) {
super();
this._source = typeof source === "string" || Buffer.isBuffer(source) ? new RawSource(source, true) : source;
this._prefix = prefix;
}
getPrefix() {
return this._prefix;
}
original() {
return this._source;
}
source() {
const node = this._source.source();
const prefix = this._prefix;
return prefix + node.replace(REPLACE_REGEX, "\n" + prefix);
}
// TODO efficient buffer() implementation
map(options) {
return getMap(this, options);
}
sourceAndMap(options) {
return getSourceAndMap(this, options);
}
streamChunks(options, onChunk, onSource, onName) {
const prefix = this._prefix;
const prefixOffset = prefix.length;
const linesOnly = !!(options && options.columns === false);
const { generatedLine, generatedColumn, source } = streamChunks(
this._source,
options,
(chunk, generatedLine2, generatedColumn2, sourceIndex, originalLine, originalColumn, nameIndex) => {
if (generatedColumn2 !== 0) {
generatedColumn2 += prefixOffset;
} else if (chunk !== void 0) {
if (linesOnly || sourceIndex < 0) {
chunk = prefix + chunk;
} else if (prefixOffset > 0) {
onChunk(prefix, generatedLine2, generatedColumn2, -1, -1, -1, -1);
generatedColumn2 += prefixOffset;
}
} else if (!linesOnly) {
generatedColumn2 += prefixOffset;
}
onChunk(
chunk,
generatedLine2,
generatedColumn2,
sourceIndex,
originalLine,
originalColumn,
nameIndex
);
},
onSource,
onName
);
return {
generatedLine,
generatedColumn: generatedColumn === 0 ? 0 : prefixOffset + generatedColumn,
source: source !== void 0 ? prefix + source.replace(REPLACE_REGEX, "\n" + prefix) : void 0
};
}
updateHash(hash) {
hash.update("PrefixSource");
this._source.updateHash(hash);
hash.update(this._prefix);
}
};
module2.exports = PrefixSource;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/SizeOnlySource.js
var require_SizeOnlySource = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/SizeOnlySource.js"(exports2, module2) {
"use strict";
var Source = require_Source();
var SizeOnlySource = class extends Source {
constructor(size) {
super();
this._size = size;
}
_error() {
return new Error(
"Content and Map of this Source is not available (only size() is supported)"
);
}
size() {
return this._size;
}
source() {
throw this._error();
}
buffer() {
throw this._error();
}
map(options) {
throw this._error();
}
updateHash() {
throw this._error();
}
};
module2.exports = SizeOnlySource;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/CompatSource.js
var require_CompatSource = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/CompatSource.js"(exports2, module2) {
"use strict";
var Source = require_Source();
var CompatSource = class _CompatSource extends Source {
static from(sourceLike) {
return sourceLike instanceof Source ? sourceLike : new _CompatSource(sourceLike);
}
constructor(sourceLike) {
super();
this._sourceLike = sourceLike;
}
source() {
return this._sourceLike.source();
}
buffer() {
if (typeof this._sourceLike.buffer === "function") {
return this._sourceLike.buffer();
}
return super.buffer();
}
size() {
if (typeof this._sourceLike.size === "function") {
return this._sourceLike.size();
}
return super.size();
}
map(options) {
if (typeof this._sourceLike.map === "function") {
return this._sourceLike.map(options);
}
return super.map(options);
}
sourceAndMap(options) {
if (typeof this._sourceLike.sourceAndMap === "function") {
return this._sourceLike.sourceAndMap(options);
}
return super.sourceAndMap(options);
}
updateHash(hash) {
if (typeof this._sourceLike.updateHash === "function") {
return this._sourceLike.updateHash(hash);
}
if (typeof this._sourceLike.map === "function") {
throw new Error(
"A Source-like object with a 'map' method must also provide an 'updateHash' method"
);
}
hash.update(this.buffer());
}
};
module2.exports = CompatSource;
}
});
// ../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/index.js
var require_lib3 = __commonJS({
"../../node_modules/.pnpm/webpack-sources@3.2.3/node_modules/webpack-sources/lib/index.js"(exports2) {
var defineExport = (name, fn) => {
let value;
Object.defineProperty(exports2, name, {
get: () => {
if (fn !== void 0) {
value = fn();
fn = void 0;
}
return value;
},
configurable: true
});
};
defineExport("Source", () => require_Source());
defineExport("RawSource", () => require_RawSource());
defineExport("OriginalSource", () => require_OriginalSource());
defineExport("SourceMapSource", () => require_SourceMapSource());
defineExport("CachedSource", () => require_CachedSource());
defineExport("ConcatSource", () => require_ConcatSource());
defineExport("ReplaceSource", () => require_ReplaceSource());
defineExport("PrefixSource", () => require_PrefixSource());
defineExport("SizeOnlySource", () => require_SizeOnlySource());
defineExport("CompatSource", () => require_CompatSource());
}
});
// ../../node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js
var require_safe_buffer = __commonJS({
"../../node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js"(exports2, module2) {
var buffer = require("buffer");
var Buffer2 = buffer.Buffer;
function copyProps(src, dst) {
for (var key in src) {
dst[key] = src[key];
}
}
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
module2.exports = buffer;
} else {
copyProps(buffer, exports2);
exports2.Buffer = SafeBuffer;
}
function SafeBuffer(arg, encodingOrOffset, length) {
return Buffer2(arg, encodingOrOffset, length);
}
copyProps(Buffer2, SafeBuffer);
SafeBuffer.from = function(arg, encodingOrOffset, length) {
if (typeof arg === "number") {
throw new TypeError("Argument must not be a number");
}
return Buffer2(arg, encodingOrOffset, length);
};
SafeBuffer.alloc = function(size, fill, encoding) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
var buf = Buffer2(size);
if (fill !== void 0) {
if (typeof encoding === "string") {
buf.fill(fill, encoding);
} else {
buf.fill(fill);
}
} else {
buf.fill(0);
}
return buf;
};
SafeBuffer.allocUnsafe = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return Buffer2(size);
};
SafeBuffer.allocUnsafeSlow = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return buffer.SlowBuffer(size);
};
}
});
// ../../node_modules/.pnpm/convert-source-map@1.8.0/node_modules/convert-source-map/index.js
var require_convert_source_map = __commonJS({
"../../node_modules/.pnpm/convert-source-map@1.8.0/node_modules/convert-source-map/index.js"(exports2) {
"use strict";
var fs4 = require("fs");
var path3 = require("path");
var SafeBuffer = require_safe_buffer();
Object.defineProperty(exports2, "commentRegex", {
get: function getCommentRegex() {
return /^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/mg;
}
});
Object.defineProperty(exports2, "mapFileCommentRegex", {
get: function getMapFileCommentRegex() {
return /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg;
}
});
function decodeBase64(base64) {
return (SafeBuffer.Buffer.from(base64, "base64") || "").toString();
}
function stripComment(sm) {
return sm.split(",").pop();
}
function readFromFileMap(sm, dir) {
var r = exports2.mapFileCommentRegex.exec(sm);
var filename = r[1] || r[2];
var filepath = path3.resolve(dir, filename);
try {
return fs4.readFileSync(filepath, "utf8");
} catch (e) {
throw new Error("An error occurred while trying to read the map file at " + filepath + "\n" + e);
}
}
function Converter(sm, opts) {
opts = opts || {};
if (opts.isFileComment) sm = readFromFileMap(sm, opts.commentFileDir);
if (opts.hasComment) sm = stripComment(sm);
if (opts.isEncoded) sm = decodeBase64(sm);
if (opts.isJSON || opts.isEncoded) sm = JSON.parse(sm);
this.sourcemap = sm;
}
Converter.prototype.toJSON = function(space) {
return JSON.stringify(this.sourcemap, null, space);
};
Converter.prototype.toBase64 = function() {
var json = this.toJSON();
return (SafeBuffer.Buffer.from(json, "utf8") || "").toString("base64");
};
Converter.prototype.toComment = function(options) {
var base64 = this.toBase64();
var data = "sourceMappingURL=data:application/json;charset=utf-8;base64," + base64;
return options && options.multiline ? "/*# " + data + " */" : "//# " + data;
};
Converter.prototype.toObject = function() {
return JSON.parse(this.toJSON());
};
Converter.prototype.addProperty = function(key, value) {
if (this.sourcemap.hasOwnProperty(key)) throw new Error('property "' + key + '" already exists on the sourcemap, use set property instead');
return this.setProperty(key, value);
};
Converter.prototype.setProperty = function(key, value) {
this.sourcemap[key] = value;
return this;
};
Converter.prototype.getProperty = function(key) {
return this.sourcemap[key];
};
exports2.fromObject = function(obj) {
return new Converter(obj);
};
exports2.fromJSON = function(json) {
return new Converter(json, { isJSON: true });
};
exports2.fromBase64 = function(base64) {
return new Converter(base64, { isEncoded: true });
};
exports2.fromComment = function(comment) {
comment = comment.replace(/^\/\*/g, "//").replace(/\*\/$/g, "");
return new Converter(comment, { isEncoded: true, hasComment: true });
};
exports2.fromMapFileComment = function(comment, dir) {
return new Converter(comment, { commentFileDir: dir, isFileComment: true, isJSON: true });
};
exports2.fromSource = function(content) {
var m = content.match(exports2.commentRegex);
return m ? exports2.fromComment(m.pop()) : null;
};
exports2.fromMapFileSource = function(content, dir) {
var m = content.match(exports2.mapFileCommentRegex);
return m ? exports2.fromMapFileComment(m.pop(), dir) : null;
};
exports2.removeComments = function(src) {
return src.replace(exports2.commentRegex, "");
};
exports2.removeMapFileComments = function(src) {
return src.replace(exports2.mapFileCommentRegex, "");
};
exports2.generateMapFileComment = function(file, options) {
var data = "sourceMappingURL=" + file;
return options && options.multiline ? "/*# " + data + " */" : "//# " + data;
};
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64.js
var require_base64 = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64.js"(exports2) {
var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
exports2.encode = function(number) {
if (0 <= number && number < intToCharMap.length) {
return intToCharMap[number];
}
throw new TypeError("Must be between 0 and 63: " + number);
};
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64-vlq.js
var require_base64_vlq = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/base64-vlq.js"(exports2) {
var base64 = require_base64();
var VLQ_BASE_SHIFT = 5;
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
var VLQ_BASE_MASK = VLQ_BASE - 1;
var VLQ_CONTINUATION_BIT = VLQ_BASE;
function toVLQSigned(aValue) {
return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
}
exports2.encode = function base64VLQ_encode(aValue) {
let encoded = "";
let digit;
let vlq = toVLQSigned(aValue);
do {
digit = vlq & VLQ_BASE_MASK;
vlq >>>= VLQ_BASE_SHIFT;
if (vlq > 0) {
digit |= VLQ_CONTINUATION_BIT;
}
encoded += base64.encode(digit);
} while (vlq > 0);
return encoded;
};
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/util.js
var require_util = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/util.js"(exports2) {
function getArg(aArgs, aName, aDefaultValue) {
if (aName in aArgs) {
return aArgs[aName];
} else if (arguments.length === 3) {
return aDefaultValue;
}
throw new Error('"' + aName + '" is a required argument.');
}
exports2.getArg = getArg;
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
var dataUrlRegexp = /^data:.+\,.+$/;
function urlParse(aUrl) {
const match = aUrl.match(urlRegexp);
if (!match) {
return null;
}
return {
scheme: match[1],
auth: match[2],
host: match[3],
port: match[4],
path: match[5]
};
}
exports2.urlParse = urlParse;
function urlGenerate(aParsedUrl) {
let url = "";
if (aParsedUrl.scheme) {
url += aParsedUrl.scheme + ":";
}
url += "//";
if (aParsedUrl.auth) {
url += aParsedUrl.auth + "@";
}
if (aParsedUrl.host) {
url += aParsedUrl.host;
}
if (aParsedUrl.port) {
url += ":" + aParsedUrl.port;
}
if (aParsedUrl.path) {
url += aParsedUrl.path;
}
return url;
}
exports2.urlGenerate = urlGenerate;
var MAX_CACHED_INPUTS = 32;
function lruMemoize(f) {
const cache = [];
return function(input) {
for (let i = 0; i < cache.length; i++) {
if (cache[i].input === input) {
const temp = cache[0];
cache[0] = cache[i];
cache[i] = temp;
return cache[0].result;
}
}
const result = f(input);
cache.unshift({
input,
result
});
if (cache.length > MAX_CACHED_INPUTS) {
cache.pop();
}
return result;
};
}
var normalize = lruMemoize(function normalize2(aPath) {
let path3 = aPath;
const url = urlParse(aPath);
if (url) {
if (!url.path) {
return aPath;
}
path3 = url.path;
}
const isAbsolute = exports2.isAbsolute(path3);
const parts = [];
let start = 0;
let i = 0;
while (true) {
start = i;
i = path3.indexOf("/", start);
if (i === -1) {
parts.push(path3.slice(start));
break;
} else {
parts.push(path3.slice(start, i));
while (i < path3.length && path3[i] === "/") {
i++;
}
}
}
let up = 0;
for (i = parts.length - 1; i >= 0; i--) {
const part = parts[i];
if (part === ".") {
parts.splice(i, 1);
} else if (part === "..") {
up++;
} else if (up > 0) {
if (part === "") {
parts.splice(i + 1, up);
up = 0;
} else {
parts.splice(i, 2);
up--;
}
}
}
path3 = parts.join("/");
if (path3 === "") {
path3 = isAbsolute ? "/" : ".";
}
if (url) {
url.path = path3;
return urlGenerate(url);
}
return path3;
});
exports2.normalize = normalize;
function join2(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
if (aPath === "") {
aPath = ".";
}
const aPathUrl = urlParse(aPath);
const aRootUrl = urlParse(aRoot);
if (aRootUrl) {
aRoot = aRootUrl.path || "/";
}
if (aPathUrl && !aPathUrl.scheme) {
if (aRootUrl) {
aPathUrl.scheme = aRootUrl.scheme;
}
return urlGenerate(aPathUrl);
}
if (aPathUrl || aPath.match(dataUrlRegexp)) {
return aPath;
}
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
aRootUrl.host = aPath;
return urlGenerate(aRootUrl);
}
const joined = aPath.charAt(0) === "/" ? aPath : normalize(aRoot.replace(/\/+$/, "") + "/" + aPath);
if (aRootUrl) {
aRootUrl.path = joined;
return urlGenerate(aRootUrl);
}
return joined;
}
exports2.join = join2;
exports2.isAbsolute = function(aPath) {
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
};
function relative(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
aRoot = aRoot.replace(/\/$/, "");
let level = 0;
while (aPath.indexOf(aRoot + "/") !== 0) {
const index = aRoot.lastIndexOf("/");
if (index < 0) {
return aPath;
}
aRoot = aRoot.slice(0, index);
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
return aPath;
}
++level;
}
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
}
exports2.relative = relative;
var supportsNullProto = (function() {
const obj = /* @__PURE__ */ Object.create(null);
return !("__proto__" in obj);
})();
function identity(s) {
return s;
}
function toSetString(aStr) {
if (isProtoString(aStr)) {
return "$" + aStr;
}
return aStr;
}
exports2.toSetString = supportsNullProto ? identity : toSetString;
function fromSetString(aStr) {
if (isProtoString(aStr)) {
return aStr.slice(1);
}
return aStr;
}
exports2.fromSetString = supportsNullProto ? identity : fromSetString;
function isProtoString(s) {
if (!s) {
return false;
}
const length = s.length;
if (length < 9) {
return false;
}
if (s.charCodeAt(length - 1) !== 95 || s.charCodeAt(length - 2) !== 95 || s.charCodeAt(length - 3) !== 111 || s.charCodeAt(length - 4) !== 116 || s.charCodeAt(length - 5) !== 111 || s.charCodeAt(length - 6) !== 114 || s.charCodeAt(length - 7) !== 112 || s.charCodeAt(length - 8) !== 95 || s.charCodeAt(length - 9) !== 95) {
return false;
}
for (let i = length - 10; i >= 0; i--) {
if (s.charCodeAt(i) !== 36) {
return false;
}
}
return true;
}
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
let cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0 || onlyCompareOriginal) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports2.compareByOriginalPositions = compareByOriginalPositions;
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
let cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0 || onlyCompareGenerated) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports2.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
function strcmp(aStr1, aStr2) {
if (aStr1 === aStr2) {
return 0;
}
if (aStr1 === null) {
return 1;
}
if (aStr2 === null) {
return -1;
}
if (aStr1 > aStr2) {
return 1;
}
return -1;
}
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
let cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports2.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
function parseSourceMapInput(str) {
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
}
exports2.parseSourceMapInput = parseSourceMapInput;
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
sourceURL = sourceURL || "";
if (sourceRoot) {
if (sourceRoot[sourceRoot.length - 1] !== "/" && sourceURL[0] !== "/") {
sourceRoot += "/";
}
sourceURL = sourceRoot + sourceURL;
}
if (sourceMapURL) {
const parsed = urlParse(sourceMapURL);
if (!parsed) {
throw new Error("sourceMapURL could not be parsed");
}
if (parsed.path) {
const index = parsed.path.lastIndexOf("/");
if (index >= 0) {
parsed.path = parsed.path.substring(0, index + 1);
}
}
sourceURL = join2(urlGenerate(parsed), sourceURL);
}
return normalize(sourceURL);
}
exports2.computeSourceURL = computeSourceURL;
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/array-set.js
var require_array_set = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/array-set.js"(exports2) {
var ArraySet = class _ArraySet {
constructor() {
this._array = [];
this._set = /* @__PURE__ */ new Map();
}
/**
* Static method for creating ArraySet instances from an existing array.
*/
static fromArray(aArray, aAllowDuplicates) {
const set = new _ArraySet();
for (let i = 0, len = aArray.length; i < len; i++) {
set.add(aArray[i], aAllowDuplicates);
}
return set;
}
/**
* Return how many unique items are in this ArraySet. If duplicates have been
* added, than those do not count towards the size.
*
* @returns Number
*/
size() {
return this._set.size;
}
/**
* Add the given string to this set.
*
* @param String aStr
*/
add(aStr, aAllowDuplicates) {
const isDuplicate = this.has(aStr);
const idx = this._array.length;
if (!isDuplicate || aAllowDuplicates) {
this._array.push(aStr);
}
if (!isDuplicate) {
this._set.set(aStr, idx);
}
}
/**
* Is the given string a member of this set?
*
* @param String aStr
*/
has(aStr) {
return this._set.has(aStr);
}
/**
* What is the index of the given string in the array?
*
* @param String aStr
*/
indexOf(aStr) {
const idx = this._set.get(aStr);
if (idx >= 0) {
return idx;
}
throw new Error('"' + aStr + '" is not in the set.');
}
/**
* What is the element at the given index?
*
* @param Number aIdx
*/
at(aIdx) {
if (aIdx >= 0 && aIdx < this._array.length) {
return this._array[aIdx];
}
throw new Error("No element indexed by " + aIdx);
}
/**
* Returns the array representation of this set (which has the proper indices
* indicated by indexOf). Note that this is a copy of the internal array used
* for storing the members so that no one can mess with internal state.
*/
toArray() {
return this._array.slice();
}
};
exports2.ArraySet = ArraySet;
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/mapping-list.js
var require_mapping_list = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/mapping-list.js"(exports2) {
var util = require_util();
function generatedPositionAfter(mappingA, mappingB) {
const lineA = mappingA.generatedLine;
const lineB = mappingB.generatedLine;
const columnA = mappingA.generatedColumn;
const columnB = mappingB.generatedColumn;
return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
}
var MappingList = class {
constructor() {
this._array = [];
this._sorted = true;
this._last = { generatedLine: -1, generatedColumn: 0 };
}
/**
* Iterate through internal items. This method takes the same arguments that
* `Array.prototype.forEach` takes.
*
* NOTE: The order of the mappings is NOT guaranteed.
*/
unsortedForEach(aCallback, aThisArg) {
this._array.forEach(aCallback, aThisArg);
}
/**
* Add the given source mapping.
*
* @param Object aMapping
*/
add(aMapping) {
if (generatedPositionAfter(this._last, aMapping)) {
this._last = aMapping;
this._array.push(aMapping);
} else {
this._sorted = false;
this._array.push(aMapping);
}
}
/**
* Returns the flat, sorted array of mappings. The mappings are sorted by
* generated position.
*
* WARNING: This method returns internal data without copying, for
* performance. The return value must NOT be mutated, and should be treated as
* an immutable borrow. If you want to take ownership, you must make your own
* copy.
*/
toArray() {
if (!this._sorted) {
this._array.sort(util.compareByGeneratedPositionsInflated);
this._sorted = true;
}
return this._array;
}
};
exports2.MappingList = MappingList;
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-generator.js
var require_source_map_generator = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-generator.js"(exports2) {
var base64VLQ = require_base64_vlq();
var util = require_util();
var ArraySet = require_array_set().ArraySet;
var MappingList = require_mapping_list().MappingList;
var SourceMapGenerator2 = class _SourceMapGenerator {
constructor(aArgs) {
if (!aArgs) {
aArgs = {};
}
this._file = util.getArg(aArgs, "file", null);
this._sourceRoot = util.getArg(aArgs, "sourceRoot", null);
this._skipValidation = util.getArg(aArgs, "skipValidation", false);
this._sources = new ArraySet();
this._names = new ArraySet();
this._mappings = new MappingList();
this._sourcesContents = null;
}
/**
* Creates a new SourceMapGenerator based on a SourceMapConsumer
*
* @param aSourceMapConsumer The SourceMap.
*/
static fromSourceMap(aSourceMapConsumer) {
const sourceRoot = aSourceMapConsumer.sourceRoot;
const generator = new _SourceMapGenerator({
file: aSourceMapConsumer.file,
sourceRoot
});
aSourceMapConsumer.eachMapping(function(mapping) {
const newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn
}
};
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = util.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn
};
if (mapping.name != null) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function(sourceFile) {
let sourceRelative = sourceFile;
if (sourceRoot !== null) {
sourceRelative = util.relative(sourceRoot, sourceFile);
}
if (!generator._sources.has(sourceRelative)) {
generator._sources.add(sourceRelative);
}
const content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
}
/**
* Add a single mapping from original source line and column to the generated
* source's line and column for this source map being created. The mapping
* object should have the following properties:
*
* - generated: An object with the generated line and column positions.
* - original: An object with the original line and column positions.
* - source: The original source file (relative to the sourceRoot).
* - name: An optional original token name for this mapping.
*/
addMapping(aArgs) {
const generated = util.getArg(aArgs, "generated");
const original = util.getArg(aArgs, "original", null);
let source = util.getArg(aArgs, "source", null);
let name = util.getArg(aArgs, "name", null);
if (!this._skipValidation) {
this._validateMapping(generated, original, source, name);
}
if (source != null) {
source = String(source);
if (!this._sources.has(source)) {
this._sources.add(source);
}
}
if (name != null) {
name = String(name);
if (!this._names.has(name)) {
this._names.add(name);
}
}
this._mappings.add({
generatedLine: generated.line,
generatedColumn: generated.column,
originalLine: original != null && original.line,
originalColumn: original != null && original.column,
source,
name
});
}
/**
* Set the source content for a source file.
*/
setSourceContent(aSourceFile, aSourceContent) {
let source = aSourceFile;
if (this._sourceRoot != null) {
source = util.relative(this._sourceRoot, source);
}
if (aSourceContent != null) {
if (!this._sourcesContents) {
this._sourcesContents = /* @__PURE__ */ Object.create(null);
}
this._sourcesContents[util.toSetString(source)] = aSourceContent;
} else if (this._sourcesContents) {
delete this._sourcesContents[util.toSetString(source)];
if (Object.keys(this._sourcesContents).length === 0) {
this._sourcesContents = null;
}
}
}
/**
* Applies the mappings of a sub-source-map for a specific source file to the
* source map being generated. Each mapping to the supplied source file is
* rewritten using the supplied source map. Note: The resolution for the
* resulting mappings is the minimium of this map and the supplied map.
*
* @param aSourceMapConsumer The source map to be applied.
* @param aSourceFile Optional. The filename of the source file.
* If omitted, SourceMapConsumer's file property will be used.
* @param aSourceMapPath Optional. The dirname of the path to the source map
* to be applied. If relative, it is relative to the SourceMapConsumer.
* This parameter is needed when the two source maps aren't in the same
* directory, and the source map to be applied contains relative source
* paths. If so, those relative source paths need to be rewritten
* relative to the SourceMapGenerator.
*/
applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
let sourceFile = aSourceFile;
if (aSourceFile == null) {
if (aSourceMapConsumer.file == null) {
throw new Error(
`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`
);
}
sourceFile = aSourceMapConsumer.file;
}
const sourceRoot = this._sourceRoot;
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
const newSources = this._mappings.toArray().length > 0 ? new ArraySet() : this._sources;
const newNames = new ArraySet();
this._mappings.unsortedForEach(function(mapping) {
if (mapping.source === sourceFile && mapping.originalLine != null) {
const original = aSourceMapConsumer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn
});
if (original.source != null) {
mapping.source = original.source;
if (aSourceMapPath != null) {
mapping.source = util.join(aSourceMapPath, mapping.source);
}
if (sourceRoot != null) {
mapping.source = util.relative(sourceRoot, mapping.source);
}
mapping.originalLine = original.line;
mapping.originalColumn = original.column;
if (original.name != null) {
mapping.name = original.name;
}
}
}
const source = mapping.source;
if (source != null && !newSources.has(source)) {
newSources.add(source);
}
const name = mapping.name;
if (name != null && !newNames.has(name)) {
newNames.add(name);
}
}, this);
this._sources = newSources;
this._names = newNames;
aSourceMapConsumer.sources.forEach(function(srcFile) {
const content = aSourceMapConsumer.sourceContentFor(srcFile);
if (content != null) {
if (aSourceMapPath != null) {
srcFile = util.join(aSourceMapPath, srcFile);
}
if (sourceRoot != null) {
srcFile = util.relative(sourceRoot, srcFile);
}
this.setSourceContent(srcFile, content);
}
}, this);
}
/**
* A mapping can have one of the three levels of data:
*
* 1. Just the generated position.
* 2. The Generated position, original position, and original source.
* 3. Generated and original position, original source, as well as a name
* token.
*
* To maintain consistency, we validate that any new mapping being added falls
* in to one of these categories.
*/
_validateMapping(aGenerated, aOriginal, aSource, aName) {
if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
throw new Error(
"original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values."
);
}
if (aGenerated && "line" in aGenerated && "column" in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
} else if (aGenerated && "line" in aGenerated && "column" in aGenerated && aOriginal && "line" in aOriginal && "column" in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
} else {
throw new Error("Invalid mapping: " + JSON.stringify({
generated: aGenerated,
source: aSource,
original: aOriginal,
name: aName
}));
}
}
/**
* Serialize the accumulated mappings in to the stream of base 64 VLQs
* specified by the source map format.
*/
_serializeMappings() {
let previousGeneratedColumn = 0;
let previousGeneratedLine = 1;
let previousOriginalColumn = 0;
let previousOriginalLine = 0;
let previousName = 0;
let previousSource = 0;
let result = "";
let next;
let mapping;
let nameIdx;
let sourceIdx;
const mappings = this._mappings.toArray();
for (let i = 0, len = mappings.length; i < len; i++) {
mapping = mappings[i];
next = "";
if (mapping.generatedLine !== previousGeneratedLine) {
previousGeneratedColumn = 0;
while (mapping.generatedLine !== previousGeneratedLine) {
next += ";";
previousGeneratedLine++;
}
} else if (i > 0) {
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
continue;
}
next += ",";
}
next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
previousGeneratedColumn = mapping.generatedColumn;
if (mapping.source != null) {
sourceIdx = this._sources.indexOf(mapping.source);
next += base64VLQ.encode(sourceIdx - previousSource);
previousSource = sourceIdx;
next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
previousOriginalLine = mapping.originalLine - 1;
next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
previousOriginalColumn = mapping.originalColumn;
if (mapping.name != null) {
nameIdx = this._names.indexOf(mapping.name);
next += base64VLQ.encode(nameIdx - previousName);
previousName = nameIdx;
}
}
result += next;
}
return result;
}
_generateSourcesContent(aSources, aSourceRoot) {
return aSources.map(function(source) {
if (!this._sourcesContents) {
return null;
}
if (aSourceRoot != null) {
source = util.relative(aSourceRoot, source);
}
const key = util.toSetString(source);
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
}, this);
}
/**
* Externalize the source map.
*/
toJSON() {
const map = {
version: this._version,
sources: this._sources.toArray(),
names: this._names.toArray(),
mappings: this._serializeMappings()
};
if (this._file != null) {
map.file = this._file;
}
if (this._sourceRoot != null) {
map.sourceRoot = this._sourceRoot;
}
if (this._sourcesContents) {
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
}
return map;
}
/**
* Render the source map being generated to a string.
*/
toString() {
return JSON.stringify(this.toJSON());
}
};
SourceMapGenerator2.prototype._version = 3;
exports2.SourceMapGenerator = SourceMapGenerator2;
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/binary-search.js
var require_binary_search = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/binary-search.js"(exports2) {
exports2.GREATEST_LOWER_BOUND = 1;
exports2.LEAST_UPPER_BOUND = 2;
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
const mid = Math.floor((aHigh - aLow) / 2) + aLow;
const cmp = aCompare(aNeedle, aHaystack[mid], true);
if (cmp === 0) {
return mid;
} else if (cmp > 0) {
if (aHigh - mid > 1) {
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
}
if (aBias == exports2.LEAST_UPPER_BOUND) {
return aHigh < aHaystack.length ? aHigh : -1;
}
return mid;
}
if (mid - aLow > 1) {
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
}
if (aBias == exports2.LEAST_UPPER_BOUND) {
return mid;
}
return aLow < 0 ? -1 : aLow;
}
exports2.search = function search(aNeedle, aHaystack, aCompare, aBias) {
if (aHaystack.length === 0) {
return -1;
}
let index = recursiveSearch(
-1,
aHaystack.length,
aNeedle,
aHaystack,
aCompare,
aBias || exports2.GREATEST_LOWER_BOUND
);
if (index < 0) {
return -1;
}
while (index - 1 >= 0) {
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
break;
}
--index;
}
return index;
};
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/read-wasm.js
var require_read_wasm = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/read-wasm.js"(exports2, module2) {
var isBrowserEnvironment = (function() {
return typeof window !== "undefined" && this === window;
}).call();
if (isBrowserEnvironment) {
let mappingsWasm = null;
module2.exports = function readWasm() {
if (typeof mappingsWasm === "string") {
return fetch(mappingsWasm).then((response) => response.arrayBuffer());
}
if (mappingsWasm instanceof ArrayBuffer) {
return Promise.resolve(mappingsWasm);
}
throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer");
};
module2.exports.initialize = (input) => mappingsWasm = input;
} else {
const fs4 = require("fs");
const path3 = require("path");
module2.exports = function readWasm() {
return new Promise((resolve, reject) => {
const wasmPath = path3.join(__dirname, "mappings.wasm");
fs4.readFile(wasmPath, null, (error, data) => {
if (error) {
reject(error);
return;
}
resolve(data.buffer);
});
});
};
module2.exports.initialize = (_) => {
console.debug("SourceMapConsumer.initialize is a no-op when running in node.js");
};
}
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/wasm.js
var require_wasm = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/wasm.js"(exports2, module2) {
var readWasm = require_read_wasm();
function Mapping() {
this.generatedLine = 0;
this.generatedColumn = 0;
this.lastGeneratedColumn = null;
this.source = null;
this.originalLine = null;
this.originalColumn = null;
this.name = null;
}
var cachedWasm = null;
module2.exports = function wasm() {
if (cachedWasm) {
return cachedWasm;
}
const callbackStack = [];
cachedWasm = readWasm().then((buffer) => {
return WebAssembly.instantiate(buffer, {
env: {
mapping_callback(generatedLine, generatedColumn, hasLastGeneratedColumn, lastGeneratedColumn, hasOriginal, source, originalLine, originalColumn, hasName, name) {
const mapping = new Mapping();
mapping.generatedLine = generatedLine + 1;
mapping.generatedColumn = generatedColumn;
if (hasLastGeneratedColumn) {
mapping.lastGeneratedColumn = lastGeneratedColumn - 1;
}
if (hasOriginal) {
mapping.source = source;
mapping.originalLine = originalLine + 1;
mapping.originalColumn = originalColumn;
if (hasName) {
mapping.name = name;
}
}
callbackStack[callbackStack.length - 1](mapping);
},
start_all_generated_locations_for() {
console.time("all_generated_locations_for");
},
end_all_generated_locations_for() {
console.timeEnd("all_generated_locations_for");
},
start_compute_column_spans() {
console.time("compute_column_spans");
},
end_compute_column_spans() {
console.timeEnd("compute_column_spans");
},
start_generated_location_for() {
console.time("generated_location_for");
},
end_generated_location_for() {
console.timeEnd("generated_location_for");
},
start_original_location_for() {
console.time("original_location_for");
},
end_original_location_for() {
console.timeEnd("original_location_for");
},
start_parse_mappings() {
console.time("parse_mappings");
},
end_parse_mappings() {
console.timeEnd("parse_mappings");
},
start_sort_by_generated_location() {
console.time("sort_by_generated_location");
},
end_sort_by_generated_location() {
console.timeEnd("sort_by_generated_location");
},
start_sort_by_original_location() {
console.time("sort_by_original_location");
},
end_sort_by_original_location() {
console.timeEnd("sort_by_original_location");
}
}
});
}).then((Wasm) => {
return {
exports: Wasm.instance.exports,
withMappingCallback: (mappingCallback, f) => {
callbackStack.push(mappingCallback);
try {
f();
} finally {
callbackStack.pop();
}
}
};
}).then(null, (e) => {
cachedWasm = null;
throw e;
});
return cachedWasm;
};
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-consumer.js
var require_source_map_consumer = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-map-consumer.js"(exports2) {
var util = require_util();
var binarySearch = require_binary_search();
var ArraySet = require_array_set().ArraySet;
var base64VLQ = require_base64_vlq();
var readWasm = require_read_wasm();
var wasm = require_wasm();
var INTERNAL = Symbol("smcInternal");
var SourceMapConsumer2 = class _SourceMapConsumer {
constructor(aSourceMap, aSourceMapURL) {
if (aSourceMap == INTERNAL) {
return Promise.resolve(this);
}
return _factory(aSourceMap, aSourceMapURL);
}
static initialize(opts) {
readWasm.initialize(opts["lib/mappings.wasm"]);
}
static fromSourceMap(aSourceMap, aSourceMapURL) {
return _factoryBSM(aSourceMap, aSourceMapURL);
}
/**
* Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl`
* (see the `SourceMapConsumer` constructor for details. Then, invoke the `async
* function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait
* for `f` to complete, call `destroy` on the consumer, and return `f`'s return
* value.
*
* You must not use the consumer after `f` completes!
*
* By using `with`, you do not have to remember to manually call `destroy` on
* the consumer, since it will be called automatically once `f` completes.
*
* ```js
* const xSquared = await SourceMapConsumer.with(
* myRawSourceMap,
* null,
* async function (consumer) {
* // Use `consumer` inside here and don't worry about remembering
* // to call `destroy`.
*
* const x = await whatever(consumer);
* return x * x;
* }
* );
*
* // You may not use that `consumer` anymore out here; it has
* // been destroyed. But you can use `xSquared`.
* console.log(xSquared);
* ```
*/
static async with(rawSourceMap, sourceMapUrl, f) {
const consumer = await new _SourceMapConsumer(rawSourceMap, sourceMapUrl);
try {
return await f(consumer);
} finally {
consumer.destroy();
}
}
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
_parseMappings(aStr, aSourceRoot) {
throw new Error("Subclasses must implement _parseMappings");
}
/**
* Iterate over each mapping between an original source/line/column and a
* generated line/column in this source map.
*
* @param Function aCallback
* The function that is called with each mapping.
* @param Object aContext
* Optional. If specified, this object will be the value of `this` every
* time that `aCallback` is called.
* @param aOrder
* Either `SourceMapConsumer.GENERATED_ORDER` or
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
* iterate over the mappings sorted by the generated file's line/column
* order or the original's source/line/column order, respectively. Defaults to
* `SourceMapConsumer.GENERATED_ORDER`.
*/
eachMapping(aCallback, aContext, aOrder) {
throw new Error("Subclasses must implement eachMapping");
}
/**
* Returns all generated line and column information for the original source,
* line, and column provided. If no column is provided, returns all mappings
* corresponding to a either the line we are searching for or the next
* closest line that has any mappings. Otherwise, returns all mappings
* corresponding to the given line and either the column we are searching for
* or the next closest column that has any offsets.
*
* The only argument is an object with the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source. The line number is 1-based.
* - column: Optional. the column number in the original source.
* The column number is 0-based.
*
* and an array of objects is returned, each with the following properties:
*
* - line: The line number in the generated source, or null. The
* line number is 1-based.
* - column: The column number in the generated source, or null.
* The column number is 0-based.
*/
allGeneratedPositionsFor(aArgs) {
throw new Error("Subclasses must implement allGeneratedPositionsFor");
}
destroy() {
throw new Error("Subclasses must implement destroy");
}
};
SourceMapConsumer2.prototype._version = 3;
SourceMapConsumer2.GENERATED_ORDER = 1;
SourceMapConsumer2.ORIGINAL_ORDER = 2;
SourceMapConsumer2.GREATEST_LOWER_BOUND = 1;
SourceMapConsumer2.LEAST_UPPER_BOUND = 2;
exports2.SourceMapConsumer = SourceMapConsumer2;
var BasicSourceMapConsumer = class _BasicSourceMapConsumer extends SourceMapConsumer2 {
constructor(aSourceMap, aSourceMapURL) {
return super(INTERNAL).then((that) => {
let sourceMap = aSourceMap;
if (typeof aSourceMap === "string") {
sourceMap = util.parseSourceMapInput(aSourceMap);
}
const version = util.getArg(sourceMap, "version");
let sources = util.getArg(sourceMap, "sources");
const names = util.getArg(sourceMap, "names", []);
let sourceRoot = util.getArg(sourceMap, "sourceRoot", null);
const sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
const mappings = util.getArg(sourceMap, "mappings");
const file = util.getArg(sourceMap, "file", null);
if (version != that._version) {
throw new Error("Unsupported version: " + version);
}
if (sourceRoot) {
sourceRoot = util.normalize(sourceRoot);
}
sources = sources.map(String).map(util.normalize).map(function(source) {
return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source;
});
that._names = ArraySet.fromArray(names.map(String), true);
that._sources = ArraySet.fromArray(sources, true);
that._absoluteSources = that._sources.toArray().map(function(s) {
return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
});
that.sourceRoot = sourceRoot;
that.sourcesContent = sourcesContent;
that._mappings = mappings;
that._sourceMapURL = aSourceMapURL;
that.file = file;
that._computedColumnSpans = false;
that._mappingsPtr = 0;
that._wasm = null;
return wasm().then((w) => {
that._wasm = w;
return that;
});
});
}
/**
* Utility function to find the index of a source. Returns -1 if not
* found.
*/
_findSourceIndex(aSource) {
let relativeSource = aSource;
if (this.sourceRoot != null) {
relativeSource = util.relative(this.sourceRoot, relativeSource);
}
if (this._sources.has(relativeSource)) {
return this._sources.indexOf(relativeSource);
}
for (let i = 0; i < this._absoluteSources.length; ++i) {
if (this._absoluteSources[i] == aSource) {
return i;
}
}
return -1;
}
/**
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
*
* @param SourceMapGenerator aSourceMap
* The source map that will be consumed.
* @param String aSourceMapURL
* The URL at which the source map can be found (optional)
* @returns BasicSourceMapConsumer
*/
static fromSourceMap(aSourceMap, aSourceMapURL) {
return new _BasicSourceMapConsumer(aSourceMap.toString());
}
get sources() {
return this._absoluteSources.slice();
}
_getMappingsPtr() {
if (this._mappingsPtr === 0) {
this._parseMappings(this._mappings, this.sourceRoot);
}
return this._mappingsPtr;
}
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
_parseMappings(aStr, aSourceRoot) {
const size = aStr.length;
const mappingsBufPtr = this._wasm.exports.allocate_mappings(size);
const mappingsBuf = new Uint8Array(this._wasm.exports.memory.buffer, mappingsBufPtr, size);
for (let i = 0; i < size; i++) {
mappingsBuf[i] = aStr.charCodeAt(i);
}
const mappingsPtr = this._wasm.exports.parse_mappings(mappingsBufPtr);
if (!mappingsPtr) {
const error = this._wasm.exports.get_last_error();
let msg = `Error parsing mappings (code ${error}): `;
switch (error) {
case 1:
msg += "the mappings contained a negative line, column, source index, or name index";
break;
case 2:
msg += "the mappings contained a number larger than 2**32";
break;
case 3:
msg += "reached EOF while in the middle of parsing a VLQ";
break;
case 4:
msg += "invalid base 64 character while parsing a VLQ";
break;
default:
msg += "unknown error code";
break;
}
throw new Error(msg);
}
this._mappingsPtr = mappingsPtr;
}
eachMapping(aCallback, aContext, aOrder) {
const context = aContext || null;
const order = aOrder || SourceMapConsumer2.GENERATED_ORDER;
const sourceRoot = this.sourceRoot;
this._wasm.withMappingCallback(
(mapping) => {
if (mapping.source !== null) {
mapping.source = this._sources.at(mapping.source);
mapping.source = util.computeSourceURL(sourceRoot, mapping.source, this._sourceMapURL);
if (mapping.name !== null) {
mapping.name = this._names.at(mapping.name);
}
}
aCallback.call(context, mapping);
},
() => {
switch (order) {
case SourceMapConsumer2.GENERATED_ORDER:
this._wasm.exports.by_generated_location(this._getMappingsPtr());
break;
case SourceMapConsumer2.ORIGINAL_ORDER:
this._wasm.exports.by_original_location(this._getMappingsPtr());
break;
default:
throw new Error("Unknown order of iteration.");
}
}
);
}
allGeneratedPositionsFor(aArgs) {
let source = util.getArg(aArgs, "source");
const originalLine = util.getArg(aArgs, "line");
const originalColumn = aArgs.column || 0;
source = this._findSourceIndex(source);
if (source < 0) {
return [];
}
if (originalLine < 1) {
throw new Error("Line numbers must be >= 1");
}
if (originalColumn < 0) {
throw new Error("Column numbers must be >= 0");
}
const mappings = [];
this._wasm.withMappingCallback(
(m) => {
let lastColumn = m.lastGeneratedColumn;
if (this._computedColumnSpans && lastColumn === null) {
lastColumn = Infinity;
}
mappings.push({
line: m.generatedLine,
column: m.generatedColumn,
lastColumn
});
},
() => {
this._wasm.exports.all_generated_locations_for(
this._getMappingsPtr(),
source,
originalLine - 1,
"column" in aArgs,
originalColumn
);
}
);
return mappings;
}
destroy() {
if (this._mappingsPtr !== 0) {
this._wasm.exports.free_mappings(this._mappingsPtr);
this._mappingsPtr = 0;
}
}
/**
* Compute the last column for each generated mapping. The last column is
* inclusive.
*/
computeColumnSpans() {
if (this._computedColumnSpans) {
return;
}
this._wasm.exports.compute_column_spans(this._getMappingsPtr());
this._computedColumnSpans = true;
}
/**
* Returns the original source, line, and column information for the generated
* source's line and column positions provided. The only argument is an object
* with the following properties:
*
* - line: The line number in the generated source. The line number
* is 1-based.
* - column: The column number in the generated source. The column
* number is 0-based.
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
*
* and an object is returned with the following properties:
*
* - source: The original source file, or null.
* - line: The line number in the original source, or null. The
* line number is 1-based.
* - column: The column number in the original source, or null. The
* column number is 0-based.
* - name: The original identifier, or null.
*/
originalPositionFor(aArgs) {
const needle = {
generatedLine: util.getArg(aArgs, "line"),
generatedColumn: util.getArg(aArgs, "column")
};
if (needle.generatedLine < 1) {
throw new Error("Line numbers must be >= 1");
}
if (needle.generatedColumn < 0) {
throw new Error("Column numbers must be >= 0");
}
let bias = util.getArg(aArgs, "bias", SourceMapConsumer2.GREATEST_LOWER_BOUND);
if (bias == null) {
bias = SourceMapConsumer2.GREATEST_LOWER_BOUND;
}
let mapping;
this._wasm.withMappingCallback((m) => mapping = m, () => {
this._wasm.exports.original_location_for(
this._getMappingsPtr(),
needle.generatedLine - 1,
needle.generatedColumn,
bias
);
});
if (mapping) {
if (mapping.generatedLine === needle.generatedLine) {
let source = util.getArg(mapping, "source", null);
if (source !== null) {
source = this._sources.at(source);
source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
}
let name = util.getArg(mapping, "name", null);
if (name !== null) {
name = this._names.at(name);
}
return {
source,
line: util.getArg(mapping, "originalLine", null),
column: util.getArg(mapping, "originalColumn", null),
name
};
}
}
return {
source: null,
line: null,
column: null,
name: null
};
}
/**
* Return true if we have the source content for every source in the source
* map, false otherwise.
*/
hasContentsOfAllSources() {
if (!this.sourcesContent) {
return false;
}
return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(sc) {
return sc == null;
});
}
/**
* Returns the original source content. The only argument is the url of the
* original source file. Returns null if no original source content is
* available.
*/
sourceContentFor(aSource, nullOnMissing) {
if (!this.sourcesContent) {
return null;
}
const index = this._findSourceIndex(aSource);
if (index >= 0) {
return this.sourcesContent[index];
}
let relativeSource = aSource;
if (this.sourceRoot != null) {
relativeSource = util.relative(this.sourceRoot, relativeSource);
}
let url;
if (this.sourceRoot != null && (url = util.urlParse(this.sourceRoot))) {
const fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) {
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
}
if ((!url.path || url.path == "/") && this._sources.has("/" + relativeSource)) {
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
}
}
if (nullOnMissing) {
return null;
}
throw new Error('"' + relativeSource + '" is not in the SourceMap.');
}
/**
* Returns the generated line and column information for the original source,
* line, and column positions provided. The only argument is an object with
* the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source. The line number
* is 1-based.
* - column: The column number in the original source. The column
* number is 0-based.
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
*
* and an object is returned with the following properties:
*
* - line: The line number in the generated source, or null. The
* line number is 1-based.
* - column: The column number in the generated source, or null.
* The column number is 0-based.
*/
generatedPositionFor(aArgs) {
let source = util.getArg(aArgs, "source");
source = this._findSourceIndex(source);
if (source < 0) {
return {
line: null,
column: null,
lastColumn: null
};
}
const needle = {
source,
originalLine: util.getArg(aArgs, "line"),
originalColumn: util.getArg(aArgs, "column")
};
if (needle.originalLine < 1) {
throw new Error("Line numbers must be >= 1");
}
if (needle.originalColumn < 0) {
throw new Error("Column numbers must be >= 0");
}
let bias = util.getArg(aArgs, "bias", SourceMapConsumer2.GREATEST_LOWER_BOUND);
if (bias == null) {
bias = SourceMapConsumer2.GREATEST_LOWER_BOUND;
}
let mapping;
this._wasm.withMappingCallback((m) => mapping = m, () => {
this._wasm.exports.generated_location_for(
this._getMappingsPtr(),
needle.source,
needle.originalLine - 1,
needle.originalColumn,
bias
);
});
if (mapping) {
if (mapping.source === needle.source) {
let lastColumn = mapping.lastGeneratedColumn;
if (this._computedColumnSpans && lastColumn === null) {
lastColumn = Infinity;
}
return {
line: util.getArg(mapping, "generatedLine", null),
column: util.getArg(mapping, "generatedColumn", null),
lastColumn
};
}
}
return {
line: null,
column: null,
lastColumn: null
};
}
};
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer2;
exports2.BasicSourceMapConsumer = BasicSourceMapConsumer;
var IndexedSourceMapConsumer = class extends SourceMapConsumer2 {
constructor(aSourceMap, aSourceMapURL) {
return super(INTERNAL).then((that) => {
let sourceMap = aSourceMap;
if (typeof aSourceMap === "string") {
sourceMap = util.parseSourceMapInput(aSourceMap);
}
const version = util.getArg(sourceMap, "version");
const sections = util.getArg(sourceMap, "sections");
if (version != that._version) {
throw new Error("Unsupported version: " + version);
}
that._sources = new ArraySet();
that._names = new ArraySet();
that.__generatedMappings = null;
that.__originalMappings = null;
that.__generatedMappingsUnsorted = null;
that.__originalMappingsUnsorted = null;
let lastOffset = {
line: -1,
column: 0
};
return Promise.all(sections.map((s) => {
if (s.url) {
throw new Error("Support for url field in sections not implemented.");
}
const offset = util.getArg(s, "offset");
const offsetLine = util.getArg(offset, "line");
const offsetColumn = util.getArg(offset, "column");
if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
throw new Error("Section offsets must be ordered and non-overlapping.");
}
lastOffset = offset;
const cons = new SourceMapConsumer2(util.getArg(s, "map"), aSourceMapURL);
return cons.then((consumer) => {
return {
generatedOffset: {
// The offset fields are 0-based, but we use 1-based indices when
// encoding/decoding from VLQ.
generatedLine: offsetLine + 1,
generatedColumn: offsetColumn + 1
},
consumer
};
});
})).then((s) => {
that._sections = s;
return that;
});
});
}
// `__generatedMappings` and `__originalMappings` are arrays that hold the
// parsed mapping coordinates from the source map's "mappings" attribute. They
// are lazily instantiated, accessed via the `_generatedMappings` and
// `_originalMappings` getters respectively, and we only parse the mappings
// and create these arrays once queried for a source location. We jump through
// these hoops because there can be many thousands of mappings, and parsing
// them is expensive, so we only want to do it if we must.
//
// Each object in the arrays is of the form:
//
// {
// generatedLine: The line number in the generated code,
// generatedColumn: The column number in the generated code,
// source: The path to the original source file that generated this
// chunk of code,
// originalLine: The line number in the original source that
// corresponds to this chunk of generated code,
// originalColumn: The column number in the original source that
// corresponds to this chunk of generated code,
// name: The name of the original symbol which generated this chunk of
// code.
// }
//
// All properties except for `generatedLine` and `generatedColumn` can be
// `null`.
//
// `_generatedMappings` is ordered by the generated positions.
//
// `_originalMappings` is ordered by the original positions.
get _generatedMappings() {
if (!this.__generatedMappings) {
this._sortGeneratedMappings();
}
return this.__generatedMappings;
}
get _originalMappings() {
if (!this.__originalMappings) {
this._sortOriginalMappings();
}
return this.__originalMappings;
}
get _generatedMappingsUnsorted() {
if (!this.__generatedMappingsUnsorted) {
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__generatedMappingsUnsorted;
}
get _originalMappingsUnsorted() {
if (!this.__originalMappingsUnsorted) {
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__originalMappingsUnsorted;
}
_sortGeneratedMappings() {
const mappings = this._generatedMappingsUnsorted;
mappings.sort(util.compareByGeneratedPositionsDeflated);
this.__generatedMappings = mappings;
}
_sortOriginalMappings() {
const mappings = this._originalMappingsUnsorted;
mappings.sort(util.compareByOriginalPositions);
this.__originalMappings = mappings;
}
/**
* The list of original sources.
*/
get sources() {
const sources = [];
for (let i = 0; i < this._sections.length; i++) {
for (let j = 0; j < this._sections[i].consumer.sources.length; j++) {
sources.push(this._sections[i].consumer.sources[j]);
}
}
return sources;
}
/**
* Returns the original source, line, and column information for the generated
* source's line and column positions provided. The only argument is an object
* with the following properties:
*
* - line: The line number in the generated source. The line number
* is 1-based.
* - column: The column number in the generated source. The column
* number is 0-based.
*
* and an object is returned with the following properties:
*
* - source: The original source file, or null.
* - line: The line number in the original source, or null. The
* line number is 1-based.
* - column: The column number in the original source, or null. The
* column number is 0-based.
* - name: The original identifier, or null.
*/
originalPositionFor(aArgs) {
const needle = {
generatedLine: util.getArg(aArgs, "line"),
generatedColumn: util.getArg(aArgs, "column")
};
const sectionIndex = binarySearch.search(
needle,
this._sections,
function(aNeedle, section2) {
const cmp = aNeedle.generatedLine - section2.generatedOffset.generatedLine;
if (cmp) {
return cmp;
}
return aNeedle.generatedColumn - section2.generatedOffset.generatedColumn;
}
);
const section = this._sections[sectionIndex];
if (!section) {
return {
source: null,
line: null,
column: null,
name: null
};
}
return section.consumer.originalPositionFor({
line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
bias: aArgs.bias
});
}
/**
* Return true if we have the source content for every source in the source
* map, false otherwise.
*/
hasContentsOfAllSources() {
return this._sections.every(function(s) {
return s.consumer.hasContentsOfAllSources();
});
}
/**
* Returns the original source content. The only argument is the url of the
* original source file. Returns null if no original source content is
* available.
*/
sourceContentFor(aSource, nullOnMissing) {
for (let i = 0; i < this._sections.length; i++) {
const section = this._sections[i];
const content = section.consumer.sourceContentFor(aSource, true);
if (content) {
return content;
}
}
if (nullOnMissing) {
return null;
}
throw new Error('"' + aSource + '" is not in the SourceMap.');
}
/**
* Returns the generated line and column information for the original source,
* line, and column positions provided. The only argument is an object with
* the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source. The line number
* is 1-based.
* - column: The column number in the original source. The column
* number is 0-based.
*
* and an object is returned with the following properties:
*
* - line: The line number in the generated source, or null. The
* line number is 1-based.
* - column: The column number in the generated source, or null.
* The column number is 0-based.
*/
generatedPositionFor(aArgs) {
for (let i = 0; i < this._sections.length; i++) {
const section = this._sections[i];
if (section.consumer._findSourceIndex(util.getArg(aArgs, "source")) === -1) {
continue;
}
const generatedPosition = section.consumer.generatedPositionFor(aArgs);
if (generatedPosition) {
const ret = {
line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
};
return ret;
}
}
return {
line: null,
column: null
};
}
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
_parseMappings(aStr, aSourceRoot) {
const generatedMappings = this.__generatedMappingsUnsorted = [];
const originalMappings = this.__originalMappingsUnsorted = [];
for (let i = 0; i < this._sections.length; i++) {
const section = this._sections[i];
const sectionMappings = [];
section.consumer.eachMapping((m) => sectionMappings.push(m));
for (let j = 0; j < sectionMappings.length; j++) {
const mapping = sectionMappings[j];
let source = util.computeSourceURL(section.consumer.sourceRoot, null, this._sourceMapURL);
this._sources.add(source);
source = this._sources.indexOf(source);
let name = null;
if (mapping.name) {
this._names.add(mapping.name);
name = this._names.indexOf(mapping.name);
}
const adjustedMapping = {
source,
generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name
};
generatedMappings.push(adjustedMapping);
if (typeof adjustedMapping.originalLine === "number") {
originalMappings.push(adjustedMapping);
}
}
}
}
eachMapping(aCallback, aContext, aOrder) {
const context = aContext || null;
const order = aOrder || SourceMapConsumer2.GENERATED_ORDER;
let mappings;
switch (order) {
case SourceMapConsumer2.GENERATED_ORDER:
mappings = this._generatedMappings;
break;
case SourceMapConsumer2.ORIGINAL_ORDER:
mappings = this._originalMappings;
break;
default:
throw new Error("Unknown order of iteration.");
}
const sourceRoot = this.sourceRoot;
mappings.map(function(mapping) {
let source = null;
if (mapping.source !== null) {
source = this._sources.at(mapping.source);
source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
}
return {
source,
generatedLine: mapping.generatedLine,
generatedColumn: mapping.generatedColumn,
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name: mapping.name === null ? null : this._names.at(mapping.name)
};
}, this).forEach(aCallback, context);
}
/**
* Find the mapping that best matches the hypothetical "needle" mapping that
* we are searching for in the given "haystack" of mappings.
*/
_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
if (aNeedle[aLineName] <= 0) {
throw new TypeError("Line must be greater than or equal to 1, got " + aNeedle[aLineName]);
}
if (aNeedle[aColumnName] < 0) {
throw new TypeError("Column must be greater than or equal to 0, got " + aNeedle[aColumnName]);
}
return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
}
allGeneratedPositionsFor(aArgs) {
const line = util.getArg(aArgs, "line");
const needle = {
source: util.getArg(aArgs, "source"),
originalLine: line,
originalColumn: util.getArg(aArgs, "column", 0)
};
needle.source = this._findSourceIndex(needle.source);
if (needle.source < 0) {
return [];
}
if (needle.originalLine < 1) {
throw new Error("Line numbers must be >= 1");
}
if (needle.originalColumn < 0) {
throw new Error("Column numbers must be >= 0");
}
const mappings = [];
let index = this._findMapping(
needle,
this._originalMappings,
"originalLine",
"originalColumn",
util.compareByOriginalPositions,
binarySearch.LEAST_UPPER_BOUND
);
if (index >= 0) {
let mapping = this._originalMappings[index];
if (aArgs.column === void 0) {
const originalLine = mapping.originalLine;
while (mapping && mapping.originalLine === originalLine) {
let lastColumn = mapping.lastGeneratedColumn;
if (this._computedColumnSpans && lastColumn === null) {
lastColumn = Infinity;
}
mappings.push({
line: util.getArg(mapping, "generatedLine", null),
column: util.getArg(mapping, "generatedColumn", null),
lastColumn
});
mapping = this._originalMappings[++index];
}
} else {
const originalColumn = mapping.originalColumn;
while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
let lastColumn = mapping.lastGeneratedColumn;
if (this._computedColumnSpans && lastColumn === null) {
lastColumn = Infinity;
}
mappings.push({
line: util.getArg(mapping, "generatedLine", null),
column: util.getArg(mapping, "generatedColumn", null),
lastColumn
});
mapping = this._originalMappings[++index];
}
}
}
return mappings;
}
destroy() {
for (let i = 0; i < this._sections.length; i++) {
this._sections[i].consumer.destroy();
}
}
};
exports2.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
function _factory(aSourceMap, aSourceMapURL) {
let sourceMap = aSourceMap;
if (typeof aSourceMap === "string") {
sourceMap = util.parseSourceMapInput(aSourceMap);
}
const consumer = sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
return Promise.resolve(consumer);
}
function _factoryBSM(aSourceMap, aSourceMapURL) {
return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
}
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-node.js
var require_source_node = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/lib/source-node.js"(exports2) {
var SourceMapGenerator2 = require_source_map_generator().SourceMapGenerator;
var util = require_util();
var REGEX_NEWLINE = /(\r?\n)/;
var NEWLINE_CODE = 10;
var isSourceNode = "$$$isSourceNode$$$";
var SourceNode = class _SourceNode {
constructor(aLine, aColumn, aSource, aChunks, aName) {
this.children = [];
this.sourceContents = {};
this.line = aLine == null ? null : aLine;
this.column = aColumn == null ? null : aColumn;
this.source = aSource == null ? null : aSource;
this.name = aName == null ? null : aName;
this[isSourceNode] = true;
if (aChunks != null) this.add(aChunks);
}
/**
* Creates a SourceNode from generated code and a SourceMapConsumer.
*
* @param aGeneratedCode The generated code
* @param aSourceMapConsumer The SourceMap for the generated code
* @param aRelativePath Optional. The path that relative sources in the
* SourceMapConsumer should be relative to.
*/
static fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
const node = new _SourceNode();
const remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
let remainingLinesIndex = 0;
const shiftNextLine = function() {
const lineContents = getNextLine();
const newLine = getNextLine() || "";
return lineContents + newLine;
function getNextLine() {
return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0;
}
};
let lastGeneratedLine = 1, lastGeneratedColumn = 0;
let lastMapping = null;
let nextLine;
aSourceMapConsumer.eachMapping(function(mapping) {
if (lastMapping !== null) {
if (lastGeneratedLine < mapping.generatedLine) {
addMappingWithCode(lastMapping, shiftNextLine());
lastGeneratedLine++;
lastGeneratedColumn = 0;
} else {
nextLine = remainingLines[remainingLinesIndex] || "";
const code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
lastGeneratedColumn = mapping.generatedColumn;
addMappingWithCode(lastMapping, code);
lastMapping = mapping;
return;
}
}
while (lastGeneratedLine < mapping.generatedLine) {
node.add(shiftNextLine());
lastGeneratedLine++;
}
if (lastGeneratedColumn < mapping.generatedColumn) {
nextLine = remainingLines[remainingLinesIndex] || "";
node.add(nextLine.substr(0, mapping.generatedColumn));
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
lastGeneratedColumn = mapping.generatedColumn;
}
lastMapping = mapping;
}, this);
if (remainingLinesIndex < remainingLines.length) {
if (lastMapping) {
addMappingWithCode(lastMapping, shiftNextLine());
}
node.add(remainingLines.splice(remainingLinesIndex).join(""));
}
aSourceMapConsumer.sources.forEach(function(sourceFile) {
const content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aRelativePath != null) {
sourceFile = util.join(aRelativePath, sourceFile);
}
node.setSourceContent(sourceFile, content);
}
});
return node;
function addMappingWithCode(mapping, code) {
if (mapping === null || mapping.source === void 0) {
node.add(code);
} else {
const source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
node.add(new _SourceNode(
mapping.originalLine,
mapping.originalColumn,
source,
code,
mapping.name
));
}
}
}
/**
* Add a chunk of generated JS to this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
add(aChunk) {
if (Array.isArray(aChunk)) {
aChunk.forEach(function(chunk) {
this.add(chunk);
}, this);
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
if (aChunk) {
this.children.push(aChunk);
}
} else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
}
/**
* Add a chunk of generated JS to the beginning of this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
prepend(aChunk) {
if (Array.isArray(aChunk)) {
for (let i = aChunk.length - 1; i >= 0; i--) {
this.prepend(aChunk[i]);
}
} else if (aChunk[isSourceNode] || typeof aChunk === "string") {
this.children.unshift(aChunk);
} else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
}
/**
* Walk over the tree of JS snippets in this node and its children. The
* walking function is called once for each snippet of JS and is passed that
* snippet and the its original associated source's line/column location.
*
* @param aFn The traversal function.
*/
walk(aFn) {
let chunk;
for (let i = 0, len = this.children.length; i < len; i++) {
chunk = this.children[i];
if (chunk[isSourceNode]) {
chunk.walk(aFn);
} else if (chunk !== "") {
aFn(chunk, {
source: this.source,
line: this.line,
column: this.column,
name: this.name
});
}
}
}
/**
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
* each of `this.children`.
*
* @param aSep The separator.
*/
join(aSep) {
let newChildren;
let i;
const len = this.children.length;
if (len > 0) {
newChildren = [];
for (i = 0; i < len - 1; i++) {
newChildren.push(this.children[i]);
newChildren.push(aSep);
}
newChildren.push(this.children[i]);
this.children = newChildren;
}
return this;
}
/**
* Call String.prototype.replace on the very right-most source snippet. Useful
* for trimming whitespace from the end of a source node, etc.
*
* @param aPattern The pattern to replace.
* @param aReplacement The thing to replace the pattern with.
*/
replaceRight(aPattern, aReplacement) {
const lastChild = this.children[this.children.length - 1];
if (lastChild[isSourceNode]) {
lastChild.replaceRight(aPattern, aReplacement);
} else if (typeof lastChild === "string") {
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
} else {
this.children.push("".replace(aPattern, aReplacement));
}
return this;
}
/**
* Set the source content for a source file. This will be added to the SourceMapGenerator
* in the sourcesContent field.
*
* @param aSourceFile The filename of the source file
* @param aSourceContent The content of the source file
*/
setSourceContent(aSourceFile, aSourceContent) {
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
}
/**
* Walk over the tree of SourceNodes. The walking function is called for each
* source file content and is passed the filename and source content.
*
* @param aFn The traversal function.
*/
walkSourceContents(aFn) {
for (let i = 0, len = this.children.length; i < len; i++) {
if (this.children[i][isSourceNode]) {
this.children[i].walkSourceContents(aFn);
}
}
const sources = Object.keys(this.sourceContents);
for (let i = 0, len = sources.length; i < len; i++) {
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
}
}
/**
* Return the string representation of this source node. Walks over the tree
* and concatenates all the various snippets together to one string.
*/
toString() {
let str = "";
this.walk(function(chunk) {
str += chunk;
});
return str;
}
/**
* Returns the string representation of this source node along with a source
* map.
*/
toStringWithSourceMap(aArgs) {
const generated = {
code: "",
line: 1,
column: 0
};
const map = new SourceMapGenerator2(aArgs);
let sourceMappingActive = false;
let lastOriginalSource = null;
let lastOriginalLine = null;
let lastOriginalColumn = null;
let lastOriginalName = null;
this.walk(function(chunk, original) {
generated.code += chunk;
if (original.source !== null && original.line !== null && original.column !== null) {
if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
lastOriginalSource = original.source;
lastOriginalLine = original.line;
lastOriginalColumn = original.column;
lastOriginalName = original.name;
sourceMappingActive = true;
} else if (sourceMappingActive) {
map.addMapping({
generated: {
line: generated.line,
column: generated.column
}
});
lastOriginalSource = null;
sourceMappingActive = false;
}
for (let idx = 0, length = chunk.length; idx < length; idx++) {
if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
generated.line++;
generated.column = 0;
if (idx + 1 === length) {
lastOriginalSource = null;
sourceMappingActive = false;
} else if (sourceMappingActive) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
} else {
generated.column++;
}
}
});
this.walkSourceContents(function(sourceFile, sourceContent) {
map.setSourceContent(sourceFile, sourceContent);
});
return { code: generated.code, map };
}
};
exports2.SourceNode = SourceNode;
}
});
// ../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/source-map.js
var require_source_map = __commonJS({
"../../node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/source-map.js"(exports2) {
exports2.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
exports2.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
exports2.SourceNode = require_source_node().SourceNode;
}
});
// ../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/lib/constants.js
var require_constants2 = __commonJS({
"../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/lib/constants.js"(exports2, module2) {
"use strict";
var WIN_SLASH = "\\\\/";
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
var DOT_LITERAL = "\\.";
var PLUS_LITERAL = "\\+";
var QMARK_LITERAL = "\\?";
var SLASH_LITERAL = "\\/";
var ONE_CHAR = "(?=.)";
var QMARK = "[^/]";
var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
var NO_DOT = `(?!${DOT_LITERAL})`;
var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
var STAR = `${QMARK}*?`;
var SEP = "/";
var POSIX_CHARS = {
DOT_LITERAL,
PLUS_LITERAL,
QMARK_LITERAL,
SLASH_LITERAL,
ONE_CHAR,
QMARK,
END_ANCHOR,
DOTS_SLASH,
NO_DOT,
NO_DOTS,
NO_DOT_SLASH,
NO_DOTS_SLASH,
QMARK_NO_DOT,
STAR,
START_ANCHOR,
SEP
};
var WINDOWS_CHARS = {
...POSIX_CHARS,
SLASH_LITERAL: `[${WIN_SLASH}]`,
QMARK: WIN_NO_SLASH,
STAR: `${WIN_NO_SLASH}*?`,
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
NO_DOT: `(?!${DOT_LITERAL})`,
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
SEP: "\\"
};
var POSIX_REGEX_SOURCE = {
alnum: "a-zA-Z0-9",
alpha: "a-zA-Z",
ascii: "\\x00-\\x7F",
blank: " \\t",
cntrl: "\\x00-\\x1F\\x7F",
digit: "0-9",
graph: "\\x21-\\x7E",
lower: "a-z",
print: "\\x20-\\x7E ",
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
space: " \\t\\r\\n\\v\\f",
upper: "A-Z",
word: "A-Za-z0-9_",
xdigit: "A-Fa-f0-9"
};
module2.exports = {
MAX_LENGTH: 1024 * 64,
POSIX_REGEX_SOURCE,
// regular expressions
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
// Replace globs with equivalent patterns to reduce parsing time.
REPLACEMENTS: {
"***": "*",
"**/**": "**",
"**/**/**": "**"
},
// Digits
CHAR_0: 48,
/* 0 */
CHAR_9: 57,
/* 9 */
// Alphabet chars.
CHAR_UPPERCASE_A: 65,
/* A */
CHAR_LOWERCASE_A: 97,
/* a */
CHAR_UPPERCASE_Z: 90,
/* Z */
CHAR_LOWERCASE_Z: 122,
/* z */
CHAR_LEFT_PARENTHESES: 40,
/* ( */
CHAR_RIGHT_PARENTHESES: 41,
/* ) */
CHAR_ASTERISK: 42,
/* * */
// Non-alphabetic chars.
CHAR_AMPERSAND: 38,
/* & */
CHAR_AT: 64,
/* @ */
CHAR_BACKWARD_SLASH: 92,
/* \ */
CHAR_CARRIAGE_RETURN: 13,
/* \r */
CHAR_CIRCUMFLEX_ACCENT: 94,
/* ^ */
CHAR_COLON: 58,
/* : */
CHAR_COMMA: 44,
/* , */
CHAR_DOT: 46,
/* . */
CHAR_DOUBLE_QUOTE: 34,
/* " */
CHAR_EQUAL: 61,
/* = */
CHAR_EXCLAMATION_MARK: 33,
/* ! */
CHAR_FORM_FEED: 12,
/* \f */
CHAR_FORWARD_SLASH: 47,
/* / */
CHAR_GRAVE_ACCENT: 96,
/* ` */
CHAR_HASH: 35,
/* # */
CHAR_HYPHEN_MINUS: 45,
/* - */
CHAR_LEFT_ANGLE_BRACKET: 60,
/* < */
CHAR_LEFT_CURLY_BRACE: 123,
/* { */
CHAR_LEFT_SQUARE_BRACKET: 91,
/* [ */
CHAR_LINE_FEED: 10,
/* \n */
CHAR_NO_BREAK_SPACE: 160,
/* \u00A0 */
CHAR_PERCENT: 37,
/* % */
CHAR_PLUS: 43,
/* + */
CHAR_QUESTION_MARK: 63,
/* ? */
CHAR_RIGHT_ANGLE_BRACKET: 62,
/* > */
CHAR_RIGHT_CURLY_BRACE: 125,
/* } */
CHAR_RIGHT_SQUARE_BRACKET: 93,
/* ] */
CHAR_SEMICOLON: 59,
/* ; */
CHAR_SINGLE_QUOTE: 39,
/* ' */
CHAR_SPACE: 32,
/* */
CHAR_TAB: 9,
/* \t */
CHAR_UNDERSCORE: 95,
/* _ */
CHAR_VERTICAL_LINE: 124,
/* | */
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
/* \uFEFF */
/**
* Create EXTGLOB_CHARS
*/
extglobChars(chars) {
return {
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
"?": { type: "qmark", open: "(?:", close: ")?" },
"+": { type: "plus", open: "(?:", close: ")+" },
"*": { type: "star", open: "(?:", close: ")*" },
"@": { type: "at", open: "(?:", close: ")" }
};
},
/**
* Create GLOB_CHARS
*/
globChars(win32) {
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
}
};
}
});
// ../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/lib/utils.js
var require_utils3 = __commonJS({
"../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/lib/utils.js"(exports2) {
"use strict";
var {
REGEX_BACKSLASH,
REGEX_REMOVE_BACKSLASH,
REGEX_SPECIAL_CHARS,
REGEX_SPECIAL_CHARS_GLOBAL
} = require_constants2();
exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
exports2.removeBackslashes = (str) => {
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
return match === "\\" ? "" : match;
});
};
exports2.escapeLast = (input, char, lastIdx) => {
const idx = input.lastIndexOf(char, lastIdx);
if (idx === -1) return input;
if (input[idx - 1] === "\\") return exports2.escapeLast(input, char, idx - 1);
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
};
exports2.removePrefix = (input, state = {}) => {
let output = input;
if (output.startsWith("./")) {
output = output.slice(2);
state.prefix = "./";
}
return output;
};
exports2.wrapOutput = (input, state = {}, options = {}) => {
const prepend = options.contains ? "" : "^";
const append = options.contains ? "" : "$";
let output = `${prepend}(?:${input})${append}`;
if (state.negated === true) {
output = `(?:^(?!${output}).*$)`;
}
return output;
};
exports2.basename = (path3, { windows } = {}) => {
const segs = path3.split(windows ? /[\\/]/ : "/");
const last = segs[segs.length - 1];
if (last === "") {
return segs[segs.length - 2];
}
return last;
};
}
});
// ../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/lib/scan.js
var require_scan = __commonJS({
"../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/lib/scan.js"(exports2, module2) {
"use strict";
var utils = require_utils3();
var {
CHAR_ASTERISK,
/* * */
CHAR_AT,
/* @ */
CHAR_BACKWARD_SLASH,
/* \ */
CHAR_COMMA,
/* , */
CHAR_DOT,
/* . */
CHAR_EXCLAMATION_MARK,
/* ! */
CHAR_FORWARD_SLASH,
/* / */
CHAR_LEFT_CURLY_BRACE,
/* { */
CHAR_LEFT_PARENTHESES,
/* ( */
CHAR_LEFT_SQUARE_BRACKET,
/* [ */
CHAR_PLUS,
/* + */
CHAR_QUESTION_MARK,
/* ? */
CHAR_RIGHT_CURLY_BRACE,
/* } */
CHAR_RIGHT_PARENTHESES,
/* ) */
CHAR_RIGHT_SQUARE_BRACKET
/* ] */
} = require_constants2();
var isPathSeparator = (code) => {
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
};
var depth = (token) => {
if (token.isPrefix !== true) {
token.depth = token.isGlobstar ? Infinity : 1;
}
};
var scan = (input, options) => {
const opts = options || {};
const length = input.length - 1;
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
const slashes = [];
const tokens = [];
const parts = [];
let str = input;
let index = -1;
let start = 0;
let lastIndex = 0;
let isBrace = false;
let isBracket = false;
let isGlob = false;
let isExtglob = false;
let isGlobstar = false;
let braceEscaped = false;
let backslashes = false;
let negated = false;
let negatedExtglob = false;
let finished = false;
let braces = 0;
let prev;
let code;
let token = { value: "", depth: 0, isGlob: false };
const eos = () => index >= length;
const peek = () => str.charCodeAt(index + 1);
const advance = () => {
prev = code;
return str.charCodeAt(++index);
};
while (index < length) {
code = advance();
let next;
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
if (code === CHAR_LEFT_CURLY_BRACE) {
braceEscaped = true;
}
continue;
}
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
braces++;
while (eos() !== true && (code = advance())) {
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
advance();
continue;
}
if (code === CHAR_LEFT_CURLY_BRACE) {
braces++;
continue;
}
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (braceEscaped !== true && code === CHAR_COMMA) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_RIGHT_CURLY_BRACE) {
braces--;
if (braces === 0) {
braceEscaped = false;
isBrace = token.isBrace = true;
finished = true;
break;
}
}
}
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_FORWARD_SLASH) {
slashes.push(index);
tokens.push(token);
token = { value: "", depth: 0, isGlob: false };
if (finished === true) continue;
if (prev === CHAR_DOT && index === start + 1) {
start += 2;
continue;
}
lastIndex = index + 1;
continue;
}
if (opts.noext !== true) {
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
isGlob = token.isGlob = true;
isExtglob = token.isExtglob = true;
finished = true;
if (code === CHAR_EXCLAMATION_MARK && index === start) {
negatedExtglob = true;
}
if (scanToEnd === true) {
while (eos() !== true && (code = advance())) {
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
continue;
}
if (code === CHAR_RIGHT_PARENTHESES) {
isGlob = token.isGlob = true;
finished = true;
break;
}
}
continue;
}
break;
}
}
if (code === CHAR_ASTERISK) {
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_QUESTION_MARK) {
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_LEFT_SQUARE_BRACKET) {
while (eos() !== true && (next = advance())) {
if (next === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
advance();
continue;
}
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
isBracket = token.isBracket = true;
isGlob = token.isGlob = true;
finished = true;
break;
}
}
if (scanToEnd === true) {
continue;
}
break;
}
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
negated = token.negated = true;
start++;
continue;
}
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
isGlob = token.isGlob = true;
if (scanToEnd === true) {
while (eos() !== true && (code = advance())) {
if (code === CHAR_LEFT_PARENTHESES) {
backslashes = token.backslashes = true;
code = advance();
continue;
}
if (code === CHAR_RIGHT_PARENTHESES) {
finished = true;
break;
}
}
continue;
}
break;
}
if (isGlob === true) {
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
}
if (opts.noext === true) {
isExtglob = false;
isGlob = false;
}
let base = str;
let prefix = "";
let glob = "";
if (start > 0) {
prefix = str.slice(0, start);
str = str.slice(start);
lastIndex -= start;
}
if (base && isGlob === true && lastIndex > 0) {
base = str.slice(0, lastIndex);
glob = str.slice(lastIndex);
} else if (isGlob === true) {
base = "";
glob = str;
} else {
base = str;
}
if (base && base !== "" && base !== "/" && base !== str) {
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
base = base.slice(0, -1);
}
}
if (opts.unescape === true) {
if (glob) glob = utils.removeBackslashes(glob);
if (base && backslashes === true) {
base = utils.removeBackslashes(base);
}
}
const state = {
prefix,
input,
start,
base,
glob,
isBrace,
isBracket,
isGlob,
isExtglob,
isGlobstar,
negated,
negatedExtglob
};
if (opts.tokens === true) {
state.maxDepth = 0;
if (!isPathSeparator(code)) {
tokens.push(token);
}
state.tokens = tokens;
}
if (opts.parts === true || opts.tokens === true) {
let prevIndex;
for (let idx = 0; idx < slashes.length; idx++) {
const n = prevIndex ? prevIndex + 1 : start;
const i = slashes[idx];
const value = input.slice(n, i);
if (opts.tokens) {
if (idx === 0 && start !== 0) {
tokens[idx].isPrefix = true;
tokens[idx].value = prefix;
} else {
tokens[idx].value = value;
}
depth(tokens[idx]);
state.maxDepth += tokens[idx].depth;
}
if (idx !== 0 || value !== "") {
parts.push(value);
}
prevIndex = i;
}
if (prevIndex && prevIndex + 1 < input.length) {
const value = input.slice(prevIndex + 1);
parts.push(value);
if (opts.tokens) {
tokens[tokens.length - 1].value = value;
depth(tokens[tokens.length - 1]);
state.maxDepth += tokens[tokens.length - 1].depth;
}
}
state.slashes = slashes;
state.parts = parts;
}
return state;
};
module2.exports = scan;
}
});
// ../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/lib/parse.js
var require_parse = __commonJS({
"../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/lib/parse.js"(exports2, module2) {
"use strict";
var constants = require_constants2();
var utils = require_utils3();
var {
MAX_LENGTH,
POSIX_REGEX_SOURCE,
REGEX_NON_SPECIAL_CHARS,
REGEX_SPECIAL_CHARS_BACKREF,
REPLACEMENTS
} = constants;
var expandRange = (args, options) => {
if (typeof options.expandRange === "function") {
return options.expandRange(...args, options);
}
args.sort();
const value = `[${args.join("-")}]`;
try {
new RegExp(value);
} catch (ex) {
return args.map((v) => utils.escapeRegex(v)).join("..");
}
return value;
};
var syntaxError = (type, char) => {
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
};
var parse = (input, options) => {
if (typeof input !== "string") {
throw new TypeError("Expected a string");
}
input = REPLACEMENTS[input] || input;
const opts = { ...options };
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
let len = input.length;
if (len > max) {
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
}
const bos = { type: "bos", value: "", output: opts.prepend || "" };
const tokens = [bos];
const capture = opts.capture ? "" : "?:";
const PLATFORM_CHARS = constants.globChars(opts.windows);
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
const {
DOT_LITERAL,
PLUS_LITERAL,
SLASH_LITERAL,
ONE_CHAR,
DOTS_SLASH,
NO_DOT,
NO_DOT_SLASH,
NO_DOTS_SLASH,
QMARK,
QMARK_NO_DOT,
STAR,
START_ANCHOR
} = PLATFORM_CHARS;
const globstar = (opts2) => {
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
};
const nodot = opts.dot ? "" : NO_DOT;
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
let star = opts.bash === true ? globstar(opts) : STAR;
if (opts.capture) {
star = `(${star})`;
}
if (typeof opts.noext === "boolean") {
opts.noextglob = opts.noext;
}
const state = {
input,
index: -1,
start: 0,
dot: opts.dot === true,
consumed: "",
output: "",
prefix: "",
backtrack: false,
negated: false,
brackets: 0,
braces: 0,
parens: 0,
quotes: 0,
globstar: false,
tokens
};
input = utils.removePrefix(input, state);
len = input.length;
const extglobs = [];
const braces = [];
const stack = [];
let prev = bos;
let value;
const eos = () => state.index === len - 1;
const peek = state.peek = (n = 1) => input[state.index + n];
const advance = state.advance = () => input[++state.index] || "";
const remaining = () => input.slice(state.index + 1);
const consume = (value2 = "", num = 0) => {
state.consumed += value2;
state.index += num;
};
const append = (token) => {
state.output += token.output != null ? token.output : token.value;
consume(token.value);
};
const negate = () => {
let count = 1;
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
advance();
state.start++;
count++;
}
if (count % 2 === 0) {
return false;
}
state.negated = true;
state.start++;
return true;
};
const increment = (type) => {
state[type]++;
stack.push(type);
};
const decrement = (type) => {
state[type]--;
stack.pop();
};
const push = (tok) => {
if (prev.type === "globstar") {
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
state.output = state.output.slice(0, -prev.output.length);
prev.type = "star";
prev.value = "*";
prev.output = star;
state.output += prev.output;
}
}
if (extglobs.length && tok.type !== "paren") {
extglobs[extglobs.length - 1].inner += tok.value;
}
if (tok.value || tok.output) append(tok);
if (prev && prev.type === "text" && tok.type === "text") {
prev.output = (prev.output || prev.value) + tok.value;
prev.value += tok.value;
return;
}
tok.prev = prev;
tokens.push(tok);
prev = tok;
};
const extglobOpen = (type, value2) => {
const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
token.prev = prev;
token.parens = state.parens;
token.output = state.output;
const output = (opts.capture ? "(" : "") + token.open;
increment("parens");
push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
push({ type: "paren", extglob: true, value: advance(), output });
extglobs.push(token);
};
const extglobClose = (token) => {
let output = token.close + (opts.capture ? ")" : "");
let rest;
if (token.type === "negate") {
let extglobStar = star;
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
extglobStar = globstar(opts);
}
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
output = token.close = `)$))${extglobStar}`;
}
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
const expression = parse(rest, { ...options, fastpaths: false }).output;
output = token.close = `)${expression})${extglobStar})`;
}
if (token.prev.type === "bos") {
state.negatedExtglob = true;
}
}
push({ type: "paren", extglob: true, value, output });
decrement("parens");
};
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
let backslashes = false;
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
if (first === "\\") {
backslashes = true;
return m;
}
if (first === "?") {
if (esc) {
return esc + first + (rest ? QMARK.repeat(rest.length) : "");
}
if (index === 0) {
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
}
return QMARK.repeat(chars.length);
}
if (first === ".") {
return DOT_LITERAL.repeat(chars.length);
}
if (first === "*") {
if (esc) {
return esc + first + (rest ? star : "");
}
return star;
}
return esc ? m : `\\${m}`;
});
if (backslashes === true) {
if (opts.unescape === true) {
output = output.replace(/\\/g, "");
} else {
output = output.replace(/\\+/g, (m) => {
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
});
}
}
if (output === input && opts.contains === true) {
state.output = input;
return state;
}
state.output = utils.wrapOutput(output, state, options);
return state;
}
while (!eos()) {
value = advance();
if (value === "\0") {
continue;
}
if (value === "\\") {
const next = peek();
if (next === "/" && opts.bash !== true) {
continue;
}
if (next === "." || next === ";") {
continue;
}
if (!next) {
value += "\\";
push({ type: "text", value });
continue;
}
const match = /^\\+/.exec(remaining());
let slashes = 0;
if (match && match[0].length > 2) {
slashes = match[0].length;
state.index += slashes;
if (slashes % 2 !== 0) {
value += "\\";
}
}
if (opts.unescape === true) {
value = advance();
} else {
value += advance();
}
if (state.brackets === 0) {
push({ type: "text", value });
continue;
}
}
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
if (opts.posix !== false && value === ":") {
const inner = prev.value.slice(1);
if (inner.includes("[")) {
prev.posix = true;
if (inner.includes(":")) {
const idx = prev.value.lastIndexOf("[");
const pre = prev.value.slice(0, idx);
const rest2 = prev.value.slice(idx + 2);
const posix = POSIX_REGEX_SOURCE[rest2];
if (posix) {
prev.value = pre + posix;
state.backtrack = true;
advance();
if (!bos.output && tokens.indexOf(prev) === 1) {
bos.output = ONE_CHAR;
}
continue;
}
}
}
}
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
value = `\\${value}`;
}
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
value = `\\${value}`;
}
if (opts.posix === true && value === "!" && prev.value === "[") {
value = "^";
}
prev.value += value;
append({ value });
continue;
}
if (state.quotes === 1 && value !== '"') {
value = utils.escapeRegex(value);
prev.value += value;
append({ value });
continue;
}
if (value === '"') {
state.quotes = state.quotes === 1 ? 0 : 1;
if (opts.keepQuotes === true) {
push({ type: "text", value });
}
continue;
}
if (value === "(") {
increment("parens");
push({ type: "paren", value });
continue;
}
if (value === ")") {
if (state.parens === 0 && opts.strictBrackets === true) {
throw new SyntaxError(syntaxError("opening", "("));
}
const extglob = extglobs[extglobs.length - 1];
if (extglob && state.parens === extglob.parens + 1) {
extglobClose(extglobs.pop());
continue;
}
push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
decrement("parens");
continue;
}
if (value === "[") {
if (opts.nobracket === true || !remaining().includes("]")) {
if (opts.nobracket !== true && opts.strictBrackets === true) {
throw new SyntaxError(syntaxError("closing", "]"));
}
value = `\\${value}`;
} else {
increment("brackets");
}
push({ type: "bracket", value });
continue;
}
if (value === "]") {
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
push({ type: "text", value, output: `\\${value}` });
continue;
}
if (state.brackets === 0) {
if (opts.strictBrackets === true) {
throw new SyntaxError(syntaxError("opening", "["));
}
push({ type: "text", value, output: `\\${value}` });
continue;
}
decrement("brackets");
const prevValue = prev.value.slice(1);
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
value = `/${value}`;
}
prev.value += value;
append({ value });
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
continue;
}
const escaped = utils.escapeRegex(prev.value);
state.output = state.output.slice(0, -prev.value.length);
if (opts.literalBrackets === true) {
state.output += escaped;
prev.value = escaped;
continue;
}
prev.value = `(${capture}${escaped}|${prev.value})`;
state.output += prev.value;
continue;
}
if (value === "{" && opts.nobrace !== true) {
increment("braces");
const open = {
type: "brace",
value,
output: "(",
outputIndex: state.output.length,
tokensIndex: state.tokens.length
};
braces.push(open);
push(open);
continue;
}
if (value === "}") {
const brace = braces[braces.length - 1];
if (opts.nobrace === true || !brace) {
push({ type: "text", value, output: value });
continue;
}
let output = ")";
if (brace.dots === true) {
const arr = tokens.slice();
const range = [];
for (let i = arr.length - 1; i >= 0; i--) {
tokens.pop();
if (arr[i].type === "brace") {
break;
}
if (arr[i].type !== "dots") {
range.unshift(arr[i].value);
}
}
output = expandRange(range, opts);
state.backtrack = true;
}
if (brace.comma !== true && brace.dots !== true) {
const out = state.output.slice(0, brace.outputIndex);
const toks = state.tokens.slice(brace.tokensIndex);
brace.value = brace.output = "\\{";
value = output = "\\}";
state.output = out;
for (const t of toks) {
state.output += t.output || t.value;
}
}
push({ type: "brace", value, output });
decrement("braces");
braces.pop();
continue;
}
if (value === "|") {
if (extglobs.length > 0) {
extglobs[extglobs.length - 1].conditions++;
}
push({ type: "text", value });
continue;
}
if (value === ",") {
let output = value;
const brace = braces[braces.length - 1];
if (brace && stack[stack.length - 1] === "braces") {
brace.comma = true;
output = "|";
}
push({ type: "comma", value, output });
continue;
}
if (value === "/") {
if (prev.type === "dot" && state.index === state.start + 1) {
state.start = state.index + 1;
state.consumed = "";
state.output = "";
tokens.pop();
prev = bos;
continue;
}
push({ type: "slash", value, output: SLASH_LITERAL });
continue;
}
if (value === ".") {
if (state.braces > 0 && prev.type === "dot") {
if (prev.value === ".") prev.output = DOT_LITERAL;
const brace = braces[braces.length - 1];
prev.type = "dots";
prev.output += value;
prev.value += value;
brace.dots = true;
continue;
}
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
push({ type: "text", value, output: DOT_LITERAL });
continue;
}
push({ type: "dot", value, output: DOT_LITERAL });
continue;
}
if (value === "?") {
const isGroup = prev && prev.value === "(";
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
extglobOpen("qmark", value);
continue;
}
if (prev && prev.type === "paren") {
const next = peek();
let output = value;
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
output = `\\${value}`;
}
push({ type: "text", value, output });
continue;
}
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
push({ type: "qmark", value, output: QMARK_NO_DOT });
continue;
}
push({ type: "qmark", value, output: QMARK });
continue;
}
if (value === "!") {
if (opts.noextglob !== true && peek() === "(") {
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
extglobOpen("negate", value);
continue;
}
}
if (opts.nonegate !== true && state.index === 0) {
negate();
continue;
}
}
if (value === "+") {
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
extglobOpen("plus", value);
continue;
}
if (prev && prev.value === "(" || opts.regex === false) {
push({ type: "plus", value, output: PLUS_LITERAL });
continue;
}
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
push({ type: "plus", value });
continue;
}
push({ type: "plus", value: PLUS_LITERAL });
continue;
}
if (value === "@") {
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
push({ type: "at", extglob: true, value, output: "" });
continue;
}
push({ type: "text", value });
continue;
}
if (value !== "*") {
if (value === "$" || value === "^") {
value = `\\${value}`;
}
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
if (match) {
value += match[0];
state.index += match[0].length;
}
push({ type: "text", value });
continue;
}
if (prev && (prev.type === "globstar" || prev.star === true)) {
prev.type = "star";
prev.star = true;
prev.value += value;
prev.output = star;
state.backtrack = true;
state.globstar = true;
consume(value);
continue;
}
let rest = remaining();
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
extglobOpen("star", value);
continue;
}
if (prev.type === "star") {
if (opts.noglobstar === true) {
consume(value);
continue;
}
const prior = prev.prev;
const before = prior.prev;
const isStart = prior.type === "slash" || prior.type === "bos";
const afterStar = before && (before.type === "star" || before.type === "globstar");
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
push({ type: "star", value, output: "" });
continue;
}
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
push({ type: "star", value, output: "" });
continue;
}
while (rest.slice(0, 3) === "/**") {
const after = input[state.index + 4];
if (after && after !== "/") {
break;
}
rest = rest.slice(3);
consume("/**", 3);
}
if (prior.type === "bos" && eos()) {
prev.type = "globstar";
prev.value += value;
prev.output = globstar(opts);
state.output = prev.output;
state.globstar = true;
consume(value);
continue;
}
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
state.output = state.output.slice(0, -(prior.output + prev.output).length);
prior.output = `(?:${prior.output}`;
prev.type = "globstar";
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
prev.value += value;
state.globstar = true;
state.output += prior.output + prev.output;
consume(value);
continue;
}
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
const end = rest[1] !== void 0 ? "|$" : "";
state.output = state.output.slice(0, -(prior.output + prev.output).length);
prior.output = `(?:${prior.output}`;
prev.type = "globstar";
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
prev.value += value;
state.output += prior.output + prev.output;
state.globstar = true;
consume(value + advance());
push({ type: "slash", value: "/", output: "" });
continue;
}
if (prior.type === "bos" && rest[0] === "/") {
prev.type = "globstar";
prev.value += value;
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
state.output = prev.output;
state.globstar = true;
consume(value + advance());
push({ type: "slash", value: "/", output: "" });
continue;
}
state.output = state.output.slice(0, -prev.output.length);
prev.type = "globstar";
prev.output = globstar(opts);
prev.value += value;
state.output += prev.output;
state.globstar = true;
consume(value);
continue;
}
const token = { type: "star", value, output: star };
if (opts.bash === true) {
token.output = ".*?";
if (prev.type === "bos" || prev.type === "slash") {
token.output = nodot + token.output;
}
push(token);
continue;
}
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
token.output = value;
push(token);
continue;
}
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
if (prev.type === "dot") {
state.output += NO_DOT_SLASH;
prev.output += NO_DOT_SLASH;
} else if (opts.dot === true) {
state.output += NO_DOTS_SLASH;
prev.output += NO_DOTS_SLASH;
} else {
state.output += nodot;
prev.output += nodot;
}
if (peek() !== "*") {
state.output += ONE_CHAR;
prev.output += ONE_CHAR;
}
}
push(token);
}
while (state.brackets > 0) {
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
state.output = utils.escapeLast(state.output, "[");
decrement("brackets");
}
while (state.parens > 0) {
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
state.output = utils.escapeLast(state.output, "(");
decrement("parens");
}
while (state.braces > 0) {
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
state.output = utils.escapeLast(state.output, "{");
decrement("braces");
}
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
}
if (state.backtrack === true) {
state.output = "";
for (const token of state.tokens) {
state.output += token.output != null ? token.output : token.value;
if (token.suffix) {
state.output += token.suffix;
}
}
}
return state;
};
parse.fastpaths = (input, options) => {
const opts = { ...options };
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
const len = input.length;
if (len > max) {
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
}
input = REPLACEMENTS[input] || input;
const {
DOT_LITERAL,
SLASH_LITERAL,
ONE_CHAR,
DOTS_SLASH,
NO_DOT,
NO_DOTS,
NO_DOTS_SLASH,
STAR,
START_ANCHOR
} = constants.globChars(opts.windows);
const nodot = opts.dot ? NO_DOTS : NO_DOT;
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
const capture = opts.capture ? "" : "?:";
const state = { negated: false, prefix: "" };
let star = opts.bash === true ? ".*?" : STAR;
if (opts.capture) {
star = `(${star})`;
}
const globstar = (opts2) => {
if (opts2.noglobstar === true) return star;
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
};
const create = (str) => {
switch (str) {
case "*":
return `${nodot}${ONE_CHAR}${star}`;
case ".*":
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
case "*.*":
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
case "*/*":
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
case "**":
return nodot + globstar(opts);
case "**/*":
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
case "**/*.*":
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
case "**/.*":
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
default: {
const match = /^(.*?)\.(\w+)$/.exec(str);
if (!match) return;
const source2 = create(match[1]);
if (!source2) return;
return source2 + DOT_LITERAL + match[2];
}
}
};
const output = utils.removePrefix(input, state);
let source = create(output);
if (source && opts.strictSlashes !== true) {
source += `${SLASH_LITERAL}?`;
}
return source;
};
module2.exports = parse;
}
});
// ../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/lib/picomatch.js
var require_picomatch = __commonJS({
"../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
"use strict";
var scan = require_scan();
var parse = require_parse();
var utils = require_utils3();
var constants = require_constants2();
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
var picomatch = (glob, options, returnState = false) => {
if (Array.isArray(glob)) {
const fns = glob.map((input) => picomatch(input, options, returnState));
const arrayMatcher = (str) => {
for (const isMatch of fns) {
const state2 = isMatch(str);
if (state2) return state2;
}
return false;
};
return arrayMatcher;
}
const isState = isObject(glob) && glob.tokens && glob.input;
if (glob === "" || typeof glob !== "string" && !isState) {
throw new TypeError("Expected pattern to be a non-empty string");
}
const opts = options || {};
const posix = opts.windows;
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
const state = regex.state;
delete regex.state;
let isIgnored = () => false;
if (opts.ignore) {
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
}
const matcher = (input, returnObject = false) => {
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
const result = { glob, state, regex, posix, input, output, match, isMatch };
if (typeof opts.onResult === "function") {
opts.onResult(result);
}
if (isMatch === false) {
result.isMatch = false;
return returnObject ? result : false;
}
if (isIgnored(input)) {
if (typeof opts.onIgnore === "function") {
opts.onIgnore(result);
}
result.isMatch = false;
return returnObject ? result : false;
}
if (typeof opts.onMatch === "function") {
opts.onMatch(result);
}
return returnObject ? result : true;
};
if (returnState) {
matcher.state = state;
}
return matcher;
};
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
if (typeof input !== "string") {
throw new TypeError("Expected input to be a string");
}
if (input === "") {
return { isMatch: false, output: "" };
}
const opts = options || {};
const format = opts.format || (posix ? utils.toPosixSlashes : null);
let match = input === glob;
let output = match && format ? format(input) : input;
if (match === false) {
output = format ? format(input) : input;
match = output === glob;
}
if (match === false || opts.capture === true) {
if (opts.matchBase === true || opts.basename === true) {
match = picomatch.matchBase(input, regex, options, posix);
} else {
match = regex.exec(output);
}
}
return { isMatch: Boolean(match), match, output };
};
picomatch.matchBase = (input, glob, options) => {
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
return regex.test(utils.basename(input));
};
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
picomatch.parse = (pattern, options) => {
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
return parse(pattern, { ...options, fastpaths: false });
};
picomatch.scan = (input, options) => scan(input, options);
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
if (returnOutput === true) {
return state.output;
}
const opts = options || {};
const prepend = opts.contains ? "" : "^";
const append = opts.contains ? "" : "$";
let source = `${prepend}(?:${state.output})${append}`;
if (state && state.negated === true) {
source = `^(?!${source}).*$`;
}
const regex = picomatch.toRegex(source, options);
if (returnState === true) {
regex.state = state;
}
return regex;
};
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
if (!input || typeof input !== "string") {
throw new TypeError("Expected a non-empty string");
}
let parsed = { negated: false, fastpaths: true };
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
parsed.output = parse.fastpaths(input, options);
}
if (!parsed.output) {
parsed = parse(input, options);
}
return picomatch.compileRe(parsed, options, returnOutput, returnState);
};
picomatch.toRegex = (source, options) => {
try {
const opts = options || {};
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
} catch (err) {
if (options && options.debug === true) throw err;
return /$^/;
}
};
picomatch.constants = constants;
module2.exports = picomatch;
}
});
// ../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/index.js
var require_picomatch2 = __commonJS({
"../../node_modules/.pnpm/picomatch@4.0.1/node_modules/picomatch/index.js"(exports2, module2) {
"use strict";
var pico = require_picomatch();
var isWindows = () => {
if (typeof navigator !== "undefined" && navigator.platform) {
const platform = navigator.platform.toLowerCase();
return platform === "win32" || platform === "windows";
}
if (typeof process !== "undefined" && process.platform) {
return process.platform === "win32";
}
return false;
};
function picomatch(glob, options, returnState = false) {
if (options && (options.windows === null || options.windows === void 0)) {
options = { ...options, windows: isWindows() };
}
return pico(glob, options, returnState);
}
Object.assign(picomatch, pico);
module2.exports = picomatch;
}
});
// src/index.ts
var import_promises2 = __toESM(require("node:fs/promises"));
var import_node_path2 = __toESM(require("node:path"));
// src/outputs.ts
var import_promises = __toESM(require("node:fs/promises"));
var import_node_path = __toESM(require("node:path"));
var import_build_utils = require("@vercel/build-utils");
var import_async_sema = __toESM(require_lib());
var import_fs_extra3 = __toESM(require_lib2());
var import_constants = __toESM(require_constants());
// src/pretty-bytes.ts
var import_bytes = __toESM(require_bytes());
// src/constants.ts
var EDGE_FUNCTION_SIZE_LIMIT = 1024 * 1024;
var INTERNAL_PAGES = ["_app", "_error", "_document"];
// src/get-edge-function-source.ts
var import_fs_extra2 = __toESM(require_lib2());
var import_path = require("path");
var import_webpack_sources2 = __toESM(require_lib3());
// src/edge-function-template.ts
var template = `var b=Object.create;var p=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var h=e=>p(e,"__esModule",{value:!0});var _=(e,n)=>{h(e);for(var t in n)p(e,t,{get:n[t],enumerable:!0})},U=(e,n,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of T(n))!L.call(e,i)&&i!=="default"&&p(e,i,{get:()=>n[i],enumerable:!(t=w(n,i))||t.enumerable});return e},A=e=>U(h(p(e!=null?b(P(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);_(exports,{default:()=>N});var R=A(require("async_hooks")),S="@next/request-context",f=Symbol.for(S),C=Symbol.for("internal.storage");function O(){let e=globalThis;if(!e[f]){let n=new R.AsyncLocalStorage,t={get:()=>n.getStore(),[C]:n};e[f]=t}return e[f]}var q=O();function m(e,n){return q[C].run(e,n)}function y(e){let n={};return e&&e.forEach((t,i)=>{n[i]=t,i.toLowerCase()==="set-cookie"&&(n[i]=M(t))}),n}function M(e){let n=[],t=0,i,a,g,o,r;function x(){for(;t<e.length&&/\\s/.test(e.charAt(t));)t+=1;return t<e.length}function s(){return a=e.charAt(t),a!=="="&&a!==";"&&a!==","}for(;t<e.length;){for(i=t,r=!1;x();)if(a=e.charAt(t),a===","){for(g=t,t+=1,x(),o=t;t<e.length&&s();)t+=1;t<e.length&&e.charAt(t)==="="?(r=!0,t=o,n.push(e.substring(i,g)),i=t):t=g+1}else t+=1;(!r||t>=e.length)&&n.push(e.substring(i,e.length))}return n}function N(e){let n=e.staticRoutes.map(i=>({regexp:new RegExp(i.namedRegex),page:i.page})),t=e.dynamicRoutes?.map(i=>({regexp:new RegExp(i.namedRegex),page:i.page}))||[];return async function(a,g){let o=new URL(a.url).pathname,r={};if(e.nextConfig?.basePath&&o.startsWith(e.nextConfig.basePath)&&(o=o.replace(e.nextConfig.basePath,"")||"/"),e.nextConfig?.i18n)for(let s of e.nextConfig.i18n.locales){let u=new RegExp(\`^/\${s}($|/)\`,"i");if(o.match(u)){o=o.replace(u,"/")||"/";break}}for(let s of n)if(s.regexp.exec(o)){r.name=s.page;break}if(!r.name){let s=E(o);for(let u of t||[]){if(s&&!E(u.page))continue;let d=u.regexp.exec(o);if(d){r={name:u.page,params:d.groups};break}}}let x=await m({waitUntil:g.waitUntil},()=>_ENTRIES[\`middleware_\${e.name}\`].default.call({},{request:{url:a.url,method:a.method,headers:y(a.headers),ip:c(a.headers,l.Ip),geo:{city:c(a.headers,l.City,!0),country:c(a.headers,l.Country,!0),latitude:c(a.headers,l.Latitude),longitude:c(a.headers,l.Longitude),region:c(a.headers,l.Region,!0)},nextConfig:e.nextConfig,page:r,body:a.body}}));return x.waitUntil&&g.waitUntil(x.waitUntil),x.response}}function c(e,n,t=!1){let i=e.get(n)||void 0;return t&&i?decodeURIComponent(i):i}function E(e){return e==="/api"||e.startsWith("/api/")}var l;(function(o){o.City="x-vercel-ip-city",o.Country="x-vercel-ip-country",o.Ip="x-real-ip",o.Latitude="x-vercel-ip-latitude",o.Longitude="x-vercel-ip-longitude",o.Region="x-vercel-ip-country-region"})(l||(l={}));`;
// src/sourcemapped.ts
var import_convert_source_map = __toESM(require_convert_source_map());
var import_fs_extra = __toESM(require_lib2());
var import_source_map = __toESM(require_source_map());
var import_webpack_sources = __toESM(require_lib3());
function sourcemapped(strings, ...sources) {
const concat = new import_webpack_sources.ConcatSource();
for (let i = 0; i < Math.max(strings.length, sources.length); i++) {
const string = strings[i];
const source = sources[i];
if (string) concat.add(raw(string));
if (source) concat.add(source);
}
return concat;
}
function raw(value) {
return new import_webpack_sources.OriginalSource(value, "[native code]");
}
async function fileToSource(content, sourceName, fullFilePath) {
const sourcemap = await getSourceMap(content, fullFilePath);
const cleanContent = removeInlinedSourceMap(content);
return sourcemap ? new import_webpack_sources.SourceMapSource(cleanContent, sourceName, sourcemap) : new import_webpack_sources.OriginalSource(cleanContent, sourceName);
}
async function getSourceMap(content, fullFilePath) {
let map;
try {
if (fullFilePath && await import_fs_extra.default.pathExists(`${fullFilePath}.map`)) {
const mapJson = await import_fs_extra.default.readFile(`${fullFilePath}.map`, "utf8");
map = import_convert_source_map.default.fromJSON(mapJson).toObject();
} else {
map = import_convert_source_map.default.fromComment(content).toObject();
}
} catch {
return null;
}
if ("sections" in map) {
return flattenSourceMap(map);
}
return map;
}
async function flattenSourceMap(map) {
return new import_source_map.SourceMapGenerator(await new import_source_map.SourceMapConsumer(map)).toJSON();
}
var SOURCE_MAP_COMMENT_REGEX = /^\s*?\/[/*][@#]\s+?sourceMappingURL=data:(((?:application|text)\/json)(?:;charset=([^;,]+?)?)?)?(?:;(base64))?,(.*?)$/gm;
function isValidSourceMapData(encoding, data) {
if (encoding !== "base64") {
return false;
}
data = data.replace(/\s/g, "").replace(/\*\//g, "");
return /^[a-zA-Z0-9+=/]+$/.test(data);
}
function removeInlinedSourceMap(source) {
for (const m of source.matchAll(SOURCE_MAP_COMMENT_REGEX)) {
if (!isValidSourceMapData(m[4], m[5])) {
continue;
}
source = source.replace(m[0], "");
}
return source;
}
// src/get-edge-function-source.ts
async function getNextjsEdgeFunctionSource(filePaths, params, outputDir, wasm) {
const chunks = new import_webpack_sources2.ConcatSource(raw(`globalThis._ENTRIES = {};`));
for (const filePath of filePaths) {
const fullFilePath = (0, import_path.join)(outputDir, filePath);
const content = await (0, import_fs_extra2.readFile)(fullFilePath, "utf8");
chunks.add(raw(`
/**/;`));
chunks.add(await fileToSource(content, filePath, fullFilePath));
}
const getPageMatchCode = `(function () {
const module = { exports: {}, loaded: false };
const fn = (function(module,exports) {${template}
});
fn(module, module.exports);
return module.exports;
})`;
return sourcemapped`
${raw(getWasmImportStatements(wasm || {}))}
${chunks};
export default ${raw(getPageMatchCode)}.call({}).default(
${raw(JSON.stringify(params))}
)`;
}
function getWasmImportStatements(wasm) {
return Object.entries(wasm).filter(([name]) => name.startsWith("wasm_")).map(([name]) => {
const pathname = `/wasm/${name}.wasm`;
return `const ${name} = require(${JSON.stringify(pathname)});`;
}).join("\n");
}
// src/outputs.ts
var import_node_handler = require("./node-handler");
function fallbackHasFilePath(fallback) {
return fallback !== void 0 && "filePath" in fallback && typeof fallback.filePath === "string";
}
var copy = async (src, dest) => {
await import_fs_extra3.default.remove(dest);
await import_fs_extra3.default.copy(src, dest);
};
var writeLock = /* @__PURE__ */ new Map();
var writeIfNotExists = async (filePath, content) => {
await writeLock.get(filePath);
const writePromise = import_promises.default.writeFile(filePath, content, { flag: "wx" }).catch((err) => {
if (err.code === "EEXIST") return;
throw err;
}).finally(() => writeLock.delete(filePath));
writeLock.set(filePath, writePromise);
return writePromise;
};
function normalizeIndexPathname(pathname, config) {
if (pathname === config.basePath && config.basePath !== "/") {
return import_node_path.default.posix.join(config.basePath, "/index");
}
if (pathname === "/") {
return "/index";
}
return pathname;
}
async function handlePublicFiles(publicFolder, vercelOutputDir, config) {
const topLevelItems = await import_promises.default.readdir(publicFolder).catch(() => []);
const fsSema = new import_async_sema.Sema(16, { capacity: topLevelItems.length });
await Promise.all(
topLevelItems.map(async (item) => {
await fsSema.acquire();
const destination = import_node_path.default.join(
vercelOutputDir,
"static",
config.basePath || "",
item
);
const destDirectory = import_node_path.default.dirname(destination);
await import_promises.default.mkdir(destDirectory, { recursive: true });
await copy(import_node_path.default.join(publicFolder, item), destination);
fsSema.release();
})
);
}
async function handleStaticOutputs(outputs, {
config,
vercelConfig: vercelConfig2,
vercelOutputDir
}) {
const fsSema = new import_async_sema.Sema(16, { capacity: outputs.length });
await Promise.all(
outputs.map(async (output) => {
await fsSema.acquire();
const srcExtension = import_node_path.default.extname(output.filePath);
const isHtml = srcExtension === ".html";
if (isHtml) {
vercelConfig2.overrides[import_node_path.default.posix.join("./", output.pathname + ".html")] = {
contentType: "text/html; charset=utf-8",
path: import_node_path.default.posix.join("./", output.pathname)
};
}
const destination = import_node_path.default.join(
vercelOutputDir,
"static",
output.pathname + (isHtml ? ".html" : "")
);
const destDirectory = import_node_path.default.dirname(destination);
await import_promises.default.mkdir(destDirectory, { recursive: true });
await copy(output.filePath, destination);
fsSema.release();
})
);
await import_promises.default.writeFile(
import_node_path.default.posix.join(
vercelOutputDir,
"static",
config.basePath || "",
"_next/static/not-found.txt"
),
"Not Found"
);
}
var vercelConfig = JSON.parse(process.env.NEXT_ADAPTER_VERCEL_CONFIG || "{}");
async function handleNodeOutputs(nodeOutputs, {
config,
distDir,
repoRoot,
projectDir,
nextVersion,
isMiddleware,
prerenderFallbackFalseMap,
vercelOutputDir
}) {
const nodeVersion = await (0, import_build_utils.getNodeVersion)(projectDir, void 0, {}, {});
const fsSema = new import_async_sema.Sema(16, { capacity: nodeOutputs.length });
const functionsDir = import_node_path.default.join(vercelOutputDir, "functions");
const handlerRelativeDir = import_node_path.default.posix.relative(repoRoot, projectDir);
let pages404Output;
let pagesErrorOutput;
for (const item of nodeOutputs) {
if (item.pathname === import_node_path.default.posix.join("/", config.basePath || "", "/404")) {
pages404Output = item;
}
if (item.pathname === import_node_path.default.posix.join("/", config.basePath || "", "/_error")) {
pagesErrorOutput = item;
}
if (pages404Output && pagesErrorOutput) {
break;
}
}
await Promise.all(
nodeOutputs.map(async (output) => {
await fsSema.acquire();
const functionDir = import_node_path.default.join(
functionsDir,
`${normalizeIndexPathname(output.pathname, config)}.func`
);
await import_promises.default.mkdir(functionDir, { recursive: true });
const files = {};
for (const [relPath, fsPath] of Object.entries(output.assets)) {
files[relPath] = import_node_path.default.posix.relative(repoRoot, fsPath);
}
files[import_node_path.default.posix.relative(repoRoot, output.filePath)] = import_node_path.default.posix.relative(repoRoot, output.filePath);
if (output.type === import_constants.AdapterOutputType.PAGES) {
const notFoundOutput = pages404Output || pagesErrorOutput;
if (notFoundOutput) {
for (const [relPath, fsPath] of Object.entries(
notFoundOutput.assets
)) {
files[relPath] = import_node_path.default.posix.relative(repoRoot, fsPath);
}
files[import_node_path.default.posix.relative(repoRoot, notFoundOutput.filePath)] = import_node_path.default.posix.relative(repoRoot, notFoundOutput.filePath);
}
}
const handlerFilePath = import_node_path.default.join(
functionDir,
handlerRelativeDir,
"___next_launcher.cjs"
);
await import_promises.default.mkdir(import_node_path.default.dirname(handlerFilePath), { recursive: true });
await writeIfNotExists(
handlerFilePath,
(0, import_node_handler.getHandlerSource)({
projectRelativeDistDir: import_node_path.default.posix.relative(projectDir, distDir),
prerenderFallbackFalseMap,
isMiddleware,
nextConfig: config
})
);
const operationType = output.type === import_constants.AdapterOutputType.APP_PAGE || import_constants.AdapterOutputType.PAGES ? "PAGE" : "API";
const sourceFile = await getSourceFilePathFromPage({
workPath: projectDir,
page: output.sourcePage,
pageExtensions: config.pageExtensions || []
});
const vercelConfigOpts = await (0, import_build_utils.getLambdaOptionsFromFunction)({
sourceFile,
config: vercelConfig
});
await writeIfNotExists(
import_node_path.default.join(functionDir, `.vc-config.json`),
JSON.stringify(
// TODO: strongly type this
{
...vercelConfigOpts,
filePathMap: files,
operationType,
framework: {
slug: "nextjs",
version: nextVersion
},
handler: import_node_path.default.posix.join(
import_node_path.default.posix.relative(repoRoot, projectDir),
"___next_launcher.cjs"
),
runtime: nodeVersion.runtime,
maxDuration: output.config.maxDuration,
supportsResponseStreaming: true,
experimentalAllowBundling: true,
// middleware handler always expects Request/Response interface
useWebApi: isMiddleware,
launcherType: "Nodejs"
}
)
);
fsSema.release();
})
);
}
async function handlePrerenderOutputs(prerenderOutputs, {
config,
hasAppEntries,
vercelOutputDir,
nodeOutputsParentMap,
rscContentType,
varyHeader
}) {
const prerenderParentIds = /* @__PURE__ */ new Set();
const fsSema = new import_async_sema.Sema(16, { capacity: prerenderOutputs.length });
const functionsDir = import_node_path.default.join(vercelOutputDir, "functions");
await Promise.all(
prerenderOutputs.map(async (output) => {
await fsSema.acquire();
try {
const prerenderConfigPath = import_node_path.default.join(
functionsDir,
`${normalizeIndexPathname(
output.pathname,
config
)}.prerender-config.json`
);
const prerenderFallbackPath = fallbackHasFilePath(output.fallback) ? import_node_path.default.join(
functionsDir,
`${normalizeIndexPathname(
output.pathname,
config
)}.prerender-fallback${import_node_path.default.extname(output.fallback.filePath)}`
) : (
// Use the fallback value for the RSC route if the route doesn't
// vary based on the route parameters and there's an actual postponed
// state to fallback to.
output.fallback?.postponedState && output.config.allowQuery && output.config.allowQuery.length === 0 ? import_node_path.default.join(
functionsDir,
`${normalizeIndexPathname(
output.pathname,
config
)}.prerender-fallback${import_node_path.default.extname(output.pathname)}`
) : void 0
);
const { parentOutputId } = output;
prerenderParentIds.add(parentOutputId);
const parentNodeOutput = nodeOutputsParentMap.get(parentOutputId);
if (!parentNodeOutput) {
throw new Error(
`Invariant: failed to find parent node output ${output.parentOutputId} for prerender output ${output.pathname}`
);
}
const clonedNodeOutput = Object.assign({}, parentNodeOutput);
clonedNodeOutput.pathname = output.pathname;
const parentFunctionDir = import_node_path.default.join(
functionsDir,
`${normalizeIndexPathname(parentNodeOutput.pathname, config)}.func`
);
const prerenderFunctionDir = import_node_path.default.join(
functionsDir,
`${normalizeIndexPathname(output.pathname, config)}.func`
);
if (output.pathname !== parentNodeOutput.pathname) {
await import_promises.default.mkdir(import_node_path.default.dirname(prerenderFunctionDir), {
recursive: true
});
await import_promises.default.symlink(
import_node_path.default.relative(
import_node_path.default.dirname(prerenderFunctionDir),
parentFunctionDir
),
prerenderFunctionDir
).catch((err) => {
if (!(typeof err === "object" && err && err.code === "EEXIST")) {
throw err;
}
});
}
const initialHeaders = Object.assign(
{},
hasAppEntries ? { vary: varyHeader } : {},
output.fallback?.initialHeaders
);
const isRscOutput = import_node_path.default.extname(output.pathname) === ".rsc";
if (output.fallback?.postponedState && fallbackHasFilePath(output.fallback) && prerenderFallbackPath) {
const fallbackContent = await import_promises.default.readFile(
output.fallback.filePath,
"utf8"
);
await writeIfNotExists(
prerenderFallbackPath,
`${output.fallback.postponedState}${fallbackContent}`
);
const originContentType = isRscOutput ? rscContentType : "text/html; charset=utf-8";
initialHeaders["content-type"] = `application/x-nextjs-pre-render; state-length=${output.fallback.postponedState.length}; origin=${JSON.stringify(originContentType)}`;
} else if (output.fallback?.postponedState && !fallbackHasFilePath(output.fallback) && prerenderFallbackPath) {
await writeIfNotExists(
prerenderFallbackPath,
output.fallback.postponedState
);
initialHeaders["content-type"] = `application/x-nextjs-pre-render; state-length=${output.fallback.postponedState.length}; origin=${JSON.stringify(rscContentType)}`;
}
await import_promises.default.mkdir(import_node_path.default.dirname(prerenderConfigPath), { recursive: true });
await writeIfNotExists(
prerenderConfigPath,
JSON.stringify(
// TODO: strongly type this
{
group: output.groupId,
expiration: typeof output.fallback?.initialRevalidate !== "undefined" ? output.fallback?.initialRevalidate : 1,
staleExpiration: output.fallback?.initialExpiration,
sourcePath: parentNodeOutput?.pathname,
// send matches in query instead of x-now-route-matches
// legacy header
passQuery: true,
allowQuery: output.config.allowQuery,
allowHeader: output.config.allowHeader,
bypassToken: output.config.bypassToken,
experimentalBypassFor: output.config.bypassFor,
initialHeaders,
initialStatus: output.fallback?.initialStatus,
fallback: prerenderFallbackPath ? import_node_path.default.posix.relative(
import_node_path.default.dirname(prerenderConfigPath),
prerenderFallbackPath
) : null,
chain: output.pprChain ? {
...output.pprChain,
outputPath: import_node_path.default.posix.join(
"./",
`${normalizeIndexPathname(output.pathname, config)}`
)
} : void 0
}
)
);
if (fallbackHasFilePath(output.fallback) && prerenderFallbackPath && // if postponed state is not present we write the fallback file above
!output.fallback.postponedState) {
await copy(output.fallback.filePath, prerenderFallbackPath);
}
if (output.fallback && Object.keys(initialHeaders || {}).length === 0) {
throw new Error("empty initialHeaders");
}
} catch (err) {
console.error(`Failed to handle output:`, output);
throw err;
}
fsSema.release();
})
);
}
async function handleEdgeOutputs(edgeOutputs, {
config,
distDir,
repoRoot,
projectDir,
nextVersion,
vercelOutputDir
}) {
const fsSema = new import_async_sema.Sema(16, { capacity: edgeOutputs.length });
const functionsDir = import_node_path.default.join(vercelOutputDir, "functions");
const handlerRelativeDir = import_node_path.default.posix.relative(repoRoot, projectDir);
await Promise.all(
edgeOutputs.map(async (output) => {
await fsSema.acquire();
const functionDir = import_node_path.default.join(
functionsDir,
`${normalizeIndexPathname(output.pathname, config)}.func`
);
await import_promises.default.mkdir(functionDir, { recursive: true });
const files = {};
const jsRegex = /\.(m|c)?js$/;
const nonJsAssetFiles = [];
for (const [relPath, fsPath] of Object.entries(output.assets)) {
if (jsRegex.test(fsPath)) {
files[relPath] = import_node_path.default.posix.relative(repoRoot, fsPath);
} else {
files[`assets/${relPath}`] = import_node_path.default.posix.relative(repoRoot, fsPath);
nonJsAssetFiles.push({
name: relPath,
path: `assets/${relPath}`
});
}
}
for (const [name, fsPath] of Object.entries(output.wasmAssets || {})) {
files[`wasm/${name}.wasm`] = import_node_path.default.posix.relative(repoRoot, fsPath);
}
files[import_node_path.default.posix.relative(projectDir, output.filePath)] = import_node_path.default.posix.relative(repoRoot, output.filePath);
const filePaths = [
...Object.values(output.assets).map((item) => import_node_path.default.posix.relative(projectDir, item)).filter((item) => jsRegex.test(item)),
import_node_path.default.posix.relative(projectDir, output.filePath)
];
const params = {
name: output.id.replace(/\.rsc$/, ""),
staticRoutes: [],
dynamicRoutes: [],
nextConfig: {
basePath: config.basePath,
i18n: config.i18n
}
};
const edgeSourceObj = await getNextjsEdgeFunctionSource(
filePaths,
params,
projectDir,
output.wasmAssets
);
const edgeSource = edgeSourceObj.source();
const handlerFilePath = import_node_path.default.join(
functionDir,
handlerRelativeDir,
"index.js"
);
await import_promises.default.mkdir(import_node_path.default.dirname(handlerFilePath), { recursive: true });
await writeIfNotExists(handlerFilePath, edgeSource.toString());
const edgeConfig = {
runtime: "edge",
name: params.name,
entrypoint: import_node_path.default.posix.join(
import_node_path.default.posix.relative(repoRoot, projectDir),
"index.js"
),
filePathMap: files,
assets: nonJsAssetFiles,
deploymentTarget: "v8-worker",
environment: output.config.env || {},
regions: output.config.preferredRegion,
framework: {
slug: "nextjs",
version: nextVersion
}
};
await writeIfNotExists(
import_node_path.default.join(functionDir, ".vc-config.json"),
JSON.stringify(edgeConfig)
);
fsSema.release();
})
);
}
async function handleMiddleware(output, ctx) {
if (output.runtime === "nodejs") {
await handleNodeOutputs([output], {
...ctx,
isMiddleware: true
});
} else if (output.runtime === "edge") {
await handleEdgeOutputs([output], ctx);
} else {
throw new Error(`Invalid middleware output ${JSON.stringify(output)}`);
}
const routes = [];
for (const matcher of output.config.matchers || []) {
const route = {
continue: true,
has: matcher.has,
src: matcher.sourceRegex,
missing: matcher.missing
};
route.middlewarePath = output.pathname;
route.middlewareRawSrc = matcher.source ? [matcher.source] : [];
route.override = true;
routes.push(route);
}
return routes;
}
var _usesSrcCache;
async function usesSrcDirectory(workPath) {
if (!_usesSrcCache) {
const sourcePages = import_node_path.default.join(workPath, "src", "pages");
try {
if ((await import_promises.default.stat(sourcePages)).isDirectory()) {
_usesSrcCache = true;
}
} catch (_err) {
_usesSrcCache = false;
}
}
if (!_usesSrcCache) {
const sourceAppdir = import_node_path.default.join(workPath, "src", "app");
try {
if ((await import_promises.default.stat(sourceAppdir)).isDirectory()) {
_usesSrcCache = true;
}
} catch (_err) {
_usesSrcCache = false;
}
}
return Boolean(_usesSrcCache);
}
function isDirectory(path3) {
return import_fs_extra3.default.existsSync(path3) && import_fs_extra3.default.lstatSync(path3).isDirectory();
}
async function getSourceFilePathFromPage({
workPath,
page,
pageExtensions
}) {
const usesSrcDir = await usesSrcDirectory(workPath);
const extensionsToTry = pageExtensions || ["js", "jsx", "ts", "tsx"];
for (const pageType of [
// middleware is not nested in pages/app
...page === "middleware" ? [""] : ["pages", "app"]
]) {
let fsPath = import_node_path.default.join(workPath, pageType, page);
if (usesSrcDir) {
fsPath = import_node_path.default.join(workPath, "src", pageType, page);
}
if (import_fs_extra3.default.existsSync(fsPath)) {
return import_node_path.default.relative(workPath, fsPath);
}
const extensionless = fsPath;
for (const ext of extensionsToTry) {
fsPath = `${extensionless}.${ext}`;
if (pageType === "app" && extensionless === import_node_path.default.join(workPath, `${usesSrcDir ? "src/" : ""}app/index`)) {
fsPath = `${extensionless.replace(/index$/, "page")}.${ext}`;
}
if (import_fs_extra3.default.existsSync(fsPath)) {
return import_node_path.default.relative(workPath, fsPath);
}
}
if (isDirectory(extensionless)) {
if (pageType === "pages") {
for (const ext of extensionsToTry) {
fsPath = import_node_path.default.join(extensionless, `index.${ext}`);
if (import_fs_extra3.default.existsSync(fsPath)) {
return import_node_path.default.relative(workPath, fsPath);
}
}
} else {
for (const ext of extensionsToTry) {
fsPath = import_node_path.default.join(extensionless, `page.${ext}`);
if (import_fs_extra3.default.existsSync(fsPath)) {
return import_node_path.default.relative(workPath, fsPath);
}
fsPath = import_node_path.default.join(extensionless, `route.${ext}`);
if (import_fs_extra3.default.existsSync(fsPath)) {
return import_node_path.default.relative(workPath, fsPath);
}
}
}
}
}
if (page === "/_not-found/page") {
return "";
}
if (page === "/_global-error/page") {
return "";
}
if (!INTERNAL_PAGES.includes(page)) {
console.log(
`WARNING: Unable to find source file for page ${page} with extensions: ${extensionsToTry.join(
", "
)}, this can cause functions config from \`vercel.json\` to not be applied`
);
}
return "";
}
// src/routing.ts
function modifyWithRewriteHeaders(rewrites, {
isAfterFilesRewrite = false,
shouldHandleSegmentPrefetches
}) {
for (let i = 0; i < rewrites.length; i++) {
const rewrite = rewrites[i];
if (!rewrite.src || !rewrite.dest) continue;
let protocol = null;
if (rewrite.dest.startsWith("http://")) {
protocol = "http://";
} else if (rewrite.dest.startsWith("https://")) {
protocol = "https://";
}
let pathname = null;
let query = null;
if (!protocol) {
pathname = rewrite.dest;
let index = pathname.indexOf("?");
if (index !== -1) {
query = pathname.substring(index + 1);
pathname = pathname.substring(0, index);
index = query.indexOf("#");
if (index !== -1) {
query = query.substring(0, index);
}
query = query.split("&").filter((part) => {
const key = part.split("=")[0];
return !key.startsWith("nxtP") && !key.startsWith("nxtI");
}).join("&") || null;
} else {
index = pathname.indexOf("#");
if (index !== -1) {
pathname = pathname.substring(0, index);
}
}
}
if (isAfterFilesRewrite) {
const parts = ["\\.rsc"];
if (shouldHandleSegmentPrefetches) {
parts.push("\\.segments/.+\\.segment\\.rsc");
}
const rscSuffix = parts.join("|");
rewrite.src = rewrite.src.replace(
/(\\\/(\?)?)?\(\?:\\\/\)\?\$$/,
`(?:/)?(?<rscsuff>${rscSuffix})?`
);
const destQueryIndex = rewrite.dest.indexOf("?");
if (destQueryIndex === -1) {
rewrite.dest = `${rewrite.dest}$rscsuff`;
} else {
rewrite.dest = `${rewrite.dest.substring(
0,
destQueryIndex
)}$rscsuff${rewrite.dest.substring(destQueryIndex)}`;
}
}
if (protocol || !pathname && !query) continue;
rewrite.headers = {
...rewrite.headers,
...pathname ? {
["x-nextjs-rewritten-path"]: pathname
} : {},
...query ? {
["x-nextjs-rewritten-query"]: query
} : {}
};
}
}
function isRewriteRoute(route) {
return Boolean(route.destination) && !isRedirectStatus(route.status);
}
function isRedirectStatus(status) {
return status !== void 0 && [301, 302, 303, 307, 308].includes(status);
}
function normalizeRewrites(routing) {
const normalize = (item) => ({
src: item.sourceRegex,
dest: item.destination,
has: item.has,
missing: item.missing,
check: true
});
return {
beforeFiles: routing.beforeFiles.filter(isRewriteRoute).map((item) => {
const route = normalize(item);
delete route.check;
route.continue = true;
route.override = true;
return route;
}),
afterFiles: routing.afterFiles.filter(isRewriteRoute).map(normalize),
fallback: routing.fallback.filter(isRewriteRoute).map(normalize)
};
}
function extractRedirects(routing) {
const priorityRedirects = [];
const normalRedirects = [];
const processRedirects = (routes) => {
for (const route of routes) {
if (!isRedirectStatus(route.status)) continue;
const vercelRoute = {
src: route.sourceRegex,
headers: route.headers,
status: route.status,
has: route.has,
missing: route.missing
};
if (route.priority) {
vercelRoute.continue = true;
priorityRedirects.push(vercelRoute);
} else {
normalRedirects.push(vercelRoute);
}
}
};
processRedirects(routing.beforeMiddleware);
processRedirects(routing.beforeFiles);
return { priority: priorityRedirects, normal: normalRedirects };
}
function extractHeaders(routing) {
const headers = [];
const processHeaders = (routes) => {
for (const route of routes) {
if (!route.headers || isRedirectStatus(route.status)) continue;
if (route.destination) continue;
headers.push({
src: route.sourceRegex,
headers: route.headers,
continue: true,
has: route.has,
missing: route.missing,
...route.priority ? { important: true } : {}
});
}
};
processHeaders(routing.beforeMiddleware);
processHeaders(routing.beforeFiles);
return headers;
}
function normalizeNextDataRoutes(config, buildId, shouldHandleMiddlewareDataResolving, isOverride = false) {
if (!shouldHandleMiddlewareDataResolving) return [];
const path3 = require("node:path");
const basePath = config.basePath || "";
const trailingSlash = config.trailingSlash || false;
return [
// ensure x-nextjs-data header is always present if we are doing middleware next data resolving
{
src: path3.posix.join("/", basePath, "/_next/data/(.*)"),
missing: [
{
type: "header",
key: "x-nextjs-data"
}
],
transforms: [
{
type: "request.headers",
op: "append",
target: {
key: "x-nextjs-data"
},
args: "1"
}
],
continue: true
},
// strip _next/data prefix for resolving
{
src: `^${path3.posix.join(
"/",
basePath,
"/_next/data/",
buildId.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"),
"/(.*).json"
)}`,
dest: `${path3.posix.join(
"/",
basePath,
"/$1",
trailingSlash ? "/" : ""
)}`,
...isOverride ? { override: true } : {},
continue: true,
has: [
{
type: "header",
key: "x-nextjs-data"
}
]
},
// normalize "/index" from "/_next/data/index.json" to -> just "/"
{
src: path3.posix.join("^/", basePath, "/index(?:/)?"),
has: [
{
type: "header",
key: "x-nextjs-data"
}
],
dest: path3.posix.join("/", basePath, trailingSlash ? "/" : ""),
...isOverride ? { override: true } : {},
continue: true
}
];
}
function extractOnMatchRoutes(routing) {
return routing.onMatch.map((route) => ({
src: route.sourceRegex,
...route.destination ? { dest: route.destination } : {},
...route.headers ? { headers: route.headers } : {},
...route.has ? { has: route.has } : {},
...route.missing ? { missing: route.missing } : {},
continue: true,
important: true
}));
}
function denormalizeNextDataRoutes(config, buildId, shouldHandleMiddlewareDataResolving, isOverride = false) {
if (!shouldHandleMiddlewareDataResolving) return [];
const path3 = require("node:path");
const basePath = config.basePath || "";
const trailingSlash = config.trailingSlash || false;
return [
{
src: path3.posix.join(
"^/",
basePath && basePath !== "/" ? `${basePath}${trailingSlash ? "/$" : "$"}` : "$"
),
has: [
{
type: "header",
key: "x-nextjs-data"
}
],
dest: `${path3.posix.join(
"/",
basePath,
"/_next/data/",
buildId,
"/index.json"
)}`,
continue: true,
...isOverride ? { override: true } : {}
},
{
src: path3.posix.join("^/", basePath, "((?!_next/)(?:.*[^/]|.*))/?$"),
has: [
{
type: "header",
key: "x-nextjs-data"
}
],
dest: `${path3.posix.join(
"/",
basePath,
"/_next/data/",
buildId,
"/$1.json"
)}`,
continue: true,
...isOverride ? { override: true } : {}
}
];
}
// src/utils.ts
var import_picomatch = __toESM(require_picomatch2());
function getImagesConfig(config) {
const images = config.images || {};
const remotePatterns = (images.remotePatterns || []).map((p) => ({
protocol: p.protocol?.replace(/:$/, ""),
hostname: (0, import_picomatch.makeRe)(p.hostname).source,
port: p.port,
pathname: (0, import_picomatch.makeRe)(p.pathname ?? "**", { dot: true }).source,
search: p.search
}));
const localPatterns = images.localPatterns?.map((p) => ({
pathname: (0, import_picomatch.makeRe)(p.pathname ?? "**", { dot: true }).source,
search: p.search
}));
return {
localPatterns,
remotePatterns,
sizes: [...images.imageSizes || [], ...images.deviceSizes || []],
domains: images.domains || [],
qualities: images.qualities,
minimumCacheTTL: images.minimumCacheTTL,
formats: images.formats,
dangerouslyAllowSVG: images.dangerouslyAllowSVG,
contentSecurityPolicy: images.contentSecurityPolicy,
contentDispositionType: images.contentDispositionType
};
}
var matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
function escapeStringRegexp(str) {
return str.replace(matchOperatorsRegex, "\\$&");
}
// src/index.ts
var myAdapter = {
name: "Vercel",
async onBuildComplete({
routing,
config,
buildId,
outputs,
distDir,
repoRoot,
projectDir,
nextVersion
}) {
const vercelOutputDir = import_node_path2.default.join(distDir, "output");
await import_promises2.default.mkdir(vercelOutputDir, { recursive: true });
const escapedBuildId = escapeStringRegexp(buildId);
const hasMiddleware = Boolean(outputs.middleware);
const hasAppDir = outputs.appPages.length > 0 || outputs.appRoutes.length > 0;
const hasPagesDir = outputs.pages.length > 0 || outputs.pagesApi.length > 0;
const shouldHandleMiddlewareDataResolving = routing.shouldNormalizeNextData;
const i18nConfig = config.i18n;
const vercelConfig2 = {
version: 3,
overrides: {},
wildcard: i18nConfig?.domains ? i18nConfig.domains.map((item) => {
return {
domain: item.domain,
value: item.defaultLocale === i18nConfig.defaultLocale ? "" : `/${item.defaultLocale}`
};
}) : void 0,
images: getImagesConfig(config)
};
await handlePublicFiles(
import_node_path2.default.join(projectDir, "public"),
vercelOutputDir,
config
);
await handleStaticOutputs(outputs.staticFiles, {
config,
vercelConfig: vercelConfig2,
vercelOutputDir
});
const nodeOutputsParentMap = /* @__PURE__ */ new Map();
const edgeOutputs = [];
const nodeOutputs = [];
let hasNotFoundOutput = false;
let has404Output = false;
let has500Output = false;
for (const output of [
...outputs.appPages,
...outputs.appRoutes,
...outputs.pages,
...outputs.pagesApi,
...outputs.staticFiles
]) {
if (output.pathname.endsWith("/404")) {
hasNotFoundOutput = false;
has404Output = true;
}
if (!has404Output && output.pathname.endsWith("/_not-found")) {
hasNotFoundOutput = true;
}
if (output.pathname.endsWith("/500")) {
has500Output = true;
}
if ("runtime" in output) {
if (output.runtime === "nodejs") {
nodeOutputsParentMap.set(output.id, output);
nodeOutputs.push(output);
} else if (output.runtime === "edge") {
edgeOutputs.push(output);
}
}
}
for (const output of outputs.staticFiles) {
if (output.pathname.endsWith("/_not-found")) {
hasNotFoundOutput = true;
}
if (output.pathname.endsWith("/404")) {
has404Output = true;
}
if (output.pathname.endsWith("/500")) {
has500Output = true;
}
}
const notFoundPath = hasNotFoundOutput ? "/_not-found" : has404Output ? "/404" : "/_error";
await handleEdgeOutputs(edgeOutputs, {
repoRoot,
projectDir,
vercelOutputDir,
nextVersion,
config,
distDir
});
const prerenderFallbackFalseMap = {};
for (const prerender of outputs.prerenders) {
if (prerender.parentFallbackMode === false && !prerender.pathname.includes("_next/data") && !prerender.pathname.endsWith(".rsc")) {
const parentOutput = nodeOutputsParentMap.get(prerender.parentOutputId);
if (!parentOutput) {
throw new Error(
`Invariant: missing parent output ${prerender.parentOutputId} for prerender ${JSON.stringify(prerender)}`
);
}
const parentPage = parentOutput.pathname.substring(
config.basePath.length
);
let currentMap = prerenderFallbackFalseMap[parentPage];
if (!currentMap) {
currentMap = prerenderFallbackFalseMap[parentPage] = [];
}
currentMap.push(prerender.pathname.substring(config.basePath.length));
}
}
let middlewareRoutes = [];
if (outputs.middleware) {
middlewareRoutes = await handleMiddleware(outputs.middleware, {
config,
distDir,
repoRoot,
projectDir,
vercelOutputDir,
nextVersion,
prerenderFallbackFalseMap
});
}
await handleNodeOutputs(nodeOutputs, {
config,
distDir,
repoRoot,
projectDir,
nextVersion,
vercelOutputDir,
prerenderFallbackFalseMap
});
await handlePrerenderOutputs(outputs.prerenders, {
config,
hasAppEntries: outputs.appPages.length > 0,
varyHeader: routing.rsc.varyHeader,
vercelOutputDir,
nodeOutputsParentMap,
rscContentType: routing.rsc.contentTypeHeader
});
const shouldHandleSegmentPrefetches = outputs.appPages.length > 0;
const convertedRewrites = normalizeRewrites(routing);
if (shouldHandleSegmentPrefetches) {
modifyWithRewriteHeaders(convertedRewrites.beforeFiles, {
shouldHandleSegmentPrefetches
});
modifyWithRewriteHeaders(convertedRewrites.afterFiles, {
isAfterFilesRewrite: true,
shouldHandleSegmentPrefetches
});
modifyWithRewriteHeaders(convertedRewrites.fallback, {
shouldHandleSegmentPrefetches
});
}
const { priority: priorityRedirects, normal: redirects } = extractRedirects(routing);
const headers = extractHeaders(routing);
const onMatchRoutes = extractOnMatchRoutes(routing);
const dynamicRoutes = [];
let addedNextData404Route = false;
for (const route of routing.dynamicRoutes) {
if (hasPagesDir && !hasMiddleware) {
if (!route.sourceRegex.includes("_next/data") && !addedNextData404Route) {
addedNextData404Route = true;
dynamicRoutes.push({
src: import_node_path2.default.posix.join("/", config.basePath || "", "_next/data/(.*)"),
dest: import_node_path2.default.posix.join("/", config.basePath || "", "404"),
status: 404,
check: true
});
}
}
dynamicRoutes.push({
src: route.sourceRegex,
dest: route.destination,
check: true,
has: route.has,
missing: route.missing
});
}
vercelConfig2.routes = [
/*
Desired routes order
- Runtime headers
- User headers and redirects
- Runtime redirects
- Runtime routes
- Check filesystem, if nothing found continue
- User rewrites
- Builder rewrites
*/
...priorityRedirects,
// normalize _next/data URL before processing redirects
...normalizeNextDataRoutes(
config,
buildId,
shouldHandleMiddlewareDataResolving,
true
),
...config.i18n ? [
// Handle auto-adding current default locale to path based on
// $wildcard
// This is split into two rules to avoid matching the `/index` route as it causes issues with trailing slash redirect
{
src: `^${import_node_path2.default.posix.join(
"/",
config.basePath,
"/"
)}(?!(?:_next/.*|${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})(?:/.*|$))$`,
// we aren't able to ensure trailing slash mode here
// so ensure this comes after the trailing slash redirect
dest: `${config.basePath && config.basePath !== "/" ? import_node_path2.default.posix.join("/", config.basePath) : ""}$wildcard${config.trailingSlash ? "/" : ""}`,
continue: true
},
{
src: `^${import_node_path2.default.posix.join(
"/",
config.basePath,
"/"
)}(?!(?:_next/.*|${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})(?:/.*|$))(.*)$`,
// we aren't able to ensure trailing slash mode here
// so ensure this comes after the trailing slash redirect
dest: `${config.basePath && config.basePath !== "/" ? import_node_path2.default.posix.join("/", config.basePath) : ""}$wildcard/$1`,
continue: true
},
// Handle redirecting to locale specific domains
...config.i18n.domains && config.i18n.domains.length > 0 && config.i18n.localeDetection !== false ? [
{
src: `^${import_node_path2.default.posix.join(
"/",
config.basePath
)}/?(?:${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})?/?$`,
locale: {
redirect: config.i18n.domains.reduce(
(prev, item) => {
prev[item.defaultLocale] = `http${item.http ? "" : "s"}://${item.domain}/`;
if (item.locales) {
item.locales.map((locale) => {
prev[locale] = `http${item.http ? "" : "s"}://${item.domain}/${locale}`;
});
}
return prev;
},
{}
),
cookie: "NEXT_LOCALE"
},
continue: true
}
] : [],
// Handle redirecting to locale paths
...config.i18n.localeDetection !== false ? [
{
// TODO: if default locale is included in this src it won't
// be visitable by users who prefer another language since a
// cookie isn't set signaling the default locale is
// preferred on redirect currently, investigate adding this
src: "/",
locale: {
redirect: config.i18n.locales.reduce(
(prev, locale) => {
prev[locale] = locale === config.i18n?.defaultLocale ? `/` : `/${locale}`;
return prev;
},
{}
),
cookie: "NEXT_LOCALE"
},
continue: true
}
] : [],
// We only want to add these rewrites before user redirects
// when `skipDefaultLocaleRewrite` is not flagged on
// and when localeDetection is enabled.
{
src: `^${import_node_path2.default.posix.join("/", config.basePath)}$`,
dest: `${import_node_path2.default.posix.join(
"/",
config.basePath,
config.i18n.defaultLocale
)}`,
continue: true
},
// Auto-prefix non-locale path with default locale
// note for prerendered pages this will cause
// x-now-route-matches to contain the path minus the locale
// e.g. for /de/posts/[slug] x-now-route-matches would have
// 1=posts%2Fpost-1
{
src: `^${import_node_path2.default.posix.join(
"/",
config.basePath,
"/"
)}(?!(?:_next/.*|${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})(?:/.*|$))(.*)$`,
dest: `${import_node_path2.default.posix.join(
"/",
config.basePath,
config.i18n.defaultLocale
)}/$1`,
continue: true
}
] : [],
...headers,
...redirects,
// server actions name meta routes - placeholder for server actions
// middleware route - placeholder for middleware configuration
...middlewareRoutes,
...convertedRewrites.beforeFiles,
// add 404 handling if /404 or locale variants are requested literally
...config.i18n ? [
{
src: `${import_node_path2.default.posix.join(
"/",
config.basePath,
"/"
)}(?:${config.i18n.locales.map((locale) => locale.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})?[/]?404/?`,
status: 404,
continue: true,
missing: [
{
type: "header",
key: "x-prerender-revalidate"
}
]
}
] : [
{
src: import_node_path2.default.posix.join("/", config.basePath, "404/?"),
status: 404,
continue: true,
missing: [
{
type: "header",
key: "x-prerender-revalidate"
}
]
}
],
// add 500 handling if /500 or locale variants are requested literally
...config.i18n ? [
{
src: `${import_node_path2.default.posix.join(
"/",
config.basePath,
"/"
)}(?:${config.i18n.locales.map((locale) => locale.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})?[/]?500/?`,
status: 500,
continue: true
}
] : [
{
src: import_node_path2.default.posix.join("/", config.basePath, "500/?"),
status: 500,
continue: true
}
],
// denormalize _next/data if middleware + pages
...denormalizeNextDataRoutes(
config,
buildId,
shouldHandleMiddlewareDataResolving,
true
),
// RSC and prefetch request handling for App Router
...hasAppDir ? [
{
src: import_node_path2.default.posix.join(
"/",
config.basePath,
"/(?<path>.+?)(?:/)?$"
),
dest: import_node_path2.default.posix.join(
"/",
config.basePath,
`/$path${routing.rsc.prefetchSegmentDirSuffix}/$segmentPath${routing.rsc.prefetchSegmentSuffix}`
),
has: [
{
type: "header",
key: routing.rsc.header,
value: "1"
},
{
type: "header",
key: routing.rsc.prefetchHeader,
value: "1"
},
{
type: "header",
key: routing.rsc.prefetchSegmentHeader,
value: "/(?<segmentPath>.+)"
}
],
continue: true,
override: true
},
{
src: import_node_path2.default.posix.join("^/", config.basePath, "/?$"),
dest: import_node_path2.default.posix.join(
"/",
config.basePath,
`/index${routing.rsc.prefetchSegmentDirSuffix}/$segmentPath${routing.rsc.prefetchSegmentSuffix}`
),
has: [
{
type: "header",
key: routing.rsc.header,
value: "1"
},
{
type: "header",
key: routing.rsc.prefetchHeader,
value: "1"
},
{
type: "header",
key: routing.rsc.prefetchSegmentHeader,
value: "/(?<segmentPath>.+)"
}
],
continue: true,
override: true
},
{
src: `^${import_node_path2.default.posix.join("/", config.basePath, "/?")}`,
has: [
{
type: "header",
key: routing.rsc.header,
value: "1"
}
],
dest: import_node_path2.default.posix.join("/", config.basePath, "/index.rsc"),
headers: {
vary: routing.rsc.varyHeader
},
continue: true,
override: true
},
{
src: `^${import_node_path2.default.posix.join(
"/",
config.basePath,
"/((?!.+\\.rsc).+?)(?:/)?$"
)}`,
has: [
{
type: "header",
key: routing.rsc.header,
value: "1"
}
],
dest: import_node_path2.default.posix.join("/", config.basePath, "/$1.rsc"),
headers: {
vary: routing.rsc.varyHeader
},
continue: true,
override: true
}
] : [],
{ handle: "filesystem" },
// ensure the basePath prefixed _next/image is rewritten to the root
// _next/image path
...config.basePath ? [
{
src: import_node_path2.default.posix.join("/", config.basePath, "_next/image/?"),
dest: "/_next/image",
check: true
}
] : [],
// normalize _next/data if middleware + pages
...normalizeNextDataRoutes(
config,
buildId,
shouldHandleMiddlewareDataResolving,
false
),
...!hasMiddleware ? [
// No-op _next/data rewrite to trigger handle: 'rewrites' and then 404
// if no match to prevent rewriting _next/data unexpectedly
{
src: import_node_path2.default.posix.join("/", config.basePath, "_next/data/(.*)"),
dest: import_node_path2.default.posix.join("/", config.basePath, "_next/data/$1"),
check: true
}
] : [],
// normalize /index.rsc to just / for App Router
...hasAppDir ? [
{
src: import_node_path2.default.posix.join(
"/",
config.basePath,
"/index(\\.action|\\.rsc)"
),
dest: import_node_path2.default.posix.join("/", config.basePath),
continue: true
}
] : [],
...convertedRewrites.afterFiles,
// ensure bad rewrites with /.rsc are fixed for App Router
...hasAppDir ? [
{
src: import_node_path2.default.posix.join("/", config.basePath, "/\\.rsc$"),
dest: import_node_path2.default.posix.join("/", config.basePath, `/index.rsc`),
check: true
},
{
src: import_node_path2.default.posix.join("/", config.basePath, "(.+)/\\.rsc$"),
dest: import_node_path2.default.posix.join("/", config.basePath, "$1.rsc"),
check: true
}
] : [],
{ handle: "resource" },
...convertedRewrites.fallback,
// make sure 404 page is used when a directory is matched without
// an index page
{ src: import_node_path2.default.posix.join("/", config.basePath, ".*"), status: 404 },
{ handle: "miss" },
// 404 to plain text file for _next/static
{
src: import_node_path2.default.posix.join("/", config.basePath, "_next/static/.+"),
status: 404,
check: true,
dest: import_node_path2.default.posix.join(
"/",
config.basePath,
"_next/static/not-found.txt"
),
headers: {
"content-type": "text/plain; charset=utf-8"
}
},
// if i18n is enabled attempt removing locale prefix to check public files
// remove locale prefixes to check public files and
// to allow checking non-prefixed lambda outputs
...config.i18n ? [
// When `skipDefaultLocaleRewrite` is flagged on and localeDetection is disabled,
// we only want to add the rewrite as the fallback case once routing is complete.
...config.i18n?.localeDetection === false ? [
{
src: `^${import_node_path2.default.posix.join("/", config.basePath)}$`,
dest: `${import_node_path2.default.posix.join(
"/",
config.basePath,
config.i18n.defaultLocale
)}`,
check: true
},
// Auto-prefix non-locale path with default locale
// note for prerendered pages this will cause
// x-now-route-matches to contain the path minus the locale
// e.g. for /de/posts/[slug] x-now-route-matches would have
// 1=posts%2Fpost-1
{
src: `^${import_node_path2.default.posix.join(
"/",
config.basePath,
"/"
)}(?!(?:_next/.*|${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})(?:/.*|$))(.*)$`,
dest: `${import_node_path2.default.posix.join(
"/",
config.basePath,
config.i18n.defaultLocale
)}/$1`,
check: true
}
] : [],
{
src: import_node_path2.default.posix.join(
"/",
config.basePath,
escapeStringRegexp(config.i18n.defaultLocale)
),
dest: "/",
check: true
},
{
src: `^${import_node_path2.default.posix.join(
"/",
config.basePath
)}/?(?:${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})/(.*)`,
dest: `${import_node_path2.default.posix.join("/", config.basePath, "/")}$1`,
check: true
}
] : [],
// If it didn't match any of the static routes or dynamic ones, then we
// should fallback to either prefetch or normal RSC request
...shouldHandleSegmentPrefetches ? [
{
src: "^/(?<path>.+)(?<rscSuffix>\\.segments/.+\\.segment\\.rsc)(?:/)?$",
dest: `/$path.rsc`,
check: true
}
] : [],
{ handle: "rewrite" },
// denormalize _next/data if middleware + pages - placeholder
...denormalizeNextDataRoutes(
config,
buildId,
shouldHandleMiddlewareDataResolving,
false
),
// apply _next/data routes (including static ones if middleware + pages)
// This would require the data routes from the Next.js build manifest
// apply normal dynamic routes
...dynamicRoutes,
// apply x-nextjs-matched-path header and __next_data_catchall rewrite
// if middleware + pages - placeholder for middleware handling
...hasMiddleware ? [
{
src: `^${import_node_path2.default.posix.join(
"/",
config.basePath,
"/_next/data/",
escapedBuildId,
"/(.*).json"
)}`,
headers: {
"x-nextjs-matched-path": "/$1"
},
continue: true,
override: true
},
// add a catch-all data route so we don't 404 when getting
// middleware effects
{
src: `^${import_node_path2.default.posix.join(
"/",
config.basePath,
"/_next/data/",
escapedBuildId,
"/(.*).json"
)}`,
dest: "__next_data_catchall"
}
] : [],
{ handle: "hit" },
...onMatchRoutes,
// add internal matched path header for function bundle mapping
{
src: config.basePath && config.basePath !== "/" ? import_node_path2.default.posix.join("/", config.basePath, "/?(?:index)?(?:/)?$") : `/(?:index)?(?:/)?$`,
headers: {
"x-matched-path": "/"
},
continue: true,
important: true
},
{
src: import_node_path2.default.posix.join(
"/",
config.basePath || "",
`/((?!index$).*?)(?:/)?$`
),
headers: {
"x-matched-path": "/$1"
},
continue: true,
important: true
},
{ handle: "error" },
// Custom Next.js 404 page
...config.i18n ? [
{
src: `${import_node_path2.default.posix.join(
"/",
config.basePath,
"/"
)}(?<nextLocale>${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})(/.*|$)`,
dest: import_node_path2.default.posix.join(
"/",
config.basePath,
"/$nextLocale",
notFoundPath
),
status: 404,
caseSensitive: true
},
{
src: import_node_path2.default.posix.join("/", config.basePath, ".*"),
dest: import_node_path2.default.posix.join(
"/",
config.basePath,
`/${config.i18n.defaultLocale}`,
notFoundPath
),
status: 404
}
] : [
{
src: import_node_path2.default.posix.join(
"/",
config.basePath,
// if config.basePath is populated we need to
// add optional handling for trailing slash so
// that the config.basePath (basePath) itself matches
`${config.basePath && config.basePath !== "/" ? "?" : ""}.*`
),
dest: import_node_path2.default.posix.join("/", config.basePath, notFoundPath),
status: 404
}
],
// custom 500 page if present
...config.i18n && has500Output ? [
{
src: `${import_node_path2.default.posix.join(
"/",
config.basePath,
"/"
)}(?<nextLocale>${config.i18n.locales.map((locale) => escapeStringRegexp(locale)).join("|")})(/.*|$)`,
dest: import_node_path2.default.posix.join("/", config.basePath, "/$nextLocale/500"),
status: 500,
caseSensitive: true
},
{
src: import_node_path2.default.posix.join("/", config.basePath, ".*"),
dest: import_node_path2.default.posix.join(
"/",
config.basePath,
`/${config.i18n.defaultLocale}/500`
),
status: 500
}
] : [
{
src: import_node_path2.default.posix.join(
"/",
config.basePath,
// if config.basePath is populated we need to
// add optional handling for trailing slash so
// that the config.basePath (basePath) itself matches
`${config.basePath && config.basePath !== "/" ? "?" : ""}.*`
),
dest: import_node_path2.default.posix.join(
"/",
config.basePath,
has500Output ? "/500" : "/_error"
),
status: 500
}
]
];
const outputConfigPath = import_node_path2.default.join(vercelOutputDir, "config.json");
await import_promises2.default.writeFile(outputConfigPath, JSON.stringify(vercelConfig2, null, 2));
}
};
module.exports = myAdapter;
/*! Bundled license information:
bytes/index.js:
(*!
* bytes
* Copyright(c) 2012-2014 TJ Holowaychuk
* Copyright(c) 2015 Jed Watson
* MIT Licensed
*)
*/