full site update
This commit is contained in:
471
node_modules/rollup/dist/shared/rollup.js
generated
vendored
471
node_modules/rollup/dist/shared/rollup.js
generated
vendored
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
@license
|
||||
Rollup.js v4.41.0
|
||||
Sun, 18 May 2025 05:33:01 GMT - commit 0928185cd544907dab472754634ddf988452aae6
|
||||
Rollup.js v4.45.1
|
||||
Tue, 15 Jul 2025 13:08:50 GMT - commit a9b04957eac7803e61390d4387e3e96dbe4118c4
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
@@ -17,7 +17,32 @@ const native_js = require('../native.js');
|
||||
const node_perf_hooks = require('node:perf_hooks');
|
||||
const promises = require('node:fs/promises');
|
||||
|
||||
var version = "4.41.0";
|
||||
function _interopNamespaceDefault(e) {
|
||||
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
||||
if (e) {
|
||||
for (const k in e) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
}
|
||||
n.default = e;
|
||||
return n;
|
||||
}
|
||||
|
||||
function _mergeNamespaces(n, m) {
|
||||
for (var i = 0; i < m.length; i++) {
|
||||
const e = m[i];
|
||||
if (typeof e !== 'string' && !Array.isArray(e)) { for (const k in e) {
|
||||
if (k !== 'default' && !(k in n)) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
} }
|
||||
}
|
||||
return Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' });
|
||||
}
|
||||
|
||||
const promises__namespace = /*#__PURE__*/_interopNamespaceDefault(promises);
|
||||
|
||||
var version = "4.45.1";
|
||||
|
||||
function ensureArray$1(items) {
|
||||
if (Array.isArray(items)) {
|
||||
@@ -887,6 +912,7 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
||||
error(error_) {
|
||||
return parseAst_js.error(parseAst_js.logPluginError(normalizeLog(error_), plugin.name));
|
||||
},
|
||||
fs: options.fs,
|
||||
getFileName: fileEmitter.getFileName,
|
||||
getModuleIds: () => graph.modulesById.keys(),
|
||||
getModuleInfo: graph.getModuleInfo,
|
||||
@@ -918,7 +944,11 @@ function getAugmentedNamespace(n) {
|
||||
var f = n.default;
|
||||
if (typeof f == "function") {
|
||||
var a = function a () {
|
||||
if (this instanceof a) {
|
||||
var isInstance = false;
|
||||
try {
|
||||
isInstance = this instanceof a;
|
||||
} catch {}
|
||||
if (isInstance) {
|
||||
return Reflect.construct(f, arguments, this.constructor);
|
||||
}
|
||||
return f.apply(this, arguments);
|
||||
@@ -3514,7 +3544,7 @@ async function mergeOptions(config, watchMode, rawCommandOptions = EMPTY_COMMAND
|
||||
outputOptionsArray.push({});
|
||||
const outputOptions = await Promise.all(outputOptionsArray.map(singleOutputOptions => mergeOutputOptions(singleOutputOptions, command, log)));
|
||||
warnUnknownOptions(command, [
|
||||
...Object.keys(inputOptions),
|
||||
...Object.keys(inputOptions).filter(option => option !== 'fs'),
|
||||
...Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapIgnoreList' && option !== 'sourcemapPathTransform'),
|
||||
...Object.keys(commandAliases),
|
||||
'bundleConfigAsCjs',
|
||||
@@ -3560,6 +3590,7 @@ function mergeInputOptions(config, overrides, plugins, log, onLog) {
|
||||
experimentalCacheExpiry: getOption('experimentalCacheExpiry'),
|
||||
experimentalLogSideEffects: getOption('experimentalLogSideEffects'),
|
||||
external: getExternal(config, overrides),
|
||||
fs: getOption('fs'),
|
||||
input: getOption('input') || [],
|
||||
jsx: getObjectOption(config, overrides, 'jsx', objectifyOptionWithPresets(jsxPresets, 'jsx', parseAst_js.URL_JSX, 'false, ')),
|
||||
logLevel: getOption('logLevel'),
|
||||
@@ -3803,189 +3834,176 @@ function handleError(error, recover = false) {
|
||||
process$1.exit(1);
|
||||
}
|
||||
|
||||
const comma = ','.charCodeAt(0);
|
||||
const semicolon = ';'.charCodeAt(0);
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
const intToChar = new Uint8Array(64); // 64 possible chars.
|
||||
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
||||
// src/vlq.ts
|
||||
var comma = ",".charCodeAt(0);
|
||||
var semicolon = ";".charCodeAt(0);
|
||||
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
var intToChar = new Uint8Array(64);
|
||||
var charToInt = new Uint8Array(128);
|
||||
for (let i = 0; i < chars.length; i++) {
|
||||
const c = chars.charCodeAt(i);
|
||||
intToChar[i] = c;
|
||||
charToInt[c] = i;
|
||||
const c = chars.charCodeAt(i);
|
||||
intToChar[i] = c;
|
||||
charToInt[c] = i;
|
||||
}
|
||||
function decodeInteger(reader, relative) {
|
||||
let value = 0;
|
||||
let shift = 0;
|
||||
let integer = 0;
|
||||
do {
|
||||
const c = reader.next();
|
||||
integer = charToInt[c];
|
||||
value |= (integer & 31) << shift;
|
||||
shift += 5;
|
||||
} while (integer & 32);
|
||||
const shouldNegate = value & 1;
|
||||
value >>>= 1;
|
||||
if (shouldNegate) {
|
||||
value = -2147483648 | -value;
|
||||
}
|
||||
return relative + value;
|
||||
let value = 0;
|
||||
let shift = 0;
|
||||
let integer = 0;
|
||||
do {
|
||||
const c = reader.next();
|
||||
integer = charToInt[c];
|
||||
value |= (integer & 31) << shift;
|
||||
shift += 5;
|
||||
} while (integer & 32);
|
||||
const shouldNegate = value & 1;
|
||||
value >>>= 1;
|
||||
if (shouldNegate) {
|
||||
value = -2147483648 | -value;
|
||||
}
|
||||
return relative + value;
|
||||
}
|
||||
function encodeInteger(builder, num, relative) {
|
||||
let delta = num - relative;
|
||||
delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
|
||||
do {
|
||||
let clamped = delta & 0b011111;
|
||||
delta >>>= 5;
|
||||
if (delta > 0)
|
||||
clamped |= 0b100000;
|
||||
builder.write(intToChar[clamped]);
|
||||
} while (delta > 0);
|
||||
return num;
|
||||
let delta = num - relative;
|
||||
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
||||
do {
|
||||
let clamped = delta & 31;
|
||||
delta >>>= 5;
|
||||
if (delta > 0) clamped |= 32;
|
||||
builder.write(intToChar[clamped]);
|
||||
} while (delta > 0);
|
||||
return num;
|
||||
}
|
||||
function hasMoreVlq(reader, max) {
|
||||
if (reader.pos >= max)
|
||||
return false;
|
||||
return reader.peek() !== comma;
|
||||
if (reader.pos >= max) return false;
|
||||
return reader.peek() !== comma;
|
||||
}
|
||||
|
||||
const bufLength = 1024 * 16;
|
||||
// Provide a fallback for older environments.
|
||||
const td = typeof TextDecoder !== 'undefined'
|
||||
? /* #__PURE__ */ new TextDecoder()
|
||||
: typeof Buffer !== 'undefined'
|
||||
? {
|
||||
decode(buf) {
|
||||
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||
return out.toString();
|
||||
},
|
||||
}
|
||||
: {
|
||||
decode(buf) {
|
||||
let out = '';
|
||||
for (let i = 0; i < buf.length; i++) {
|
||||
out += String.fromCharCode(buf[i]);
|
||||
}
|
||||
return out;
|
||||
},
|
||||
};
|
||||
class StringWriter {
|
||||
constructor() {
|
||||
this.pos = 0;
|
||||
this.out = '';
|
||||
this.buffer = new Uint8Array(bufLength);
|
||||
// src/strings.ts
|
||||
var bufLength = 1024 * 16;
|
||||
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
|
||||
decode(buf) {
|
||||
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||
return out.toString();
|
||||
}
|
||||
} : {
|
||||
decode(buf) {
|
||||
let out = "";
|
||||
for (let i = 0; i < buf.length; i++) {
|
||||
out += String.fromCharCode(buf[i]);
|
||||
}
|
||||
write(v) {
|
||||
const { buffer } = this;
|
||||
buffer[this.pos++] = v;
|
||||
if (this.pos === bufLength) {
|
||||
this.out += td.decode(buffer);
|
||||
this.pos = 0;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
};
|
||||
var StringWriter = class {
|
||||
constructor() {
|
||||
this.pos = 0;
|
||||
this.out = "";
|
||||
this.buffer = new Uint8Array(bufLength);
|
||||
}
|
||||
write(v) {
|
||||
const { buffer } = this;
|
||||
buffer[this.pos++] = v;
|
||||
if (this.pos === bufLength) {
|
||||
this.out += td.decode(buffer);
|
||||
this.pos = 0;
|
||||
}
|
||||
flush() {
|
||||
const { buffer, out, pos } = this;
|
||||
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
||||
}
|
||||
}
|
||||
class StringReader {
|
||||
constructor(buffer) {
|
||||
this.pos = 0;
|
||||
this.buffer = buffer;
|
||||
}
|
||||
next() {
|
||||
return this.buffer.charCodeAt(this.pos++);
|
||||
}
|
||||
peek() {
|
||||
return this.buffer.charCodeAt(this.pos);
|
||||
}
|
||||
indexOf(char) {
|
||||
const { buffer, pos } = this;
|
||||
const idx = buffer.indexOf(char, pos);
|
||||
return idx === -1 ? buffer.length : idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
flush() {
|
||||
const { buffer, out, pos } = this;
|
||||
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
||||
}
|
||||
};
|
||||
var StringReader = class {
|
||||
constructor(buffer) {
|
||||
this.pos = 0;
|
||||
this.buffer = buffer;
|
||||
}
|
||||
next() {
|
||||
return this.buffer.charCodeAt(this.pos++);
|
||||
}
|
||||
peek() {
|
||||
return this.buffer.charCodeAt(this.pos);
|
||||
}
|
||||
indexOf(char) {
|
||||
const { buffer, pos } = this;
|
||||
const idx = buffer.indexOf(char, pos);
|
||||
return idx === -1 ? buffer.length : idx;
|
||||
}
|
||||
};
|
||||
|
||||
// src/sourcemap-codec.ts
|
||||
function decode(mappings) {
|
||||
const { length } = mappings;
|
||||
const reader = new StringReader(mappings);
|
||||
const decoded = [];
|
||||
let genColumn = 0;
|
||||
let sourcesIndex = 0;
|
||||
let sourceLine = 0;
|
||||
let sourceColumn = 0;
|
||||
let namesIndex = 0;
|
||||
do {
|
||||
const semi = reader.indexOf(';');
|
||||
const line = [];
|
||||
let sorted = true;
|
||||
let lastCol = 0;
|
||||
genColumn = 0;
|
||||
while (reader.pos < semi) {
|
||||
let seg;
|
||||
genColumn = decodeInteger(reader, genColumn);
|
||||
if (genColumn < lastCol)
|
||||
sorted = false;
|
||||
lastCol = genColumn;
|
||||
if (hasMoreVlq(reader, semi)) {
|
||||
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
||||
sourceLine = decodeInteger(reader, sourceLine);
|
||||
sourceColumn = decodeInteger(reader, sourceColumn);
|
||||
if (hasMoreVlq(reader, semi)) {
|
||||
namesIndex = decodeInteger(reader, namesIndex);
|
||||
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
||||
}
|
||||
else {
|
||||
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
||||
}
|
||||
}
|
||||
else {
|
||||
seg = [genColumn];
|
||||
}
|
||||
line.push(seg);
|
||||
reader.pos++;
|
||||
const { length } = mappings;
|
||||
const reader = new StringReader(mappings);
|
||||
const decoded = [];
|
||||
let genColumn = 0;
|
||||
let sourcesIndex = 0;
|
||||
let sourceLine = 0;
|
||||
let sourceColumn = 0;
|
||||
let namesIndex = 0;
|
||||
do {
|
||||
const semi = reader.indexOf(";");
|
||||
const line = [];
|
||||
let sorted = true;
|
||||
let lastCol = 0;
|
||||
genColumn = 0;
|
||||
while (reader.pos < semi) {
|
||||
let seg;
|
||||
genColumn = decodeInteger(reader, genColumn);
|
||||
if (genColumn < lastCol) sorted = false;
|
||||
lastCol = genColumn;
|
||||
if (hasMoreVlq(reader, semi)) {
|
||||
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
||||
sourceLine = decodeInteger(reader, sourceLine);
|
||||
sourceColumn = decodeInteger(reader, sourceColumn);
|
||||
if (hasMoreVlq(reader, semi)) {
|
||||
namesIndex = decodeInteger(reader, namesIndex);
|
||||
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
||||
} else {
|
||||
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
||||
}
|
||||
if (!sorted)
|
||||
sort(line);
|
||||
decoded.push(line);
|
||||
reader.pos = semi + 1;
|
||||
} while (reader.pos <= length);
|
||||
return decoded;
|
||||
} else {
|
||||
seg = [genColumn];
|
||||
}
|
||||
line.push(seg);
|
||||
reader.pos++;
|
||||
}
|
||||
if (!sorted) sort(line);
|
||||
decoded.push(line);
|
||||
reader.pos = semi + 1;
|
||||
} while (reader.pos <= length);
|
||||
return decoded;
|
||||
}
|
||||
function sort(line) {
|
||||
line.sort(sortComparator);
|
||||
line.sort(sortComparator);
|
||||
}
|
||||
function sortComparator(a, b) {
|
||||
return a[0] - b[0];
|
||||
return a[0] - b[0];
|
||||
}
|
||||
function encode(decoded) {
|
||||
const writer = new StringWriter();
|
||||
let sourcesIndex = 0;
|
||||
let sourceLine = 0;
|
||||
let sourceColumn = 0;
|
||||
let namesIndex = 0;
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const line = decoded[i];
|
||||
if (i > 0)
|
||||
writer.write(semicolon);
|
||||
if (line.length === 0)
|
||||
continue;
|
||||
let genColumn = 0;
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const segment = line[j];
|
||||
if (j > 0)
|
||||
writer.write(comma);
|
||||
genColumn = encodeInteger(writer, segment[0], genColumn);
|
||||
if (segment.length === 1)
|
||||
continue;
|
||||
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
||||
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
||||
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
||||
if (segment.length === 4)
|
||||
continue;
|
||||
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
||||
}
|
||||
const writer = new StringWriter();
|
||||
let sourcesIndex = 0;
|
||||
let sourceLine = 0;
|
||||
let sourceColumn = 0;
|
||||
let namesIndex = 0;
|
||||
for (let i = 0; i < decoded.length; i++) {
|
||||
const line = decoded[i];
|
||||
if (i > 0) writer.write(semicolon);
|
||||
if (line.length === 0) continue;
|
||||
let genColumn = 0;
|
||||
for (let j = 0; j < line.length; j++) {
|
||||
const segment = line[j];
|
||||
if (j > 0) writer.write(comma);
|
||||
genColumn = encodeInteger(writer, segment[0], genColumn);
|
||||
if (segment.length === 1) continue;
|
||||
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
||||
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
||||
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
||||
if (segment.length === 4) continue;
|
||||
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
||||
}
|
||||
return writer.flush();
|
||||
}
|
||||
return writer.flush();
|
||||
}
|
||||
|
||||
class BitSet {
|
||||
@@ -6743,6 +6761,9 @@ function isPropertyNode(node) {
|
||||
function isArrowFunctionExpressionNode(node) {
|
||||
return node instanceof NodeBase && node.type === parseAst_js.ArrowFunctionExpression;
|
||||
}
|
||||
function isFunctionExpressionNode(node) {
|
||||
return node instanceof NodeBase && node.type === parseAst_js.FunctionExpression;
|
||||
}
|
||||
function isCallExpressionNode(node) {
|
||||
return node instanceof NodeBase && node.type === parseAst_js.CallExpression;
|
||||
}
|
||||
@@ -8897,7 +8918,8 @@ class LocalVariable extends Variable {
|
||||
* })
|
||||
*/
|
||||
if (this.kind === 'parameter' &&
|
||||
isArrowFunctionExpressionNode(declaration.parent) &&
|
||||
(isArrowFunctionExpressionNode(declaration.parent) ||
|
||||
isFunctionExpressionNode(declaration.parent)) &&
|
||||
isCallExpressionNode(declaration.parent.parent) &&
|
||||
isMemberExpressionNode(declaration.parent.parent.callee) &&
|
||||
isIdentifierNode(declaration.parent.parent.callee.property) &&
|
||||
@@ -10275,6 +10297,7 @@ class BlockStatement extends NodeBase {
|
||||
}
|
||||
initialise() {
|
||||
super.initialise();
|
||||
this.scope.context.magicString.addSourcemapLocation(this.end - 1);
|
||||
const firstBodyStatement = this.body[0];
|
||||
this.deoptimizeBody =
|
||||
firstBodyStatement instanceof ExpressionStatement &&
|
||||
@@ -13813,11 +13836,20 @@ class ConditionalExpression extends NodeBase {
|
||||
set isBranchResolutionAnalysed(value) {
|
||||
this.flags = setFlag(this.flags, 65536 /* Flag.isBranchResolutionAnalysed */, value);
|
||||
}
|
||||
get hasDeoptimizedCache() {
|
||||
return isFlagSet(this.flags, 33554432 /* Flag.hasDeoptimizedCache */);
|
||||
}
|
||||
set hasDeoptimizedCache(value) {
|
||||
this.flags = setFlag(this.flags, 33554432 /* Flag.hasDeoptimizedCache */, value);
|
||||
}
|
||||
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
||||
this.consequent.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
||||
this.alternate.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
||||
}
|
||||
deoptimizeCache() {
|
||||
if (this.hasDeoptimizedCache)
|
||||
return;
|
||||
this.hasDeoptimizedCache = true;
|
||||
if (this.usedBranch !== null) {
|
||||
const unusedBranch = this.usedBranch === this.consequent ? this.alternate : this.consequent;
|
||||
this.usedBranch = null;
|
||||
@@ -13844,8 +13876,23 @@ class ConditionalExpression extends NodeBase {
|
||||
}
|
||||
getLiteralValueAtPath(path, recursionTracker, origin) {
|
||||
const usedBranch = this.getUsedBranch();
|
||||
if (!usedBranch)
|
||||
return UnknownValue;
|
||||
if (!usedBranch) {
|
||||
if (this.hasDeoptimizedCache) {
|
||||
return UnknownValue;
|
||||
}
|
||||
const consequentValue = this.consequent.getLiteralValueAtPath(path, recursionTracker, origin);
|
||||
const castedConsequentValue = tryCastLiteralValueToBoolean(consequentValue);
|
||||
if (castedConsequentValue === UnknownValue)
|
||||
return UnknownValue;
|
||||
const alternateValue = this.alternate.getLiteralValueAtPath(path, recursionTracker, origin);
|
||||
const castedAlternateValue = tryCastLiteralValueToBoolean(alternateValue);
|
||||
if (castedConsequentValue !== castedAlternateValue)
|
||||
return UnknownValue;
|
||||
this.expressionsToBeDeoptimized.push(origin);
|
||||
if (consequentValue !== alternateValue)
|
||||
return castedConsequentValue ? UnknownTruthyValue : UnknownFalsyValue;
|
||||
return consequentValue;
|
||||
}
|
||||
this.expressionsToBeDeoptimized.push(origin);
|
||||
return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
|
||||
}
|
||||
@@ -16695,8 +16742,11 @@ class UnaryExpression extends NodeBase {
|
||||
if (!this.deoptimized)
|
||||
this.applyDeoptimizations();
|
||||
this.included = true;
|
||||
// Check if the argument is an identifier that should be preserved as a reference for readability
|
||||
const shouldPreserveArgument = this.argument instanceof Identifier && this.argument.variable?.included;
|
||||
if (typeof this.getRenderedLiteralValue(includeChildrenRecursively) === 'symbol' ||
|
||||
this.argument.shouldBeIncluded(context)) {
|
||||
this.argument.shouldBeIncluded(context) ||
|
||||
shouldPreserveArgument) {
|
||||
this.argument.include(context, includeChildrenRecursively);
|
||||
this.renderedLiteralValue = UnknownValue;
|
||||
}
|
||||
@@ -17305,7 +17355,10 @@ const bufferParsers = [
|
||||
const body = (node.body = new Array(length));
|
||||
for (let index = 0; index < length; index++) {
|
||||
const nodePosition = buffer[bodyPosition + 1 + index];
|
||||
body[index] = convertNode(node, (buffer[nodePosition + 3] & 1) === 0 ? scope.instanceScope : scope, nodePosition, buffer);
|
||||
body[index] = convertNode(node, buffer[nodePosition] !== 79 &&
|
||||
(buffer[nodePosition + 3] & /* the static flag is always first */ 1) === 0
|
||||
? scope.instanceScope
|
||||
: scope, nodePosition, buffer);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -17993,14 +18046,18 @@ function getOriginalLocation(sourcemapChain, location) {
|
||||
if (line) {
|
||||
const filteredLine = line.filter((segment) => segment.length > 1);
|
||||
const lastSegment = filteredLine[filteredLine.length - 1];
|
||||
for (const segment of filteredLine) {
|
||||
let previousSegment = filteredLine[0];
|
||||
for (let segment of filteredLine) {
|
||||
if (segment[0] >= location.column || segment === lastSegment) {
|
||||
const notMatched = segment[0] !== location.column;
|
||||
segment = notMatched ? previousSegment : segment;
|
||||
location = {
|
||||
column: segment[3],
|
||||
line: segment[2] + 1
|
||||
};
|
||||
continue traceSourcemap;
|
||||
}
|
||||
previousSegment = segment;
|
||||
}
|
||||
}
|
||||
throw new Error("Can't resolve original location of error.");
|
||||
@@ -21482,10 +21539,21 @@ class Link {
|
||||
let searchEnd = segments.length - 1;
|
||||
while (searchStart <= searchEnd) {
|
||||
const m = (searchStart + searchEnd) >> 1;
|
||||
const segment = segments[m];
|
||||
let segment = segments[m];
|
||||
// If a sourcemap does not have sufficient resolution to contain a
|
||||
// necessary mapping, e.g. because it only contains line information, we
|
||||
// use the best approximation we could find
|
||||
// necessary mapping, e.g. because it only contains line information or
|
||||
// the column is not precise (e.g. the sourcemap is generated by esbuild, segment[0] may be shorter than the location of the first letter),
|
||||
// we approximate by finding the closest segment whose segment[0] is less than the given column
|
||||
if (segment[0] !== column && searchStart === searchEnd) {
|
||||
let approximatedSegmentIndex = 0;
|
||||
for (let index = 0; index < segments.length; index++) {
|
||||
if (segments[index][0] > column) {
|
||||
break;
|
||||
}
|
||||
approximatedSegmentIndex = index;
|
||||
}
|
||||
segment = segments[approximatedSegmentIndex];
|
||||
}
|
||||
if (segment[0] === column || searchStart === searchEnd) {
|
||||
if (segment.length == 1)
|
||||
return null;
|
||||
@@ -22050,6 +22118,16 @@ function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolve
|
||||
...pluginContext,
|
||||
resolve: (source, importer, { attributes, custom, isEntry, skipSelf } = parseAst_js.BLANK) => {
|
||||
skipSelf ??= true;
|
||||
if (skipSelf &&
|
||||
skip.findIndex(skippedCall => {
|
||||
return (skippedCall.plugin === plugin &&
|
||||
skippedCall.source === source &&
|
||||
skippedCall.importer === importer);
|
||||
}) !== -1) {
|
||||
// This means that the plugin recursively called itself
|
||||
// Thus returning Promise.resolve(null) in purpose of fallback to default behavior of `resolveId` plugin hook.
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
return moduleLoaderResolveId(source, importer, custom, isEntry, attributes || parseAst_js.EMPTY_OBJECT, skipSelf ? [...skip, { importer, plugin, source }] : skip);
|
||||
}
|
||||
});
|
||||
@@ -22057,7 +22135,7 @@ function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolve
|
||||
return pluginDriver.hookFirstAndGetPlugin('resolveId', [source, importer, { attributes, custom: customOptions, isEntry }], replaceContext, skipped);
|
||||
}
|
||||
|
||||
async function resolveId(source, importer, preserveSymlinks, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, attributes) {
|
||||
async function resolveId(source, importer, preserveSymlinks, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, attributes, fs) {
|
||||
const pluginResult = await resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, attributes);
|
||||
if (pluginResult != null) {
|
||||
const [resolveIdResult, plugin] = pluginResult;
|
||||
@@ -22083,22 +22161,22 @@ async function resolveId(source, importer, preserveSymlinks, pluginDriver, modul
|
||||
// absolute path is created. Absolute importees therefore shortcircuit the
|
||||
// resolve call and require no special handing on our part.
|
||||
// See https://nodejs.org/api/path.html#path_path_resolve_paths
|
||||
return addJsExtensionIfNecessary(importer ? path.resolve(path.dirname(importer), source) : path.resolve(source), preserveSymlinks);
|
||||
return addJsExtensionIfNecessary(importer ? path.resolve(path.dirname(importer), source) : path.resolve(source), preserveSymlinks, fs);
|
||||
}
|
||||
async function addJsExtensionIfNecessary(file, preserveSymlinks) {
|
||||
return ((await findFile(file, preserveSymlinks)) ??
|
||||
(await findFile(file + '.mjs', preserveSymlinks)) ??
|
||||
(await findFile(file + '.js', preserveSymlinks)));
|
||||
async function addJsExtensionIfNecessary(file, preserveSymlinks, fs) {
|
||||
return ((await findFile(file, preserveSymlinks, fs)) ??
|
||||
(await findFile(file + '.mjs', preserveSymlinks, fs)) ??
|
||||
(await findFile(file + '.js', preserveSymlinks, fs)));
|
||||
}
|
||||
async function findFile(file, preserveSymlinks) {
|
||||
async function findFile(file, preserveSymlinks, fs) {
|
||||
try {
|
||||
const stats = await promises.lstat(file);
|
||||
const stats = await fs.lstat(file);
|
||||
if (!preserveSymlinks && stats.isSymbolicLink())
|
||||
return await findFile(await promises.realpath(file), preserveSymlinks);
|
||||
return await findFile(await fs.realpath(file), preserveSymlinks, fs);
|
||||
if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
|
||||
// check case
|
||||
const name = path.basename(file);
|
||||
const files = await promises.readdir(path.dirname(file));
|
||||
const files = await fs.readdir(path.dirname(file));
|
||||
if (files.includes(name))
|
||||
return file;
|
||||
}
|
||||
@@ -22249,7 +22327,7 @@ class ModuleLoader {
|
||||
this.nextEntryModuleIndex = 0;
|
||||
this.resolveId = async (source, importer, customOptions, isEntry, attributes, skip = null) => this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
|
||||
? false
|
||||
: await resolveId(source, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, skip, customOptions, typeof isEntry === 'boolean' ? isEntry : !importer, attributes), importer, source), attributes);
|
||||
: await resolveId(source, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, skip, customOptions, typeof isEntry === 'boolean' ? isEntry : !importer, attributes, this.options.fs), importer, source), attributes);
|
||||
this.hasModuleSideEffects = options.treeshake
|
||||
? options.treeshake.moduleSideEffects
|
||||
: () => true;
|
||||
@@ -22340,7 +22418,7 @@ class ModuleLoader {
|
||||
if (content !== null)
|
||||
return content;
|
||||
this.graph.watchFiles[id] = true;
|
||||
return await promises.readFile(id, 'utf8');
|
||||
return (await this.options.fs.readFile(id, { encoding: 'utf8' }));
|
||||
});
|
||||
}
|
||||
catch (error_) {
|
||||
@@ -22608,7 +22686,7 @@ class ModuleLoader {
|
||||
return resolvedId;
|
||||
}
|
||||
async loadEntryModule(unresolvedId, isEntry, importer, implicitlyLoadedBefore, isLoadForManualChunks = false) {
|
||||
const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, parseAst_js.EMPTY_OBJECT, true, parseAst_js.EMPTY_OBJECT);
|
||||
const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, parseAst_js.EMPTY_OBJECT, true, parseAst_js.EMPTY_OBJECT, this.options.fs);
|
||||
if (resolveIdResult == null) {
|
||||
return parseAst_js.error(implicitlyLoadedBefore === null
|
||||
? parseAst_js.logUnresolvedEntry(unresolvedId)
|
||||
@@ -22958,6 +23036,10 @@ async function catchUnfinishedHookActions(pluginDriver, callback) {
|
||||
|
||||
async function initWasm() { }
|
||||
|
||||
const fs = /*#__PURE__*/_mergeNamespaces({
|
||||
__proto__: null
|
||||
}, [promises__namespace]);
|
||||
|
||||
async function normalizeInputOptions(config, watchMode) {
|
||||
// These are options that may trigger special warnings or behaviour later
|
||||
// if the user did not select an explicit value
|
||||
@@ -22974,6 +23056,7 @@ async function normalizeInputOptions(config, watchMode) {
|
||||
experimentalCacheExpiry: config.experimentalCacheExpiry ?? 10,
|
||||
experimentalLogSideEffects: config.experimentalLogSideEffects || false,
|
||||
external: getIdMatcher(config.external),
|
||||
fs: config.fs ?? fs,
|
||||
input: getInput(config),
|
||||
jsx: getJsx(config),
|
||||
logLevel,
|
||||
@@ -23068,7 +23151,7 @@ const getMaxParallelFileOps = (config) => {
|
||||
return Infinity;
|
||||
return maxParallelFileOps;
|
||||
}
|
||||
return 20;
|
||||
return 1000;
|
||||
};
|
||||
const getModuleContext = (config, context) => {
|
||||
const configModuleContext = config.moduleContext;
|
||||
@@ -23541,7 +23624,7 @@ async function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, raw
|
||||
if (!outputOptions.dir && !outputOptions.file) {
|
||||
return parseAst_js.error(parseAst_js.logMissingFileOrDirOption());
|
||||
}
|
||||
await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions))));
|
||||
await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions, inputOptions))));
|
||||
await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
|
||||
timeEnd('WRITE', 1);
|
||||
}
|
||||
@@ -23590,11 +23673,11 @@ function getSortingFileType(file) {
|
||||
}
|
||||
return SortingFileType.SECONDARY_CHUNK;
|
||||
}
|
||||
async function writeOutputFile(outputFile, outputOptions) {
|
||||
async function writeOutputFile(outputFile, outputOptions, { fs: { mkdir, writeFile } }) {
|
||||
const fileName = path.resolve(outputOptions.dir || path.dirname(outputOptions.file), outputFile.fileName);
|
||||
// 'recursive: true' does not throw if the folder structure, or parts of it, already exist
|
||||
await promises.mkdir(path.dirname(fileName), { recursive: true });
|
||||
return promises.writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
|
||||
await mkdir(path.dirname(fileName), { recursive: true });
|
||||
return writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
|
||||
}
|
||||
/**
|
||||
* Auxiliary function for defining rollup configuration
|
||||
|
Reference in New Issue
Block a user