@getpochi/cli 0.5.42 → 0.5.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +714 -348
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -19555,8 +19555,8 @@ var init_fiberRuntime = __esm(() => {
|
|
|
19555
19555
|
const clockService = get8(this.getFiberRef(currentServices), clockTag);
|
|
19556
19556
|
const date6 = new Date(clockService.unsafeCurrentTimeMillis());
|
|
19557
19557
|
withRedactableContext(contextMap, () => {
|
|
19558
|
-
for (const
|
|
19559
|
-
|
|
19558
|
+
for (const logger8 of loggers) {
|
|
19559
|
+
logger8.log({
|
|
19560
19560
|
fiberId: this.id(),
|
|
19561
19561
|
logLevel,
|
|
19562
19562
|
message,
|
|
@@ -20453,16 +20453,16 @@ __export(exports_Scope, {
|
|
|
20453
20453
|
addFinalizerExit: () => addFinalizerExit,
|
|
20454
20454
|
addFinalizer: () => addFinalizer2,
|
|
20455
20455
|
ScopeTypeId: () => ScopeTypeId2,
|
|
20456
|
-
Scope: () =>
|
|
20456
|
+
Scope: () => Scope2,
|
|
20457
20457
|
CloseableScopeTypeId: () => CloseableScopeTypeId2
|
|
20458
20458
|
});
|
|
20459
|
-
var ScopeTypeId2, CloseableScopeTypeId2,
|
|
20459
|
+
var ScopeTypeId2, CloseableScopeTypeId2, Scope2, addFinalizer2, addFinalizerExit, close, extend4, fork2, use, make41;
|
|
20460
20460
|
var init_Scope = __esm(() => {
|
|
20461
20461
|
init_core();
|
|
20462
20462
|
init_fiberRuntime();
|
|
20463
20463
|
ScopeTypeId2 = ScopeTypeId;
|
|
20464
20464
|
CloseableScopeTypeId2 = CloseableScopeTypeId;
|
|
20465
|
-
|
|
20465
|
+
Scope2 = scopeTag;
|
|
20466
20466
|
addFinalizer2 = scopeAddFinalizer;
|
|
20467
20467
|
addFinalizerExit = scopeAddFinalizerExit;
|
|
20468
20468
|
close = scopeClose;
|
|
@@ -21493,7 +21493,7 @@ var init_layer = __esm(() => {
|
|
|
21493
21493
|
const effect = tagFirst ? b2 : a3;
|
|
21494
21494
|
return scopedContext(map14(effect, (service) => make11(tag, service)));
|
|
21495
21495
|
});
|
|
21496
|
-
scope2 = /* @__PURE__ */ scopedContext(/* @__PURE__ */ map14(/* @__PURE__ */ acquireRelease(/* @__PURE__ */ scopeMake(), (scope3, exit2) => scope3.close(exit2)), (scope3) => make11(
|
|
21496
|
+
scope2 = /* @__PURE__ */ scopedContext(/* @__PURE__ */ map14(/* @__PURE__ */ acquireRelease(/* @__PURE__ */ scopeMake(), (scope3, exit2) => scope3.close(exit2)), (scope3) => make11(Scope2, scope3)));
|
|
21497
21497
|
succeed8 = /* @__PURE__ */ dual(2, (a3, b2) => {
|
|
21498
21498
|
const tagFirst = isTag2(a3);
|
|
21499
21499
|
const tag = tagFirst ? a3 : b2;
|
|
@@ -24934,7 +24934,7 @@ var init_FiberRef = __esm(() => {
|
|
|
24934
24934
|
});
|
|
24935
24935
|
|
|
24936
24936
|
// ../../node_modules/effect/dist/esm/internal/layer/circular.js
|
|
24937
|
-
var minimumLogLevel = (level) => scopedDiscard(fiberRefLocallyScoped(currentMinimumLogLevel, level)), withMinimumLogLevel, addLogger = (
|
|
24937
|
+
var minimumLogLevel = (level) => scopedDiscard(fiberRefLocallyScoped(currentMinimumLogLevel, level)), withMinimumLogLevel, addLogger = (logger8) => scopedDiscard(fiberRefLocallyScopedWith(currentLoggers, add2(logger8))), addLoggerEffect = (effect) => unwrapEffect(map14(effect, addLogger)), addLoggerScoped = (effect) => unwrapScoped(map14(effect, addLogger)), removeLogger = (logger8) => scopedDiscard(fiberRefLocallyScopedWith(currentLoggers, remove6(logger8))), replaceLogger, replaceLoggerEffect, replaceLoggerScoped, setConfigProvider = (configProvider) => scopedDiscard(withConfigProviderScoped(configProvider)), parentSpan = (span2) => succeedContext(make11(spanTag, span2)), span2 = (name17, options) => {
|
|
24938
24938
|
options = addSpanStackTrace(options);
|
|
24939
24939
|
return scoped2(spanTag, options?.onEnd ? tap2(makeSpanScoped(name17, options), (span3) => addFinalizer((exit3) => options.onEnd(span3, exit3))) : makeSpanScoped(name17, options));
|
|
24940
24940
|
}, setTracer = (tracer3) => scopedDiscard(withTracerScoped(tracer3));
|
|
@@ -48293,7 +48293,7 @@ var PlatformWorkerTypeId, PlatformWorker, WorkerManagerTypeId, WorkerManager, Sp
|
|
|
48293
48293
|
yield* addFinalizer2(scope5, sync6(() => {
|
|
48294
48294
|
currentPort = undefined;
|
|
48295
48295
|
}));
|
|
48296
|
-
const runtime6 = (yield* runtime4()).pipe(updateContext3(omit3(
|
|
48296
|
+
const runtime6 = (yield* runtime4()).pipe(updateContext3(omit3(Scope2)));
|
|
48297
48297
|
const fiberSet = yield* make78();
|
|
48298
48298
|
const runFork4 = runFork3(runtime6);
|
|
48299
48299
|
yield* options3.listen({
|
|
@@ -52788,7 +52788,7 @@ var init_RpcClient = __esm(() => {
|
|
|
52788
52788
|
const disableTracing = options3?.disableTracing ?? false;
|
|
52789
52789
|
const generateRequestId = options3?.generateRequestId ?? (() => requestIdCounter++);
|
|
52790
52790
|
const context10 = yield* context3();
|
|
52791
|
-
const scope5 = get8(context10,
|
|
52791
|
+
const scope5 = get8(context10, Scope2);
|
|
52792
52792
|
const entries3 = new Map;
|
|
52793
52793
|
let isShutdown8 = false;
|
|
52794
52794
|
yield* addFinalizer2(scope5, fiberIdWith2((fiberId4) => {
|
|
@@ -52893,7 +52893,7 @@ var init_RpcClient = __esm(() => {
|
|
|
52893
52893
|
});
|
|
52894
52894
|
const fiber = getOrThrow2(getCurrentFiber2());
|
|
52895
52895
|
const id3 = generateRequestId();
|
|
52896
|
-
const scope6 = unsafeGet5(fiber.currentContext,
|
|
52896
|
+
const scope6 = unsafeGet5(fiber.currentContext, Scope2);
|
|
52897
52897
|
yield* addFinalizerExit(scope6, (exit3) => {
|
|
52898
52898
|
if (!entries3.has(id3))
|
|
52899
52899
|
return _void3;
|
|
@@ -54898,7 +54898,7 @@ var init_httpApp = __esm(() => {
|
|
|
54898
54898
|
});
|
|
54899
54899
|
|
|
54900
54900
|
// ../../node_modules/@effect/platform/dist/esm/internal/httpMiddleware.js
|
|
54901
|
-
var make89 = (middleware) => middleware, loggerDisabled, withLoggerDisabled = (self2) => zipRight7(set10(loggerDisabled, true), self2), currentTracerDisabledWhen2, withTracerDisabledWhen2, withTracerDisabledWhenEffect, withTracerDisabledForUrls, SpanNameGenerator2, withSpanNameGenerator2,
|
|
54901
|
+
var make89 = (middleware) => middleware, loggerDisabled, withLoggerDisabled = (self2) => zipRight7(set10(loggerDisabled, true), self2), currentTracerDisabledWhen2, withTracerDisabledWhen2, withTracerDisabledWhenEffect, withTracerDisabledForUrls, SpanNameGenerator2, withSpanNameGenerator2, logger8, tracer3, xForwardedHeaders, searchParamsParser = (httpApp) => withFiberRuntime2((fiber) => {
|
|
54902
54902
|
const context10 = fiber.currentContext;
|
|
54903
54903
|
const request2 = unsafeGet5(context10, HttpServerRequest);
|
|
54904
54904
|
const params = searchParamsFromURL2(new URL(request2.originalUrl));
|
|
@@ -55013,7 +55013,7 @@ var init_httpMiddleware = __esm(() => {
|
|
|
55013
55013
|
defaultValue: () => (request2) => `http.server ${request2.method}`
|
|
55014
55014
|
});
|
|
55015
55015
|
withSpanNameGenerator2 = /* @__PURE__ */ dual(2, (self2, f3) => provide3(self2, succeed12(SpanNameGenerator2, f3)));
|
|
55016
|
-
|
|
55016
|
+
logger8 = /* @__PURE__ */ make89((httpApp) => {
|
|
55017
55017
|
let counter6 = 0;
|
|
55018
55018
|
return withFiberRuntime2((fiber) => {
|
|
55019
55019
|
const request2 = unsafeGet5(fiber.currentContext, HttpServerRequest);
|
|
@@ -56050,16 +56050,16 @@ __export(exports_HttpMiddleware, {
|
|
|
56050
56050
|
searchParamsParser: () => searchParamsParser2,
|
|
56051
56051
|
make: () => make92,
|
|
56052
56052
|
loggerDisabled: () => loggerDisabled2,
|
|
56053
|
-
logger: () =>
|
|
56053
|
+
logger: () => logger9,
|
|
56054
56054
|
currentTracerDisabledWhen: () => currentTracerDisabledWhen3,
|
|
56055
56055
|
cors: () => cors2,
|
|
56056
56056
|
SpanNameGenerator: () => SpanNameGenerator3
|
|
56057
56057
|
});
|
|
56058
|
-
var make92,
|
|
56058
|
+
var make92, logger9, loggerDisabled2, withLoggerDisabled2, currentTracerDisabledWhen3, withTracerDisabledWhen3, withTracerDisabledWhenEffect2, withTracerDisabledForUrls2, xForwardedHeaders2, searchParamsParser2, cors2, SpanNameGenerator3, withSpanNameGenerator3;
|
|
56059
56059
|
var init_HttpMiddleware = __esm(() => {
|
|
56060
56060
|
init_httpMiddleware();
|
|
56061
56061
|
make92 = make89;
|
|
56062
|
-
|
|
56062
|
+
logger9 = logger8;
|
|
56063
56063
|
loggerDisabled2 = loggerDisabled;
|
|
56064
56064
|
withLoggerDisabled2 = withLoggerDisabled;
|
|
56065
56065
|
currentTracerDisabledWhen3 = currentTracerDisabledWhen2;
|
|
@@ -56708,7 +56708,7 @@ var init_HttpLayerRouter = __esm(() => {
|
|
|
56708
56708
|
const stack = [context10.unsafeMap.get(fnContextKey)];
|
|
56709
56709
|
if (this.dependencies) {
|
|
56710
56710
|
const memoMap = yield* CurrentMemoMap2;
|
|
56711
|
-
const scope5 = get8(context10,
|
|
56711
|
+
const scope5 = get8(context10, Scope2);
|
|
56712
56712
|
const depsContext = yield* buildWithMemoMap2(this.dependencies, memoMap, scope5);
|
|
56713
56713
|
stack.push(...getMiddleware(depsContext));
|
|
56714
56714
|
}
|
|
@@ -56861,7 +56861,7 @@ var init_RpcServer = __esm(() => {
|
|
|
56861
56861
|
const concurrency = options4.concurrency ?? "unbounded";
|
|
56862
56862
|
const disableFatalDefects = options4.disableFatalDefects ?? false;
|
|
56863
56863
|
const context10 = yield* context3();
|
|
56864
|
-
const scope5 = get8(context10,
|
|
56864
|
+
const scope5 = get8(context10, Scope2);
|
|
56865
56865
|
const fiberSet = yield* make78();
|
|
56866
56866
|
const runFork4 = yield* runtime5(fiberSet)().pipe(interruptible4);
|
|
56867
56867
|
const concurrencySemaphore = concurrency === "unbounded" ? undefined : yield* makeSemaphore2(concurrency);
|
|
@@ -77133,14 +77133,14 @@ var init_debug_info = __esm(() => {
|
|
|
77133
77133
|
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
77134
77134
|
|
|
77135
77135
|
// ../../node_modules/nanoid/index.js
|
|
77136
|
-
import { webcrypto as
|
|
77136
|
+
import { webcrypto as crypto7 } from "node:crypto";
|
|
77137
77137
|
function fillPool(bytes) {
|
|
77138
77138
|
if (!pool || pool.length < bytes) {
|
|
77139
77139
|
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
|
|
77140
|
-
|
|
77140
|
+
crypto7.getRandomValues(pool);
|
|
77141
77141
|
poolOffset = 0;
|
|
77142
77142
|
} else if (poolOffset + bytes > pool.length) {
|
|
77143
|
-
|
|
77143
|
+
crypto7.getRandomValues(pool);
|
|
77144
77144
|
poolOffset = 0;
|
|
77145
77145
|
}
|
|
77146
77146
|
poolOffset += bytes;
|
|
@@ -88574,7 +88574,7 @@ var init_resourceMap = __esm(() => {
|
|
|
88574
88574
|
discard: true
|
|
88575
88575
|
});
|
|
88576
88576
|
});
|
|
88577
|
-
return new ResourceMap((key2, scope6) => provide2(lookup(key2), add4(context15,
|
|
88577
|
+
return new ResourceMap((key2, scope6) => provide2(lookup(key2), add4(context15, Scope2, scope6)), entries4, isClosed);
|
|
88578
88578
|
});
|
|
88579
88579
|
get(key2) {
|
|
88580
88580
|
return withFiberRuntime2((fiber) => {
|
|
@@ -88958,7 +88958,7 @@ var init_entityManager = __esm(() => {
|
|
|
88958
88958
|
let defectRequestIds = [];
|
|
88959
88959
|
const writeRef = yield* ResourceRef.from(scope5, fnUntraced2(function* (scope6) {
|
|
88960
88960
|
let isShuttingDown = false;
|
|
88961
|
-
const handlers = yield* entity.protocol.toHandlersContext(buildHandlers).pipe(provide2(context15.pipe(add4(CurrentAddress, address), add4(CurrentRunnerAddress, options6.runnerAddress), add4(
|
|
88961
|
+
const handlers = yield* entity.protocol.toHandlersContext(buildHandlers).pipe(provide2(context15.pipe(add4(CurrentAddress, address), add4(CurrentRunnerAddress, options6.runnerAddress), add4(Scope2, scope6))), locally2(currentLogAnnotations2, empty11()));
|
|
88962
88962
|
const server = yield* makeNoSerialization2(entity.protocol, {
|
|
88963
88963
|
spanPrefix: `${entity.type}(${address.entityId})`,
|
|
88964
88964
|
spanAttributes: {
|
|
@@ -90870,7 +90870,7 @@ var init_Sharding = __esm(() => {
|
|
|
90870
90870
|
storage,
|
|
90871
90871
|
runnerAddress: config5.runnerAddress.value,
|
|
90872
90872
|
sharding
|
|
90873
|
-
}).pipe(provide2(context15.pipe(add4(EntityReaper, reaper), add4(
|
|
90873
|
+
}).pipe(provide2(context15.pipe(add4(EntityReaper, reaper), add4(Scope2, scope5), add4(Generator2, snowflakeGen))));
|
|
90874
90874
|
entityManagers.set(entity.type, {
|
|
90875
90875
|
entity,
|
|
90876
90876
|
scope: scope5,
|
|
@@ -96417,11 +96417,11 @@ var require_util2 = __commonJS((exports, module) => {
|
|
|
96417
96417
|
var { isUint8Array: isUint8Array4 } = __require("node:util/types");
|
|
96418
96418
|
var { webidl } = require_webidl();
|
|
96419
96419
|
var supportedHashes = [];
|
|
96420
|
-
var
|
|
96420
|
+
var crypto8;
|
|
96421
96421
|
try {
|
|
96422
|
-
|
|
96422
|
+
crypto8 = __require("node:crypto");
|
|
96423
96423
|
const possibleRelevantHashes = ["sha256", "sha384", "sha512"];
|
|
96424
|
-
supportedHashes =
|
|
96424
|
+
supportedHashes = crypto8.getHashes().filter((hash4) => possibleRelevantHashes.includes(hash4));
|
|
96425
96425
|
} catch {}
|
|
96426
96426
|
function responseURL(response) {
|
|
96427
96427
|
const urlList = response.urlList;
|
|
@@ -96723,7 +96723,7 @@ var require_util2 = __commonJS((exports, module) => {
|
|
|
96723
96723
|
return isOriginPotentiallyTrustworthy(url3.origin);
|
|
96724
96724
|
}
|
|
96725
96725
|
function bytesMatch(bytes, metadataList) {
|
|
96726
|
-
if (
|
|
96726
|
+
if (crypto8 === undefined) {
|
|
96727
96727
|
return true;
|
|
96728
96728
|
}
|
|
96729
96729
|
const parsedMetadata = parseMetadata(metadataList);
|
|
@@ -96738,7 +96738,7 @@ var require_util2 = __commonJS((exports, module) => {
|
|
|
96738
96738
|
for (const item of metadata) {
|
|
96739
96739
|
const algorithm = item.algo;
|
|
96740
96740
|
const expectedValue = item.hash;
|
|
96741
|
-
let actualValue =
|
|
96741
|
+
let actualValue = crypto8.createHash(algorithm).update(bytes).digest("base64");
|
|
96742
96742
|
if (actualValue[actualValue.length - 1] === "=") {
|
|
96743
96743
|
if (actualValue[actualValue.length - 2] === "=") {
|
|
96744
96744
|
actualValue = actualValue.slice(0, -2);
|
|
@@ -97661,8 +97661,8 @@ var require_body = __commonJS((exports, module) => {
|
|
|
97661
97661
|
var { createDeferredPromise } = require_promise();
|
|
97662
97662
|
var random5;
|
|
97663
97663
|
try {
|
|
97664
|
-
const
|
|
97665
|
-
random5 = (max10) =>
|
|
97664
|
+
const crypto8 = __require("node:crypto");
|
|
97665
|
+
random5 = (max10) => crypto8.randomInt(0, max10);
|
|
97666
97666
|
} catch {
|
|
97667
97667
|
random5 = (max10) => Math.floor(Math.random() * max10);
|
|
97668
97668
|
}
|
|
@@ -109953,13 +109953,13 @@ var require_util5 = __commonJS((exports, module) => {
|
|
|
109953
109953
|
var require_frame = __commonJS((exports, module) => {
|
|
109954
109954
|
var { maxUnsigned16Bit, opcodes } = require_constants5();
|
|
109955
109955
|
var BUFFER_SIZE = 8 * 1024;
|
|
109956
|
-
var
|
|
109956
|
+
var crypto8;
|
|
109957
109957
|
var buffer4 = null;
|
|
109958
109958
|
var bufIdx = BUFFER_SIZE;
|
|
109959
109959
|
try {
|
|
109960
|
-
|
|
109960
|
+
crypto8 = __require("node:crypto");
|
|
109961
109961
|
} catch {
|
|
109962
|
-
|
|
109962
|
+
crypto8 = {
|
|
109963
109963
|
randomFillSync: function randomFillSync(buffer5, _offset, _size2) {
|
|
109964
109964
|
for (let i6 = 0;i6 < buffer5.length; ++i6) {
|
|
109965
109965
|
buffer5[i6] = Math.random() * 255 | 0;
|
|
@@ -109971,7 +109971,7 @@ var require_frame = __commonJS((exports, module) => {
|
|
|
109971
109971
|
function generateMask() {
|
|
109972
109972
|
if (bufIdx === BUFFER_SIZE) {
|
|
109973
109973
|
bufIdx = 0;
|
|
109974
|
-
|
|
109974
|
+
crypto8.randomFillSync(buffer4 ??= Buffer.allocUnsafeSlow(BUFFER_SIZE), 0, BUFFER_SIZE);
|
|
109975
109975
|
}
|
|
109976
109976
|
return [buffer4[bufIdx++], buffer4[bufIdx++], buffer4[bufIdx++], buffer4[bufIdx++]];
|
|
109977
109977
|
}
|
|
@@ -110062,9 +110062,9 @@ var require_connection = __commonJS((exports, module) => {
|
|
|
110062
110062
|
var { getDecodeSplit } = require_util2();
|
|
110063
110063
|
var { WebsocketFrameSend } = require_frame();
|
|
110064
110064
|
var assert5 = __require("node:assert");
|
|
110065
|
-
var
|
|
110065
|
+
var crypto8;
|
|
110066
110066
|
try {
|
|
110067
|
-
|
|
110067
|
+
crypto8 = __require("node:crypto");
|
|
110068
110068
|
} catch {}
|
|
110069
110069
|
function establishWebSocketConnection(url3, protocols, client, handler2, options6) {
|
|
110070
110070
|
const requestURL = url3;
|
|
@@ -110083,7 +110083,7 @@ var require_connection = __commonJS((exports, module) => {
|
|
|
110083
110083
|
const headersList = getHeadersList(new Headers2(options6.headers));
|
|
110084
110084
|
request4.headersList = headersList;
|
|
110085
110085
|
}
|
|
110086
|
-
const keyValue =
|
|
110086
|
+
const keyValue = crypto8.randomBytes(16).toString("base64");
|
|
110087
110087
|
request4.headersList.append("sec-websocket-key", keyValue, true);
|
|
110088
110088
|
request4.headersList.append("sec-websocket-version", "13", true);
|
|
110089
110089
|
for (const protocol of protocols) {
|
|
@@ -110116,7 +110116,7 @@ var require_connection = __commonJS((exports, module) => {
|
|
|
110116
110116
|
return;
|
|
110117
110117
|
}
|
|
110118
110118
|
const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
|
|
110119
|
-
const digest =
|
|
110119
|
+
const digest = crypto8.createHash("sha1").update(keyValue + uid).digest("base64");
|
|
110120
110120
|
if (secWSAccept !== digest) {
|
|
110121
110121
|
failWebsocketConnection(handler2, 1002, "Incorrect hash received in Sec-WebSocket-Accept header.");
|
|
110122
110122
|
return;
|
|
@@ -114130,7 +114130,7 @@ var require_websocket2 = __commonJS((exports, module) => {
|
|
|
114130
114130
|
var http4 = __require("http");
|
|
114131
114131
|
var net = __require("net");
|
|
114132
114132
|
var tls = __require("tls");
|
|
114133
|
-
var { randomBytes:
|
|
114133
|
+
var { randomBytes: randomBytes5, createHash: createHash5 } = __require("crypto");
|
|
114134
114134
|
var { Duplex: Duplex2, Readable: Readable4 } = __require("stream");
|
|
114135
114135
|
var { URL: URL2 } = __require("url");
|
|
114136
114136
|
var PerMessageDeflate = require_permessage_deflate2();
|
|
@@ -114539,7 +114539,7 @@ var require_websocket2 = __commonJS((exports, module) => {
|
|
|
114539
114539
|
}
|
|
114540
114540
|
}
|
|
114541
114541
|
const defaultPort = isSecure ? 443 : 80;
|
|
114542
|
-
const key2 =
|
|
114542
|
+
const key2 = randomBytes5(16).toString("base64");
|
|
114543
114543
|
const request4 = isSecure ? https2.request : http4.request;
|
|
114544
114544
|
const protocolSet = new Set;
|
|
114545
114545
|
let perMessageDeflate;
|
|
@@ -114662,7 +114662,7 @@ var require_websocket2 = __commonJS((exports, module) => {
|
|
|
114662
114662
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
114663
114663
|
return;
|
|
114664
114664
|
}
|
|
114665
|
-
const digest =
|
|
114665
|
+
const digest = createHash5("sha1").update(key2 + GUID).digest("base64");
|
|
114666
114666
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
114667
114667
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
114668
114668
|
return;
|
|
@@ -115035,7 +115035,7 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
115035
115035
|
var EventEmitter = __require("events");
|
|
115036
115036
|
var http4 = __require("http");
|
|
115037
115037
|
var { Duplex: Duplex2 } = __require("stream");
|
|
115038
|
-
var { createHash:
|
|
115038
|
+
var { createHash: createHash5 } = __require("crypto");
|
|
115039
115039
|
var extension2 = require_extension();
|
|
115040
115040
|
var PerMessageDeflate = require_permessage_deflate2();
|
|
115041
115041
|
var subprotocol = require_subprotocol();
|
|
@@ -115243,7 +115243,7 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
115243
115243
|
}
|
|
115244
115244
|
if (this._state > RUNNING)
|
|
115245
115245
|
return abortHandshake(socket, 503);
|
|
115246
|
-
const digest =
|
|
115246
|
+
const digest = createHash5("sha1").update(key2 + GUID).digest("base64");
|
|
115247
115247
|
const headers = [
|
|
115248
115248
|
"HTTP/1.1 101 Switching Protocols",
|
|
115249
115249
|
"Upgrade: websocket",
|
|
@@ -118433,7 +118433,7 @@ var require_websocket3 = __commonJS((exports, module) => {
|
|
|
118433
118433
|
var http4 = __require("http");
|
|
118434
118434
|
var net = __require("net");
|
|
118435
118435
|
var tls = __require("tls");
|
|
118436
|
-
var { randomBytes:
|
|
118436
|
+
var { randomBytes: randomBytes6, createHash: createHash5 } = __require("crypto");
|
|
118437
118437
|
var { Duplex: Duplex2, Readable: Readable6 } = __require("stream");
|
|
118438
118438
|
var { URL: URL2 } = __require("url");
|
|
118439
118439
|
var PerMessageDeflate = require_permessage_deflate3();
|
|
@@ -118842,7 +118842,7 @@ var require_websocket3 = __commonJS((exports, module) => {
|
|
|
118842
118842
|
}
|
|
118843
118843
|
}
|
|
118844
118844
|
const defaultPort = isSecure ? 443 : 80;
|
|
118845
|
-
const key2 =
|
|
118845
|
+
const key2 = randomBytes6(16).toString("base64");
|
|
118846
118846
|
const request4 = isSecure ? https2.request : http4.request;
|
|
118847
118847
|
const protocolSet = new Set;
|
|
118848
118848
|
let perMessageDeflate;
|
|
@@ -118965,7 +118965,7 @@ var require_websocket3 = __commonJS((exports, module) => {
|
|
|
118965
118965
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
118966
118966
|
return;
|
|
118967
118967
|
}
|
|
118968
|
-
const digest =
|
|
118968
|
+
const digest = createHash5("sha1").update(key2 + GUID).digest("base64");
|
|
118969
118969
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
118970
118970
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
118971
118971
|
return;
|
|
@@ -119338,7 +119338,7 @@ var require_websocket_server2 = __commonJS((exports, module) => {
|
|
|
119338
119338
|
var EventEmitter = __require("events");
|
|
119339
119339
|
var http4 = __require("http");
|
|
119340
119340
|
var { Duplex: Duplex2 } = __require("stream");
|
|
119341
|
-
var { createHash:
|
|
119341
|
+
var { createHash: createHash5 } = __require("crypto");
|
|
119342
119342
|
var extension2 = require_extension2();
|
|
119343
119343
|
var PerMessageDeflate = require_permessage_deflate3();
|
|
119344
119344
|
var subprotocol = require_subprotocol2();
|
|
@@ -119546,7 +119546,7 @@ var require_websocket_server2 = __commonJS((exports, module) => {
|
|
|
119546
119546
|
}
|
|
119547
119547
|
if (this._state > RUNNING)
|
|
119548
119548
|
return abortHandshake(socket, 503);
|
|
119549
|
-
const digest =
|
|
119549
|
+
const digest = createHash5("sha1").update(key2 + GUID).digest("base64");
|
|
119550
119550
|
const headers = [
|
|
119551
119551
|
"HTTP/1.1 101 Switching Protocols",
|
|
119552
119552
|
"Upgrade: websocket",
|
|
@@ -120111,7 +120111,7 @@ var init_workerRunner3 = __esm(() => {
|
|
|
120111
120111
|
const unsafeSend = WorkerThreads.parentPort ? (message, transfers) => WorkerThreads.parentPort.postMessage(message, transfers) : (message, _transfers) => process.send(message);
|
|
120112
120112
|
const send = (_portId, message, transfers) => sync6(() => unsafeSend([1, message], transfers));
|
|
120113
120113
|
const run13 = fnUntraced2(function* (handler2) {
|
|
120114
|
-
const runtime8 = (yield* interruptible4(runtime4())).pipe(updateContext3(omit3(
|
|
120114
|
+
const runtime8 = (yield* interruptible4(runtime4())).pipe(updateContext3(omit3(Scope2)));
|
|
120115
120115
|
const fiberSet = yield* make78();
|
|
120116
120116
|
const runFork4 = runFork3(runtime8);
|
|
120117
120117
|
const onExit5 = (exit4) => {
|
|
@@ -120280,7 +120280,7 @@ var init_ChildProcessRunner = __esm(() => {
|
|
|
120280
120280
|
};
|
|
120281
120281
|
const send = (_portId, message, _transfers) => sync6(() => port2.postMessage([1, message]));
|
|
120282
120282
|
const run13 = fnUntraced2(function* (handler2) {
|
|
120283
|
-
const runtime8 = (yield* interruptible4(runtime4())).pipe(updateContext3(omit3(
|
|
120283
|
+
const runtime8 = (yield* interruptible4(runtime4())).pipe(updateContext3(omit3(Scope2)));
|
|
120284
120284
|
const fiberSet = yield* make78();
|
|
120285
120285
|
const runFork4 = runFork3(runtime8);
|
|
120286
120286
|
const onExit5 = (exit4) => {
|
|
@@ -188922,24 +188922,24 @@ function createLogger(level = "info", options6 = {}) {
|
|
|
188922
188922
|
}
|
|
188923
188923
|
}
|
|
188924
188924
|
const warnedMessages = /* @__PURE__ */ new Set;
|
|
188925
|
-
const
|
|
188925
|
+
const logger18 = {
|
|
188926
188926
|
hasWarned: false,
|
|
188927
188927
|
info(msg, opts) {
|
|
188928
188928
|
output2("info", msg, opts);
|
|
188929
188929
|
},
|
|
188930
188930
|
warn(msg, opts) {
|
|
188931
|
-
|
|
188931
|
+
logger18.hasWarned = true;
|
|
188932
188932
|
output2("warn", msg, opts);
|
|
188933
188933
|
},
|
|
188934
188934
|
warnOnce(msg, opts) {
|
|
188935
188935
|
if (warnedMessages.has(msg))
|
|
188936
188936
|
return;
|
|
188937
|
-
|
|
188937
|
+
logger18.hasWarned = true;
|
|
188938
188938
|
output2("warn", msg, opts);
|
|
188939
188939
|
warnedMessages.add(msg);
|
|
188940
188940
|
},
|
|
188941
188941
|
error(msg, opts) {
|
|
188942
|
-
|
|
188942
|
+
logger18.hasWarned = true;
|
|
188943
188943
|
output2("error", msg, opts);
|
|
188944
188944
|
},
|
|
188945
188945
|
clearScreen(type3) {
|
|
@@ -188950,7 +188950,7 @@ function createLogger(level = "info", options6 = {}) {
|
|
|
188950
188950
|
return loggedErrors.has(error44);
|
|
188951
188951
|
}
|
|
188952
188952
|
};
|
|
188953
|
-
return
|
|
188953
|
+
return logger18;
|
|
188954
188954
|
}
|
|
188955
188955
|
function printServerUrls(urls, optionsHost, info2) {
|
|
188956
188956
|
const colorUrl = (url3) => import_picocolors.default.cyan(url3.replace(/:(\d+)\//, (_7, port2) => `:${import_picocolors.default.bold(port2)}/`));
|
|
@@ -194555,7 +194555,7 @@ for your current platform.`);
|
|
|
194555
194555
|
return { binPath, isWASM };
|
|
194556
194556
|
}
|
|
194557
194557
|
var child_process = __require("child_process");
|
|
194558
|
-
var
|
|
194558
|
+
var crypto8 = __require("crypto");
|
|
194559
194559
|
var path22 = __require("path");
|
|
194560
194560
|
var fs22 = __require("fs");
|
|
194561
194561
|
var os22 = __require("os");
|
|
@@ -194869,7 +194869,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
194869
194869
|
afterClose(null);
|
|
194870
194870
|
};
|
|
194871
194871
|
var randomFileName = () => {
|
|
194872
|
-
return path22.join(os22.tmpdir(), `esbuild-${
|
|
194872
|
+
return path22.join(os22.tmpdir(), `esbuild-${crypto8.randomBytes(32).toString("hex")}`);
|
|
194873
194873
|
};
|
|
194874
194874
|
var workerThreadService = null;
|
|
194875
194875
|
var startWorkerThreadService = (worker_threads2) => {
|
|
@@ -196567,8 +196567,8 @@ var SOURCEMAPPING_URL = "sourceMa", isWindows, windowsSlashRE, postfixRE, AsyncF
|
|
|
196567
196567
|
customListenersMap = /* @__PURE__ */ new Map;
|
|
196568
196568
|
ctxToListenersMap = /* @__PURE__ */ new Map;
|
|
196569
196569
|
currentFirstInvalidatedBy;
|
|
196570
|
-
constructor(
|
|
196571
|
-
this.logger =
|
|
196570
|
+
constructor(logger18, transport, importUpdatedModule) {
|
|
196571
|
+
this.logger = logger18, this.transport = transport, this.importUpdatedModule = importUpdatedModule;
|
|
196572
196572
|
}
|
|
196573
196573
|
async notifyListeners(event, data) {
|
|
196574
196574
|
let cbs = this.customListenersMap.get(event);
|
|
@@ -199834,7 +199834,7 @@ for your current platform.`);
|
|
|
199834
199834
|
return { binPath, isWASM };
|
|
199835
199835
|
}
|
|
199836
199836
|
var child_process = __require("child_process");
|
|
199837
|
-
var
|
|
199837
|
+
var crypto8 = __require("crypto");
|
|
199838
199838
|
var path22 = __require("path");
|
|
199839
199839
|
var fs22 = __require("fs");
|
|
199840
199840
|
var os22 = __require("os");
|
|
@@ -200148,7 +200148,7 @@ More information: The file containing the code for esbuild's JavaScript API (${_
|
|
|
200148
200148
|
afterClose(null);
|
|
200149
200149
|
};
|
|
200150
200150
|
var randomFileName = () => {
|
|
200151
|
-
return path22.join(os22.tmpdir(), `esbuild-${
|
|
200151
|
+
return path22.join(os22.tmpdir(), `esbuild-${crypto8.randomBytes(32).toString("hex")}`);
|
|
200152
200152
|
};
|
|
200153
200153
|
var workerThreadService = null;
|
|
200154
200154
|
var startWorkerThreadService = (worker_threads2) => {
|
|
@@ -204563,11 +204563,11 @@ Defaulting to 2020, but this will stop working in the future.`)), options6.ecmaV
|
|
|
204563
204563
|
if (this.options.locations)
|
|
204564
204564
|
return new Position(this.curLine, this.pos - this.lineStart);
|
|
204565
204565
|
};
|
|
204566
|
-
var pp$3 = Parser.prototype,
|
|
204566
|
+
var pp$3 = Parser.prototype, Scope3 = function(flags) {
|
|
204567
204567
|
this.flags = flags, this.var = [], this.lexical = [], this.functions = [], this.inClassFieldInit = false;
|
|
204568
204568
|
};
|
|
204569
204569
|
pp$3.enterScope = function(flags) {
|
|
204570
|
-
this.scopeStack.push(new
|
|
204570
|
+
this.scopeStack.push(new Scope3(flags));
|
|
204571
204571
|
}, pp$3.exitScope = function() {
|
|
204572
204572
|
this.scopeStack.pop();
|
|
204573
204573
|
}, pp$3.treatFunctionsAsVarInScope = function(scope5) {
|
|
@@ -209096,11 +209096,11 @@ Did you specify these with the most recent transformation maps first?`);
|
|
|
209096
209096
|
}
|
|
209097
209097
|
if (flattenedConfigs.some(({ config: { options: { ignore: ignore7, only } } }) => shouldIgnore(context15, ignore7, only, dirname7)))
|
|
209098
209098
|
return null;
|
|
209099
|
-
const chain = emptyChain(),
|
|
209099
|
+
const chain = emptyChain(), logger18 = createLogger2(input2, context15, baseLogger);
|
|
209100
209100
|
for (const { config: config5, index: index3, envName } of flattenedConfigs) {
|
|
209101
209101
|
if (!(yield* mergeExtendsChain(chain, config5.options, dirname7, context15, files, baseLogger)))
|
|
209102
209102
|
return null;
|
|
209103
|
-
|
|
209103
|
+
logger18(config5, index3, envName), yield* mergeChainOpts(chain, config5);
|
|
209104
209104
|
}
|
|
209105
209105
|
return chain;
|
|
209106
209106
|
};
|
|
@@ -217626,7 +217626,7 @@ If you have already enabled that plugin (or '@babel/preset-typescript'), make su
|
|
|
217626
217626
|
}
|
|
217627
217627
|
const reservedWordLikeSet = new Set(["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "eval", "arguments", "enum", "await"]);
|
|
217628
217628
|
|
|
217629
|
-
class
|
|
217629
|
+
class Scope3 {
|
|
217630
217630
|
constructor(flags) {
|
|
217631
217631
|
this.flags = 0, this.names = new Map, this.firstLexicalName = "", this.flags = flags;
|
|
217632
217632
|
}
|
|
@@ -217671,7 +217671,7 @@ If you have already enabled that plugin (or '@babel/preset-typescript'), make su
|
|
|
217671
217671
|
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
217672
217672
|
}
|
|
217673
217673
|
createScope(flags) {
|
|
217674
|
-
return new
|
|
217674
|
+
return new Scope3(flags);
|
|
217675
217675
|
}
|
|
217676
217676
|
enter(flags) {
|
|
217677
217677
|
this.scopeStack.push(this.createScope(flags));
|
|
@@ -217730,7 +217730,7 @@ If you have already enabled that plugin (or '@babel/preset-typescript'), make su
|
|
|
217730
217730
|
}
|
|
217731
217731
|
}
|
|
217732
217732
|
|
|
217733
|
-
class FlowScope extends
|
|
217733
|
+
class FlowScope extends Scope3 {
|
|
217734
217734
|
constructor(...args2) {
|
|
217735
217735
|
super(...args2), this.declareFunctions = new Set;
|
|
217736
217736
|
}
|
|
@@ -219090,7 +219090,7 @@ If you have already enabled that plugin (or '@babel/preset-typescript'), make su
|
|
|
219090
219090
|
throw new Error("Node had unexpected type: " + object5.type);
|
|
219091
219091
|
}
|
|
219092
219092
|
|
|
219093
|
-
class TypeScriptScope extends
|
|
219093
|
+
class TypeScriptScope extends Scope3 {
|
|
219094
219094
|
constructor(...args2) {
|
|
219095
219095
|
super(...args2), this.tsNames = new Map;
|
|
219096
219096
|
}
|
|
@@ -228268,7 +228268,7 @@ ${str}
|
|
|
228268
228268
|
} };
|
|
228269
228269
|
let uid = 0;
|
|
228270
228270
|
|
|
228271
|
-
class
|
|
228271
|
+
class Scope3 {
|
|
228272
228272
|
constructor(path19) {
|
|
228273
228273
|
this.uid = undefined, this.path = undefined, this.block = undefined, this.inited = undefined, this.labels = undefined, this.bindings = undefined, this.references = undefined, this.globals = undefined, this.uids = undefined, this.data = undefined, this.crawling = undefined;
|
|
228274
228274
|
const { node: node3 } = path19, cached5 = _cache.scope.get(node3);
|
|
@@ -228639,7 +228639,7 @@ ${str}
|
|
|
228639
228639
|
if (scope5.hasOwnBinding(name17))
|
|
228640
228640
|
return true;
|
|
228641
228641
|
} while (scope5 = scope5.parent);
|
|
228642
|
-
return typeof opts == "object" ? (noGlobals = opts.noGlobals, noUids = opts.noUids) : typeof opts == "boolean" && (noGlobals = opts), !(noUids || !this.hasUid(name17)) || (!(noGlobals || !
|
|
228642
|
+
return typeof opts == "object" ? (noGlobals = opts.noGlobals, noUids = opts.noUids) : typeof opts == "boolean" && (noGlobals = opts), !(noUids || !this.hasUid(name17)) || (!(noGlobals || !Scope3.globals.includes(name17)) || !(noGlobals || !Scope3.contextVariables.includes(name17)));
|
|
228643
228643
|
}
|
|
228644
228644
|
parentHasBinding(name17, opts) {
|
|
228645
228645
|
var _this$parent;
|
|
@@ -228693,14 +228693,14 @@ ${str}
|
|
|
228693
228693
|
}
|
|
228694
228694
|
}
|
|
228695
228695
|
}
|
|
228696
|
-
exports2.default =
|
|
228696
|
+
exports2.default = Scope3, Scope3.globals = Object.keys(_globals.builtin), Scope3.contextVariables = ["arguments", "undefined", "Infinity", "NaN"], Scope3.prototype._renameFromMap = function(map53, oldName, newName, value10) {
|
|
228697
228697
|
map53[oldName] && (map53[newName] = value10, map53[oldName] = null);
|
|
228698
|
-
},
|
|
228698
|
+
}, Scope3.prototype.traverse = function(node3, opts, state2) {
|
|
228699
228699
|
(0, _index.default)(node3, opts, this, state2, this.path);
|
|
228700
|
-
},
|
|
228700
|
+
}, Scope3.prototype._generateUid = function(name17, i11) {
|
|
228701
228701
|
let id5 = name17;
|
|
228702
228702
|
return i11 > 1 && (id5 += i11), `_${id5}`;
|
|
228703
|
-
},
|
|
228703
|
+
}, Scope3.prototype.toArray = function(node3, i11, arrayLikeIsIterable) {
|
|
228704
228704
|
if (isIdentifier(node3)) {
|
|
228705
228705
|
const binding = this.getBinding(node3.name);
|
|
228706
228706
|
if (binding != null && binding.constant && binding.path.isGenericType("Array"))
|
|
@@ -228713,7 +228713,7 @@ ${str}
|
|
|
228713
228713
|
let helperName;
|
|
228714
228714
|
const args2 = [node3];
|
|
228715
228715
|
return i11 === true ? helperName = "toConsumableArray" : typeof i11 == "number" ? (args2.push(numericLiteral(i11)), helperName = "slicedToArray") : helperName = "toArray", arrayLikeIsIterable && (args2.unshift(this.path.hub.addHelper(helperName)), helperName = "maybeArrayLike"), callExpression2(this.path.hub.addHelper(helperName), args2);
|
|
228716
|
-
},
|
|
228716
|
+
}, Scope3.prototype.getAllBindingsOfKind = function(...kinds) {
|
|
228717
228717
|
const ids3 = Object.create(null);
|
|
228718
228718
|
for (const kind of kinds) {
|
|
228719
228719
|
let scope5 = this;
|
|
@@ -228726,7 +228726,7 @@ ${str}
|
|
|
228726
228726
|
} while (scope5);
|
|
228727
228727
|
}
|
|
228728
228728
|
return ids3;
|
|
228729
|
-
}, Object.defineProperties(
|
|
228729
|
+
}, Object.defineProperties(Scope3.prototype, { parentBlock: { configurable: true, enumerable: true, get() {
|
|
228730
228730
|
return this.path.parent;
|
|
228731
228731
|
} }, hub: { configurable: true, enumerable: true, get() {
|
|
228732
228732
|
return this.path.hub;
|
|
@@ -236085,11 +236085,11 @@ Defaulting to 2020, but this will stop working in the future.`)), options6.ecmaV
|
|
|
236085
236085
|
if (this.options.locations)
|
|
236086
236086
|
return new Position(this.curLine, this.pos - this.lineStart);
|
|
236087
236087
|
};
|
|
236088
|
-
var pp$3 = Parser.prototype,
|
|
236088
|
+
var pp$3 = Parser.prototype, Scope3 = function(flags) {
|
|
236089
236089
|
this.flags = flags, this.var = [], this.lexical = [], this.functions = [], this.inClassFieldInit = false;
|
|
236090
236090
|
};
|
|
236091
236091
|
pp$3.enterScope = function(flags) {
|
|
236092
|
-
this.scopeStack.push(new
|
|
236092
|
+
this.scopeStack.push(new Scope3(flags));
|
|
236093
236093
|
}, pp$3.exitScope = function() {
|
|
236094
236094
|
this.scopeStack.pop();
|
|
236095
236095
|
}, pp$3.treatFunctionsAsVarInScope = function(scope5) {
|
|
@@ -252503,7 +252503,7 @@ function getSafeName(baseName, usedNames, forbiddenNames) {
|
|
|
252503
252503
|
return safeName;
|
|
252504
252504
|
}
|
|
252505
252505
|
|
|
252506
|
-
class
|
|
252506
|
+
class Scope3 {
|
|
252507
252507
|
constructor() {
|
|
252508
252508
|
this.children = [];
|
|
252509
252509
|
this.variables = new Map;
|
|
@@ -259507,13 +259507,13 @@ function getNamesFromAssets(consumedFiles) {
|
|
|
259507
259507
|
names.sort((a11, b10) => a11.length - b10.length || (a11 > b10 ? 1 : a11 === b10 ? 0 : -1));
|
|
259508
259508
|
return { names, originalFileNames };
|
|
259509
259509
|
}
|
|
259510
|
-
function getLogHandler(level, code3,
|
|
259510
|
+
function getLogHandler(level, code3, logger18, pluginName, logLevel2) {
|
|
259511
259511
|
if (logLevelPriority[level] < logLevelPriority[logLevel2]) {
|
|
259512
259512
|
return doNothing;
|
|
259513
259513
|
}
|
|
259514
259514
|
return (log7, pos) => {
|
|
259515
259515
|
if (pos != null) {
|
|
259516
|
-
|
|
259516
|
+
logger18(LOGLEVEL_WARN, logInvalidLogPosition(pluginName));
|
|
259517
259517
|
}
|
|
259518
259518
|
log7 = normalizeLog(log7);
|
|
259519
259519
|
if (log7.code && !log7.pluginCode) {
|
|
@@ -259521,7 +259521,7 @@ function getLogHandler(level, code3, logger17, pluginName, logLevel2) {
|
|
|
259521
259521
|
}
|
|
259522
259522
|
log7.code = code3;
|
|
259523
259523
|
log7.plugin = pluginName;
|
|
259524
|
-
|
|
259524
|
+
logger18(level, log7);
|
|
259525
259525
|
};
|
|
259526
259526
|
}
|
|
259527
259527
|
function getPluginContext(plugin, pluginCache, graph, options6, fileEmitter, existingPluginNames) {
|
|
@@ -260170,7 +260170,7 @@ async function initWasm() {}
|
|
|
260170
260170
|
function getLogger2(plugins, onLog, watchMode, logLevel2) {
|
|
260171
260171
|
plugins = getSortedValidatedPlugins("onLog", plugins);
|
|
260172
260172
|
const minimalPriority = logLevelPriority[logLevel2];
|
|
260173
|
-
const
|
|
260173
|
+
const logger18 = (level, log7, skipped = EMPTY_SET) => {
|
|
260174
260174
|
augmentLogMessage(log7);
|
|
260175
260175
|
const logPriority = logLevelPriority[level];
|
|
260176
260176
|
if (logPriority < minimalPriority) {
|
|
@@ -260184,7 +260184,7 @@ function getLogger2(plugins, onLog, watchMode, logLevel2) {
|
|
|
260184
260184
|
if (logLevelPriority[level2] < minimalPriority) {
|
|
260185
260185
|
return doNothing;
|
|
260186
260186
|
}
|
|
260187
|
-
return (log8) =>
|
|
260187
|
+
return (log8) => logger18(level2, normalizeLog(log8), new Set(skipped).add(plugin));
|
|
260188
260188
|
};
|
|
260189
260189
|
const handler2 = "handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog;
|
|
260190
260190
|
if (handler2.call({
|
|
@@ -260199,7 +260199,7 @@ function getLogger2(plugins, onLog, watchMode, logLevel2) {
|
|
|
260199
260199
|
}
|
|
260200
260200
|
onLog(level, log7);
|
|
260201
260201
|
};
|
|
260202
|
-
return
|
|
260202
|
+
return logger18;
|
|
260203
260203
|
}
|
|
260204
260204
|
async function normalizeInputOptions(config5, watchMode) {
|
|
260205
260205
|
const unsetOptions = new Set;
|
|
@@ -260404,16 +260404,16 @@ async function getInputOptions(initialInputOptions, watchMode) {
|
|
|
260404
260404
|
async function getProcessedInputOptions(inputOptions, watchMode) {
|
|
260405
260405
|
const plugins = getSortedValidatedPlugins("options", await normalizePluginOption(inputOptions.plugins));
|
|
260406
260406
|
const logLevel2 = inputOptions.logLevel || LOGLEVEL_INFO;
|
|
260407
|
-
const
|
|
260407
|
+
const logger18 = getLogger2(plugins, getOnLog(inputOptions, logLevel2), watchMode, logLevel2);
|
|
260408
260408
|
for (const plugin of plugins) {
|
|
260409
260409
|
const { name: name17, options: options6 } = plugin;
|
|
260410
260410
|
const handler2 = "handler" in options6 ? options6.handler : options6;
|
|
260411
260411
|
const processedOptions = await handler2.call({
|
|
260412
|
-
debug: getLogHandler(LOGLEVEL_DEBUG, "PLUGIN_LOG",
|
|
260412
|
+
debug: getLogHandler(LOGLEVEL_DEBUG, "PLUGIN_LOG", logger18, name17, logLevel2),
|
|
260413
260413
|
error: (error_) => error44(logPluginError(normalizeLog(error_), name17, { hook: "onLog" })),
|
|
260414
|
-
info: getLogHandler(LOGLEVEL_INFO, "PLUGIN_LOG",
|
|
260414
|
+
info: getLogHandler(LOGLEVEL_INFO, "PLUGIN_LOG", logger18, name17, logLevel2),
|
|
260415
260415
|
meta: { rollupVersion: version4, watchMode },
|
|
260416
|
-
warn: getLogHandler(LOGLEVEL_WARN, "PLUGIN_WARNING",
|
|
260416
|
+
warn: getLogHandler(LOGLEVEL_WARN, "PLUGIN_WARNING", logger18, name17, logLevel2)
|
|
260417
260417
|
}, inputOptions);
|
|
260418
260418
|
if (processedOptions) {
|
|
260419
260419
|
inputOptions = processedOptions;
|
|
@@ -264508,7 +264508,7 @@ var init_node_entry = __esm(() => {
|
|
|
264508
264508
|
}
|
|
264509
264509
|
}
|
|
264510
264510
|
};
|
|
264511
|
-
ChildScope = class ChildScope extends
|
|
264511
|
+
ChildScope = class ChildScope extends Scope3 {
|
|
264512
264512
|
constructor(parent, context15) {
|
|
264513
264513
|
super();
|
|
264514
264514
|
this.parent = parent;
|
|
@@ -271219,7 +271219,7 @@ var init_node_entry = __esm(() => {
|
|
|
271219
271219
|
hex: getHash16
|
|
271220
271220
|
};
|
|
271221
271221
|
SOURCEMAPPING_URL2 += "ppingURL";
|
|
271222
|
-
GlobalScope = class GlobalScope extends
|
|
271222
|
+
GlobalScope = class GlobalScope extends Scope3 {
|
|
271223
271223
|
constructor() {
|
|
271224
271224
|
super();
|
|
271225
271225
|
this.parent = null;
|
|
@@ -273492,7 +273492,7 @@ var init_dep_DCVhRpiz = __esm(() => {
|
|
|
273492
273492
|
output2 = encodeTable[divmod32(uint32Array, base2)] + output2;
|
|
273493
273493
|
return output2;
|
|
273494
273494
|
}
|
|
273495
|
-
let
|
|
273495
|
+
let crypto8 = undefined;
|
|
273496
273496
|
let createXXHash64 = undefined;
|
|
273497
273497
|
let createMd4 = undefined;
|
|
273498
273498
|
let BatchedHash = undefined;
|
|
@@ -273516,19 +273516,19 @@ var init_dep_DCVhRpiz = __esm(() => {
|
|
|
273516
273516
|
}
|
|
273517
273517
|
hash$1 = new BatchedHash(createMd4());
|
|
273518
273518
|
} else if (algorithm === "native-md4") {
|
|
273519
|
-
if (typeof
|
|
273520
|
-
|
|
273519
|
+
if (typeof crypto8 === "undefined") {
|
|
273520
|
+
crypto8 = __require2("crypto");
|
|
273521
273521
|
if (BulkUpdateDecorator === undefined)
|
|
273522
273522
|
BulkUpdateDecorator = require_BulkUpdateDecorator();
|
|
273523
273523
|
}
|
|
273524
|
-
hash$1 = new BulkUpdateDecorator(() =>
|
|
273524
|
+
hash$1 = new BulkUpdateDecorator(() => crypto8.createHash("md4"), "md4");
|
|
273525
273525
|
} else {
|
|
273526
|
-
if (typeof
|
|
273527
|
-
|
|
273526
|
+
if (typeof crypto8 === "undefined") {
|
|
273527
|
+
crypto8 = __require2("crypto");
|
|
273528
273528
|
if (BulkUpdateDecorator === undefined)
|
|
273529
273529
|
BulkUpdateDecorator = require_BulkUpdateDecorator();
|
|
273530
273530
|
}
|
|
273531
|
-
hash$1 = new BulkUpdateDecorator(() =>
|
|
273531
|
+
hash$1 = new BulkUpdateDecorator(() => crypto8.createHash(algorithm), algorithm);
|
|
273532
273532
|
}
|
|
273533
273533
|
hash$1.update(buffer4);
|
|
273534
273534
|
if (digestType === "base26" || digestType === "base32" || digestType === "base36" || digestType === "base49" || digestType === "base52" || digestType === "base58" || digestType === "base62" || digestType === "base64safe")
|
|
@@ -283564,7 +283564,7 @@ import fsp, { constants as constants6 } from "node:fs/promises";
|
|
|
283564
283564
|
import { URL as URL$1, fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL3 } from "node:url";
|
|
283565
283565
|
import { format as format10, inspect as inspect3, promisify as promisify3, stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
|
|
283566
283566
|
import { performance as performance$1 } from "node:perf_hooks";
|
|
283567
|
-
import
|
|
283567
|
+
import crypto8 from "node:crypto";
|
|
283568
283568
|
import os8 from "node:os";
|
|
283569
283569
|
import net from "node:net";
|
|
283570
283570
|
import childProcess2, { exec as exec6, execFile, execSync as execSync2 } from "node:child_process";
|
|
@@ -285091,7 +285091,7 @@ function resolveServerUrls(server, options$1, hostname3, httpsOptions, config$2)
|
|
|
285091
285091
|
else
|
|
285092
285092
|
network.push(url$3);
|
|
285093
285093
|
});
|
|
285094
|
-
const cert = httpsOptions?.cert && !Array.isArray(httpsOptions.cert) ? new
|
|
285094
|
+
const cert = httpsOptions?.cert && !Array.isArray(httpsOptions.cert) ? new crypto8.X509Certificate(httpsOptions.cert) : undefined;
|
|
285095
285095
|
const hostnameFromCert = cert?.subjectAltName ? extractHostnamesFromSubjectAltName(cert.subjectAltName) : [];
|
|
285096
285096
|
if (hostnameFromCert.length > 0) {
|
|
285097
285097
|
const existings = new Set([...local, ...network]);
|
|
@@ -285133,7 +285133,7 @@ function arraify(target2) {
|
|
|
285133
285133
|
return Array.isArray(target2) ? target2 : [target2];
|
|
285134
285134
|
}
|
|
285135
285135
|
function getHash3(text19, length5 = 8) {
|
|
285136
|
-
const h$2 =
|
|
285136
|
+
const h$2 = crypto8.hash("sha256", text19, "hex").substring(0, length5);
|
|
285137
285137
|
if (length5 <= 64)
|
|
285138
285138
|
return h$2;
|
|
285139
285139
|
return h$2.padEnd(length5, "_");
|
|
@@ -288598,7 +288598,7 @@ async function computeSourceRoute(map$1, file8) {
|
|
|
288598
288598
|
} catch {}
|
|
288599
288599
|
return sourceRoot;
|
|
288600
288600
|
}
|
|
288601
|
-
async function injectSourcesContent(map$1, file8,
|
|
288601
|
+
async function injectSourcesContent(map$1, file8, logger18) {
|
|
288602
288602
|
let sourceRootPromise;
|
|
288603
288603
|
const missingSources = [];
|
|
288604
288604
|
const sourcesContent = map$1.sourcesContent || [];
|
|
@@ -288621,7 +288621,7 @@ async function injectSourcesContent(map$1, file8, logger17) {
|
|
|
288621
288621
|
await Promise.all(sourcesContentPromises);
|
|
288622
288622
|
map$1.sourcesContent = sourcesContent;
|
|
288623
288623
|
if (missingSources.length) {
|
|
288624
|
-
|
|
288624
|
+
logger18.warnOnce(`Sourcemap for "${file8}" points to missing source files`);
|
|
288625
288625
|
debug$16?.(`Missing sources:
|
|
288626
288626
|
` + missingSources.join(`
|
|
288627
288627
|
`));
|
|
@@ -288645,7 +288645,7 @@ function getCodeWithSourcemap(type3, code3, map$1) {
|
|
|
288645
288645
|
/*# sourceMappingURL=${genSourceMapUrl(map$1)} */`;
|
|
288646
288646
|
return code3;
|
|
288647
288647
|
}
|
|
288648
|
-
function applySourcemapIgnoreList(map$1, sourcemapPath, sourcemapIgnoreList,
|
|
288648
|
+
function applySourcemapIgnoreList(map$1, sourcemapPath, sourcemapIgnoreList, logger18) {
|
|
288649
288649
|
let { x_google_ignoreList } = map$1;
|
|
288650
288650
|
if (x_google_ignoreList === undefined)
|
|
288651
288651
|
x_google_ignoreList = [];
|
|
@@ -288654,8 +288654,8 @@ function applySourcemapIgnoreList(map$1, sourcemapPath, sourcemapIgnoreList, log
|
|
|
288654
288654
|
if (!sourcePath)
|
|
288655
288655
|
continue;
|
|
288656
288656
|
const ignoreList = sourcemapIgnoreList(path20.isAbsolute(sourcePath) ? sourcePath : path20.resolve(path20.dirname(sourcemapPath), sourcePath), sourcemapPath);
|
|
288657
|
-
if (
|
|
288658
|
-
|
|
288657
|
+
if (logger18 && typeof ignoreList !== "boolean")
|
|
288658
|
+
logger18.warn("sourcemapIgnoreList function must return a boolean.");
|
|
288659
288659
|
if (ignoreList && !x_google_ignoreList.includes(sourcesIndex))
|
|
288660
288660
|
x_google_ignoreList.push(sourcesIndex);
|
|
288661
288661
|
}
|
|
@@ -289329,7 +289329,7 @@ function err$1(e$1, pos) {
|
|
|
289329
289329
|
error$1.pos = pos;
|
|
289330
289330
|
return error$1;
|
|
289331
289331
|
}
|
|
289332
|
-
function parseGlobOptions(rawOpts, optsStartIndex,
|
|
289332
|
+
function parseGlobOptions(rawOpts, optsStartIndex, logger18) {
|
|
289333
289333
|
let opts = {};
|
|
289334
289334
|
try {
|
|
289335
289335
|
opts = evalValue(rawOpts);
|
|
@@ -289364,9 +289364,9 @@ function parseGlobOptions(rawOpts, optsStartIndex, logger17) {
|
|
|
289364
289364
|
}
|
|
289365
289365
|
opts.query = stringifyQuery(opts.query);
|
|
289366
289366
|
}
|
|
289367
|
-
if (opts.as &&
|
|
289367
|
+
if (opts.as && logger18) {
|
|
289368
289368
|
const importSuggestion = forceDefaultAs.includes(opts.as) ? `, import: 'default'` : "";
|
|
289369
|
-
|
|
289369
|
+
logger18.warn(import_picocolors$28.default.yellow(`The glob option "as" has been deprecated in favour of "query". Please update \`as: '${opts.as}'\` to \`query: '?${opts.as}'${importSuggestion}\`.`));
|
|
289370
289370
|
}
|
|
289371
289371
|
if (opts.as && forceDefaultAs.includes(opts.as)) {
|
|
289372
289372
|
if (opts.import && opts.import !== "default" && opts.import !== "*")
|
|
@@ -289381,7 +289381,7 @@ function parseGlobOptions(rawOpts, optsStartIndex, logger17) {
|
|
|
289381
289381
|
opts.query = `?${opts.query}`;
|
|
289382
289382
|
return opts;
|
|
289383
289383
|
}
|
|
289384
|
-
async function parseImportGlob(code3, importer, root3, resolveId2,
|
|
289384
|
+
async function parseImportGlob(code3, importer, root3, resolveId2, logger18) {
|
|
289385
289385
|
let cleanCode;
|
|
289386
289386
|
try {
|
|
289387
289387
|
cleanCode = stripLiteral(code3);
|
|
@@ -289434,7 +289434,7 @@ async function parseImportGlob(code3, importer, root3, resolveId2, logger17) {
|
|
|
289434
289434
|
if (arg2) {
|
|
289435
289435
|
if (arg2.type !== "ObjectExpression")
|
|
289436
289436
|
throw err$2(`Expected the second argument to be an object literal, but got "${arg2.type}"`);
|
|
289437
|
-
options$1 = parseGlobOptions(code3.slice(start6 + arg2.start, start6 + arg2.end), start6 + arg2.start,
|
|
289437
|
+
options$1 = parseGlobOptions(code3.slice(start6 + arg2.start, start6 + arg2.end), start6 + arg2.start, logger18);
|
|
289438
289438
|
}
|
|
289439
289439
|
const globsResolved = await Promise.all(globs.map((glob$1) => toAbsoluteGlob(glob$1, root3, importer, resolveId2, options$1.base)));
|
|
289440
289440
|
const isRelative$1 = globs.every((i$1) => ".!".includes(i$1[0]));
|
|
@@ -289477,12 +289477,12 @@ function findCorrespondingCloseParenthesisPosition(cleanCode, openPos) {
|
|
|
289477
289477
|
}
|
|
289478
289478
|
return -1;
|
|
289479
289479
|
}
|
|
289480
|
-
async function transformGlobImport(code3, id5, root3, resolveId2, restoreQueryExtension = false,
|
|
289480
|
+
async function transformGlobImport(code3, id5, root3, resolveId2, restoreQueryExtension = false, logger18) {
|
|
289481
289481
|
id5 = slash4(id5);
|
|
289482
289482
|
root3 = slash4(root3);
|
|
289483
289483
|
const isVirtual = isVirtualModule(id5);
|
|
289484
289484
|
const dir2 = isVirtual ? undefined : dirname$2(id5);
|
|
289485
|
-
const matches$2 = await parseImportGlob(code3, isVirtual ? undefined : id5, root3, resolveId2,
|
|
289485
|
+
const matches$2 = await parseImportGlob(code3, isVirtual ? undefined : id5, root3, resolveId2, logger18);
|
|
289486
289486
|
const matchedFiles = /* @__PURE__ */ new Set;
|
|
289487
289487
|
if (!matches$2.length)
|
|
289488
289488
|
return null;
|
|
@@ -290493,13 +290493,13 @@ async function prepareEsbuildOptimizerRun(environment2, depsInfo, processingCach
|
|
|
290493
290493
|
};
|
|
290494
290494
|
}
|
|
290495
290495
|
async function addManuallyIncludedOptimizeDeps(environment2, deps) {
|
|
290496
|
-
const { logger:
|
|
290496
|
+
const { logger: logger18 } = environment2;
|
|
290497
290497
|
const { optimizeDeps: optimizeDeps$1 } = environment2.config;
|
|
290498
290498
|
const optimizeDepsInclude = optimizeDeps$1.include ?? [];
|
|
290499
290499
|
if (optimizeDepsInclude.length) {
|
|
290500
290500
|
const unableToOptimize = (id5, msg) => {
|
|
290501
290501
|
if (optimizeDepsInclude.includes(id5))
|
|
290502
|
-
|
|
290502
|
+
logger18.warn(`${msg}: ${import_picocolors$26.default.cyan(id5)}, present in ${environment2.name} 'optimizeDeps.include'`);
|
|
290503
290503
|
};
|
|
290504
290504
|
const includes2 = [...optimizeDepsInclude];
|
|
290505
290505
|
for (let i$1 = 0;i$1 < includes2.length; i$1++) {
|
|
@@ -291667,7 +291667,7 @@ async function readFileIfExists(value$1) {
|
|
|
291667
291667
|
return value$1;
|
|
291668
291668
|
}
|
|
291669
291669
|
async function httpServerStart(httpServer, serverOptions) {
|
|
291670
|
-
let { port: port2, strictPort, host, logger:
|
|
291670
|
+
let { port: port2, strictPort, host, logger: logger18 } = serverOptions;
|
|
291671
291671
|
return new Promise((resolve$4, reject3) => {
|
|
291672
291672
|
const onError$1 = (e$1) => {
|
|
291673
291673
|
if (e$1.code === "EADDRINUSE")
|
|
@@ -291675,7 +291675,7 @@ async function httpServerStart(httpServer, serverOptions) {
|
|
|
291675
291675
|
httpServer.removeListener("error", onError$1);
|
|
291676
291676
|
reject3(/* @__PURE__ */ new Error(`Port ${port2} is already in use`));
|
|
291677
291677
|
} else {
|
|
291678
|
-
|
|
291678
|
+
logger18.info(`Port ${port2} is in use, trying another one...`);
|
|
291679
291679
|
httpServer.listen(++port2, host);
|
|
291680
291680
|
}
|
|
291681
291681
|
else {
|
|
@@ -291690,12 +291690,12 @@ async function httpServerStart(httpServer, serverOptions) {
|
|
|
291690
291690
|
});
|
|
291691
291691
|
});
|
|
291692
291692
|
}
|
|
291693
|
-
function setClientErrorHandler(server,
|
|
291693
|
+
function setClientErrorHandler(server, logger18) {
|
|
291694
291694
|
server.on("clientError", (err$2, socket) => {
|
|
291695
291695
|
let msg = "400 Bad Request";
|
|
291696
291696
|
if (err$2.code === "HPE_HEADER_OVERFLOW") {
|
|
291697
291697
|
msg = "431 Request Header Fields Too Large";
|
|
291698
|
-
|
|
291698
|
+
logger18.warn(import_picocolors$21.default.yellow("Server responded with status code 431. See https://vite.dev/guide/troubleshooting.html#_431-request-header-fields-too-large."));
|
|
291699
291699
|
}
|
|
291700
291700
|
if (err$2.code === "ECONNRESET" || !socket.writable)
|
|
291701
291701
|
return;
|
|
@@ -292376,16 +292376,16 @@ function detectPlatformBinary({ [platform4]: platformBinary }, { wsl }) {
|
|
|
292376
292376
|
throw new Error(`${platform4} is not supported`);
|
|
292377
292377
|
return detectArchBinary(platformBinary);
|
|
292378
292378
|
}
|
|
292379
|
-
function openBrowser(url$3, opt,
|
|
292379
|
+
function openBrowser(url$3, opt, logger18) {
|
|
292380
292380
|
const browser2 = typeof opt === "string" ? opt : process.env.BROWSER || "";
|
|
292381
292381
|
if (browser2.toLowerCase().endsWith(".js"))
|
|
292382
|
-
executeNodeScript(browser2, url$3,
|
|
292382
|
+
executeNodeScript(browser2, url$3, logger18);
|
|
292383
292383
|
else if (browser2.toLowerCase() !== "none") {
|
|
292384
292384
|
const browserArgs = process.env.BROWSER_ARGS ? process.env.BROWSER_ARGS.split(" ") : [];
|
|
292385
|
-
startBrowserProcess(browser2, browserArgs, url$3,
|
|
292385
|
+
startBrowserProcess(browser2, browserArgs, url$3, logger18);
|
|
292386
292386
|
}
|
|
292387
292387
|
}
|
|
292388
|
-
function executeNodeScript(scriptPath, url$3,
|
|
292388
|
+
function executeNodeScript(scriptPath, url$3, logger18) {
|
|
292389
292389
|
const extraArgs = process.argv.slice(2);
|
|
292390
292390
|
const child = (0, import_cross_spawn2.default)(process.execPath, [
|
|
292391
292391
|
scriptPath,
|
|
@@ -292394,13 +292394,13 @@ function executeNodeScript(scriptPath, url$3, logger17) {
|
|
|
292394
292394
|
], { stdio: "inherit" });
|
|
292395
292395
|
child.on("close", (code3) => {
|
|
292396
292396
|
if (code3 !== 0)
|
|
292397
|
-
|
|
292397
|
+
logger18.error(import_picocolors$19.default.red(`
|
|
292398
292398
|
The script specified as BROWSER environment variable failed.
|
|
292399
292399
|
|
|
292400
292400
|
${import_picocolors$19.default.cyan(scriptPath)} exited with code ${code3}.`), { error: null });
|
|
292401
292401
|
});
|
|
292402
292402
|
}
|
|
292403
|
-
async function startBrowserProcess(browser2, browserArgs, url$3,
|
|
292403
|
+
async function startBrowserProcess(browser2, browserArgs, url$3, logger18) {
|
|
292404
292404
|
const preferredOSXBrowser = browser2 === "google chrome" ? "Google Chrome" : browser2;
|
|
292405
292405
|
const shouldTryOpenChromeWithJXA = process.platform === "darwin" && (!preferredOSXBrowser || supportedChromiumBrowsers.includes(preferredOSXBrowser));
|
|
292406
292406
|
if (shouldTryOpenChromeWithJXA)
|
|
@@ -292424,7 +292424,7 @@ async function startBrowserProcess(browser2, browserArgs, url$3, logger17) {
|
|
|
292424
292424
|
subprocess.on("error", reject3);
|
|
292425
292425
|
}).catch(reject3);
|
|
292426
292426
|
}).catch((err$2) => {
|
|
292427
|
-
|
|
292427
|
+
logger18.error(err$2.stack || err$2.message);
|
|
292428
292428
|
});
|
|
292429
292429
|
return true;
|
|
292430
292430
|
} catch {
|
|
@@ -292485,12 +292485,12 @@ function getResolvedOutDirs(root3, outDir, outputOptions) {
|
|
|
292485
292485
|
return new Set([resolvedOutDir]);
|
|
292486
292486
|
return new Set(arraify(outputOptions).map(({ dir: dir2 }) => dir2 ? path20.resolve(root3, dir2) : resolvedOutDir));
|
|
292487
292487
|
}
|
|
292488
|
-
function resolveEmptyOutDir(emptyOutDir, root3, outDirs,
|
|
292488
|
+
function resolveEmptyOutDir(emptyOutDir, root3, outDirs, logger18) {
|
|
292489
292489
|
if (emptyOutDir != null)
|
|
292490
292490
|
return emptyOutDir;
|
|
292491
292491
|
for (const outDir of outDirs)
|
|
292492
292492
|
if (!normalizePath5(outDir).startsWith(withTrailingSlash(root3))) {
|
|
292493
|
-
|
|
292493
|
+
logger18?.warn(import_picocolors$17.default.yellow(`
|
|
292494
292494
|
${import_picocolors$17.default.bold(`(!)`)} outDir ${import_picocolors$17.default.white(import_picocolors$17.default.dim(outDir))} is not inside project root and will not be emptied.
|
|
292495
292495
|
Use --emptyOutDir to override.
|
|
292496
292496
|
`));
|
|
@@ -292594,7 +292594,7 @@ function hasValidToken(config$2, url$3) {
|
|
|
292594
292594
|
if (!token)
|
|
292595
292595
|
return false;
|
|
292596
292596
|
try {
|
|
292597
|
-
const isValidToken =
|
|
292597
|
+
const isValidToken = crypto8.timingSafeEqual(Buffer.from(token), Buffer.from(config$2.webSocketToken));
|
|
292598
292598
|
return isValidToken;
|
|
292599
292599
|
} catch {}
|
|
292600
292600
|
return false;
|
|
@@ -293455,7 +293455,7 @@ async function getCachedTransformResult(environment2, url$3, module$1, timestamp
|
|
|
293455
293455
|
}
|
|
293456
293456
|
}
|
|
293457
293457
|
async function loadAndTransform(environment2, id5, url$3, options$1, timestamp, mod2, resolved) {
|
|
293458
|
-
const { config: config$2, pluginContainer, logger:
|
|
293458
|
+
const { config: config$2, pluginContainer, logger: logger18 } = environment2;
|
|
293459
293459
|
const prettyUrl = debugLoad || debugTransform ? prettifyUrl(url$3, config$2.root) : "";
|
|
293460
293460
|
const moduleGraph = environment2.moduleGraph;
|
|
293461
293461
|
if (options$1.allowId && !options$1.allowId(id5)) {
|
|
@@ -293489,7 +293489,7 @@ async function loadAndTransform(environment2, id5, url$3, options$1, timestamp,
|
|
|
293489
293489
|
map$1 = extracted.map;
|
|
293490
293490
|
}
|
|
293491
293491
|
} catch (e$1) {
|
|
293492
|
-
|
|
293492
|
+
logger18.warn(`Failed to load source map for ${file8}.
|
|
293493
293493
|
${e$1}`, { timestamp: true });
|
|
293494
293494
|
}
|
|
293495
293495
|
} else {
|
|
@@ -293534,9 +293534,9 @@ ${e$1}`, { timestamp: true });
|
|
|
293534
293534
|
normalizedMap = null;
|
|
293535
293535
|
if (normalizedMap && "version" in normalizedMap && mod2.file) {
|
|
293536
293536
|
if (normalizedMap.mappings)
|
|
293537
|
-
await injectSourcesContent(normalizedMap, mod2.file,
|
|
293537
|
+
await injectSourcesContent(normalizedMap, mod2.file, logger18);
|
|
293538
293538
|
const sourcemapPath = `${mod2.file}.map`;
|
|
293539
|
-
applySourcemapIgnoreList(normalizedMap, sourcemapPath, config$2.server.sourcemapIgnoreList,
|
|
293539
|
+
applySourcemapIgnoreList(normalizedMap, sourcemapPath, config$2.server.sourcemapIgnoreList, logger18);
|
|
293540
293540
|
if (path20.isAbsolute(mod2.file)) {
|
|
293541
293541
|
let modDirname;
|
|
293542
293542
|
for (let sourcesIndex = 0;sourcesIndex < normalizedMap.sources.length; ++sourcesIndex) {
|
|
@@ -294392,11 +294392,11 @@ function resolveHtmlTransforms(plugins$1) {
|
|
|
294392
294392
|
function headTagInsertCheck(tags3, ctx) {
|
|
294393
294393
|
if (!tags3.length)
|
|
294394
294394
|
return;
|
|
294395
|
-
const { logger:
|
|
294395
|
+
const { logger: logger18 } = ctx.server?.config || {};
|
|
294396
294396
|
const disallowedTags = tags3.filter((tagDescriptor) => !elementsAllowedInHead.has(tagDescriptor.tag));
|
|
294397
294397
|
if (disallowedTags.length) {
|
|
294398
294398
|
const dedupedTags = unique(disallowedTags.map((tagDescriptor) => `<${tagDescriptor.tag}>`));
|
|
294399
|
-
|
|
294399
|
+
logger18?.warn(import_picocolors$13.default.yellow(import_picocolors$13.default.bold(`[${dedupedTags.join(",")}] can not be used inside the <head> Element, please check the 'injectTo' value`)));
|
|
294400
294400
|
}
|
|
294401
294401
|
}
|
|
294402
294402
|
async function applyHtmlTransforms(html4, hooks, pluginContext, ctx) {
|
|
@@ -295402,7 +295402,7 @@ function createServerCloseFn(server) {
|
|
|
295402
295402
|
function resolvedAllowDir(root3, dir2) {
|
|
295403
295403
|
return normalizePath5(path20.resolve(root3, dir2));
|
|
295404
295404
|
}
|
|
295405
|
-
function resolveServerOptions(root3, raw4,
|
|
295405
|
+
function resolveServerOptions(root3, raw4, logger18) {
|
|
295406
295406
|
const _server = mergeWithDefaults({
|
|
295407
295407
|
...serverConfigDefaults,
|
|
295408
295408
|
host: undefined,
|
|
@@ -295424,7 +295424,7 @@ function resolveServerOptions(root3, raw4, logger17) {
|
|
|
295424
295424
|
const yarnCacheDir = execSync2(`yarn config get ${enableGlobalCache ? "globalFolder" : "cacheFolder"}`, { cwd: cwd2 }).toString().trim();
|
|
295425
295425
|
allowDirs.push(yarnCacheDir);
|
|
295426
295426
|
} catch (e$1) {
|
|
295427
|
-
|
|
295427
|
+
logger18.warn(`Get yarn cache dir error: ${e$1.message}`, { timestamp: true });
|
|
295428
295428
|
}
|
|
295429
295429
|
}
|
|
295430
295430
|
allowDirs = allowDirs.map((i$1) => resolvedAllowDir(root3, i$1));
|
|
@@ -295434,7 +295434,7 @@ function resolveServerOptions(root3, raw4, logger17) {
|
|
|
295434
295434
|
server.fs.allow = allowDirs;
|
|
295435
295435
|
if (server.origin?.endsWith("/")) {
|
|
295436
295436
|
server.origin = server.origin.slice(0, -1);
|
|
295437
|
-
|
|
295437
|
+
logger18.warn(import_picocolors$11.default.yellow(`${import_picocolors$11.default.bold("(!)")} server.origin should not end with "/". Using "${server.origin}" instead.`));
|
|
295438
295438
|
}
|
|
295439
295439
|
if (process.env.__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS && Array.isArray(server.allowedHosts)) {
|
|
295440
295440
|
const additionalHost = process.env.__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS;
|
|
@@ -295469,12 +295469,12 @@ async function restartServer(server) {
|
|
|
295469
295469
|
server.middlewares = middlewares;
|
|
295470
295470
|
newServer._setInternalServer(server);
|
|
295471
295471
|
}
|
|
295472
|
-
const { logger:
|
|
295472
|
+
const { logger: logger18, server: { port: port2, middlewareMode } } = server.config;
|
|
295473
295473
|
if (!middlewareMode)
|
|
295474
295474
|
await server.listen(port2, true);
|
|
295475
295475
|
else
|
|
295476
295476
|
await Promise.all(Object.values(server.environments).map((e$1) => e$1.listen(server)));
|
|
295477
|
-
|
|
295477
|
+
logger18.info("server restarted.", { timestamp: true });
|
|
295478
295478
|
if (shortcutsOptions) {
|
|
295479
295479
|
shortcutsOptions.print = false;
|
|
295480
295480
|
bindCLIShortcuts(server, shortcutsOptions);
|
|
@@ -295488,9 +295488,9 @@ async function restartServerWithUrls(server) {
|
|
|
295488
295488
|
const { port: prevPort, host: prevHost } = server.config.server;
|
|
295489
295489
|
const prevUrls = server.resolvedUrls;
|
|
295490
295490
|
await server.restart();
|
|
295491
|
-
const { logger:
|
|
295491
|
+
const { logger: logger18, server: { port: port2, host } } = server.config;
|
|
295492
295492
|
if ((port2 ?? DEFAULT_DEV_PORT) !== (prevPort ?? DEFAULT_DEV_PORT) || host !== prevHost || diffDnsOrderChange(prevUrls, server.resolvedUrls)) {
|
|
295493
|
-
|
|
295493
|
+
logger18.info("");
|
|
295494
295494
|
server.printUrls();
|
|
295495
295495
|
}
|
|
295496
295496
|
}
|
|
@@ -298425,7 +298425,7 @@ async function transformSugarSS(environment2, id5, code3) {
|
|
|
298425
298425
|
const result2 = await runPostCSS(id5, code3, [], { parser: loadSss(config$2.root) }, undefined, environment2.logger, devSourcemap);
|
|
298426
298426
|
return result2;
|
|
298427
298427
|
}
|
|
298428
|
-
async function runPostCSS(id5, code3, plugins$1, options$1, deps,
|
|
298428
|
+
async function runPostCSS(id5, code3, plugins$1, options$1, deps, logger18, enableSourcemap) {
|
|
298429
298429
|
let postcssResult;
|
|
298430
298430
|
try {
|
|
298431
298431
|
const source = removeDirectQuery(id5);
|
|
@@ -298464,7 +298464,7 @@ ${generateCodeFrame(code3, {
|
|
|
298464
298464
|
line: warning2.endLine,
|
|
298465
298465
|
column: warning2.endColumn - 1
|
|
298466
298466
|
} : undefined)}`;
|
|
298467
|
-
|
|
298467
|
+
logger18.warn(import_picocolors$6.default.yellow(msg));
|
|
298468
298468
|
}
|
|
298469
298469
|
} catch (e$1) {
|
|
298470
298470
|
e$1.message = `[postcss] ${e$1.message}`;
|
|
@@ -299570,12 +299570,12 @@ function areSeparateFolders(a11, b10) {
|
|
|
299570
299570
|
const nb = normalizePath5(b10);
|
|
299571
299571
|
return na2 !== nb && !na2.startsWith(withTrailingSlash(nb)) && !nb.startsWith(withTrailingSlash(na2));
|
|
299572
299572
|
}
|
|
299573
|
-
function resolveBuildEnvironmentOptions(raw4,
|
|
299573
|
+
function resolveBuildEnvironmentOptions(raw4, logger18, consumer) {
|
|
299574
299574
|
const deprecatedPolyfillModulePreload = raw4.polyfillModulePreload;
|
|
299575
299575
|
const { polyfillModulePreload, ...rest } = raw4;
|
|
299576
299576
|
raw4 = rest;
|
|
299577
299577
|
if (deprecatedPolyfillModulePreload !== undefined)
|
|
299578
|
-
|
|
299578
|
+
logger18.warn("polyfillModulePreload is deprecated. Use modulePreload.polyfill instead.");
|
|
299579
299579
|
if (deprecatedPolyfillModulePreload === false && raw4.modulePreload === undefined)
|
|
299580
299580
|
raw4.modulePreload = { polyfill: false };
|
|
299581
299581
|
const merged = mergeWithDefaults({
|
|
@@ -299637,7 +299637,7 @@ function resolveConfigToBuild(inlineConfig = {}, patchConfig, patchPlugins) {
|
|
|
299637
299637
|
function resolveRollupOptions(environment2) {
|
|
299638
299638
|
const { root: root3, packageCache, build: options$1 } = environment2.config;
|
|
299639
299639
|
const libOptions = options$1.lib;
|
|
299640
|
-
const { logger:
|
|
299640
|
+
const { logger: logger18 } = environment2;
|
|
299641
299641
|
const ssr = environment2.config.consumer === "server";
|
|
299642
299642
|
const resolve$4 = (p11) => path20.resolve(root3, p11);
|
|
299643
299643
|
const input2 = libOptions ? options$1.rollupOptions.input || (typeof libOptions.entry === "string" ? resolve$4(libOptions.entry) : Array.isArray(libOptions.entry) ? libOptions.entry.map(resolve$4) : Object.fromEntries(Object.entries(libOptions.entry).map(([alias$2, file8]) => [alias$2, resolve$4(file8)]))) : typeof options$1.ssr === "string" ? resolve$4(options$1.ssr) : options$1.rollupOptions.input || resolve$4("index.html");
|
|
@@ -299665,11 +299665,11 @@ function resolveRollupOptions(environment2) {
|
|
|
299665
299665
|
const isSsrTargetWebworkerEnvironment = environment2.name === "ssr" && environment2.getTopLevelConfig().ssr?.target === "webworker";
|
|
299666
299666
|
const buildOutputOptions = (output2 = {}) => {
|
|
299667
299667
|
if (output2.output)
|
|
299668
|
-
|
|
299668
|
+
logger18.warn(`You've set "rollupOptions.output.output" in your config. This is deprecated and will override all Vite.js default output options. Please use "rollupOptions.output" instead.`);
|
|
299669
299669
|
if (output2.file)
|
|
299670
299670
|
throw new Error('Vite does not support "rollupOptions.output.file". Please use "rollupOptions.output.dir" and "rollupOptions.output.entryFileNames" instead.');
|
|
299671
299671
|
if (output2.sourcemap)
|
|
299672
|
-
|
|
299672
|
+
logger18.warnOnce(import_picocolors$4.default.yellow('Vite does not support "rollupOptions.output.sourcemap". Please use "build.sourcemap" instead.'));
|
|
299673
299673
|
const format$3 = output2.format || "es";
|
|
299674
299674
|
const jsExt = ssr && !isSsrTargetWebworkerEnvironment || libOptions ? resolveOutputJsExtension(format$3, findNearestPackageData(root3, packageCache)?.data.type) : "js";
|
|
299675
299675
|
return {
|
|
@@ -299687,7 +299687,7 @@ function resolveRollupOptions(environment2) {
|
|
|
299687
299687
|
...output2
|
|
299688
299688
|
};
|
|
299689
299689
|
};
|
|
299690
|
-
const outputs = resolveBuildOutputs(options$1.rollupOptions.output, libOptions,
|
|
299690
|
+
const outputs = resolveBuildOutputs(options$1.rollupOptions.output, libOptions, logger18);
|
|
299691
299691
|
if (Array.isArray(outputs))
|
|
299692
299692
|
rollupOptions.output = outputs.map(buildOutputOptions);
|
|
299693
299693
|
else
|
|
@@ -299695,19 +299695,19 @@ function resolveRollupOptions(environment2) {
|
|
|
299695
299695
|
return rollupOptions;
|
|
299696
299696
|
}
|
|
299697
299697
|
async function buildEnvironment(environment2) {
|
|
299698
|
-
const { logger:
|
|
299698
|
+
const { logger: logger18, config: config$2 } = environment2;
|
|
299699
299699
|
const { root: root3, build: options$1 } = config$2;
|
|
299700
299700
|
const ssr = config$2.consumer === "server";
|
|
299701
|
-
|
|
299701
|
+
logger18.info(import_picocolors$4.default.cyan(`vite v${VERSION3} ${import_picocolors$4.default.green(`building ${ssr ? `SSR bundle ` : ``}for ${environment2.config.mode}...`)}`));
|
|
299702
299702
|
let bundle;
|
|
299703
299703
|
let startTime;
|
|
299704
299704
|
try {
|
|
299705
299705
|
const rollupOptions = resolveRollupOptions(environment2);
|
|
299706
299706
|
if (options$1.watch) {
|
|
299707
|
-
|
|
299707
|
+
logger18.info(import_picocolors$4.default.cyan(`
|
|
299708
299708
|
watching for file changes...`));
|
|
299709
299709
|
const resolvedOutDirs = getResolvedOutDirs(root3, options$1.outDir, options$1.rollupOptions.output);
|
|
299710
|
-
const emptyOutDir = resolveEmptyOutDir(options$1.emptyOutDir, root3, resolvedOutDirs,
|
|
299710
|
+
const emptyOutDir = resolveEmptyOutDir(options$1.emptyOutDir, root3, resolvedOutDirs, logger18);
|
|
299711
299711
|
const resolvedChokidarOptions = resolveChokidarOptions({
|
|
299712
299712
|
...(rollupOptions.watch || {}).chokidar,
|
|
299713
299713
|
...options$1.watch.chokidar
|
|
@@ -299723,16 +299723,16 @@ watching for file changes...`));
|
|
|
299723
299723
|
});
|
|
299724
299724
|
watcher.on("event", (event) => {
|
|
299725
299725
|
if (event.code === "BUNDLE_START")
|
|
299726
|
-
|
|
299726
|
+
logger18.info(import_picocolors$4.default.cyan(`
|
|
299727
299727
|
build started...`));
|
|
299728
299728
|
else if (event.code === "BUNDLE_END") {
|
|
299729
299729
|
event.result.close();
|
|
299730
|
-
|
|
299730
|
+
logger18.info(import_picocolors$4.default.cyan(`built in ${event.duration}ms.`));
|
|
299731
299731
|
} else if (event.code === "ERROR") {
|
|
299732
299732
|
const e$1 = event.error;
|
|
299733
299733
|
enhanceRollupError(e$1);
|
|
299734
299734
|
clearLine();
|
|
299735
|
-
|
|
299735
|
+
logger18.error(e$1.message, { error: e$1 });
|
|
299736
299736
|
}
|
|
299737
299737
|
});
|
|
299738
299738
|
return watcher;
|
|
@@ -299743,13 +299743,13 @@ build started...`));
|
|
|
299743
299743
|
const res = [];
|
|
299744
299744
|
for (const output2 of arraify(rollupOptions.output))
|
|
299745
299745
|
res.push(await bundle[options$1.write ? "write" : "generate"](output2));
|
|
299746
|
-
|
|
299746
|
+
logger18.info(`${import_picocolors$4.default.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`);
|
|
299747
299747
|
return Array.isArray(rollupOptions.output) ? res : res[0];
|
|
299748
299748
|
} catch (e$1) {
|
|
299749
299749
|
enhanceRollupError(e$1);
|
|
299750
299750
|
clearLine();
|
|
299751
299751
|
if (startTime) {
|
|
299752
|
-
|
|
299752
|
+
logger18.error(`${import_picocolors$4.default.red("✗")} Build failed in ${displayTime(Date.now() - startTime)}`);
|
|
299753
299753
|
startTime = undefined;
|
|
299754
299754
|
}
|
|
299755
299755
|
throw e$1;
|
|
@@ -299809,7 +299809,7 @@ function resolveLibFilename(libOptions, format$3, entryName, root3, extension$1,
|
|
|
299809
299809
|
return `${name17}.${extension$1}`;
|
|
299810
299810
|
return `${name17}.${format$3}.${extension$1}`;
|
|
299811
299811
|
}
|
|
299812
|
-
function resolveBuildOutputs(outputs, libOptions,
|
|
299812
|
+
function resolveBuildOutputs(outputs, libOptions, logger18) {
|
|
299813
299813
|
if (libOptions) {
|
|
299814
299814
|
const libHasMultipleEntries = typeof libOptions.entry !== "string" && Object.values(libOptions.entry).length > 1;
|
|
299815
299815
|
const libFormats = libOptions.formats || (libHasMultipleEntries ? ["es", "cjs"] : ["es", "umd"]);
|
|
@@ -299826,7 +299826,7 @@ function resolveBuildOutputs(outputs, libOptions, logger17) {
|
|
|
299826
299826
|
}));
|
|
299827
299827
|
}
|
|
299828
299828
|
if (libOptions.formats)
|
|
299829
|
-
|
|
299829
|
+
logger18.warn(import_picocolors$4.default.yellow('"build.lib.formats" will be ignored because "build.rollupOptions.output" is already an array format.'));
|
|
299830
299830
|
outputs.forEach((output2) => {
|
|
299831
299831
|
if ((output2.format === "umd" || output2.format === "iife") && !output2.name)
|
|
299832
299832
|
throw new Error('Entries in "build.rollupOptions.output" must specify "name" when the format is "umd" or "iife".');
|
|
@@ -300244,7 +300244,7 @@ ${MODULE_RUNNER_SOURCEMAPPING_SOURCE}
|
|
|
300244
300244
|
return result2;
|
|
300245
300245
|
}
|
|
300246
300246
|
function createDepsOptimizer(environment2) {
|
|
300247
|
-
const { logger:
|
|
300247
|
+
const { logger: logger18 } = environment2;
|
|
300248
300248
|
const sessionTimestamp = Date.now().toString();
|
|
300249
300249
|
let debounceProcessingHandle;
|
|
300250
300250
|
let closed = false;
|
|
@@ -300267,14 +300267,14 @@ function createDepsOptimizer(environment2) {
|
|
|
300267
300267
|
let newDepsToLogHandle;
|
|
300268
300268
|
const logNewlyDiscoveredDeps = () => {
|
|
300269
300269
|
if (newDepsToLog.length) {
|
|
300270
|
-
|
|
300270
|
+
logger18.info(import_picocolors$3.default.green(`✨ new dependencies optimized: ${depsLogString(newDepsToLog)}`), { timestamp: true });
|
|
300271
300271
|
newDepsToLog = [];
|
|
300272
300272
|
}
|
|
300273
300273
|
};
|
|
300274
300274
|
let discoveredDepsWhileScanning = [];
|
|
300275
300275
|
const logDiscoveredDepsWhileScanning = () => {
|
|
300276
300276
|
if (discoveredDepsWhileScanning.length) {
|
|
300277
|
-
|
|
300277
|
+
logger18.info(import_picocolors$3.default.green(`✨ discovered while scanning: ${depsLogString(discoveredDepsWhileScanning)}`), { timestamp: true });
|
|
300278
300278
|
discoveredDepsWhileScanning = [];
|
|
300279
300279
|
}
|
|
300280
300280
|
};
|
|
@@ -300354,7 +300354,7 @@ function createDepsOptimizer(environment2) {
|
|
|
300354
300354
|
runOptimizer(result2);
|
|
300355
300355
|
});
|
|
300356
300356
|
} catch (e$1) {
|
|
300357
|
-
|
|
300357
|
+
logger18.error(e$1.stack || e$1.message);
|
|
300358
300358
|
} finally {
|
|
300359
300359
|
resolve$4();
|
|
300360
300360
|
depsOptimizer.scanProcessing = undefined;
|
|
@@ -300451,7 +300451,7 @@ function createDepsOptimizer(environment2) {
|
|
|
300451
300451
|
logNewlyDiscoveredDeps();
|
|
300452
300452
|
if (warnAboutMissedDependencies) {
|
|
300453
300453
|
logDiscoveredDepsWhileScanning();
|
|
300454
|
-
|
|
300454
|
+
logger18.info(import_picocolors$3.default.magenta(`❗ add these dependencies to optimizeDeps.include to speed up cold start`), { timestamp: true });
|
|
300455
300455
|
warnAboutMissedDependencies = false;
|
|
300456
300456
|
}
|
|
300457
300457
|
}, 2 * debounceMs);
|
|
@@ -300469,17 +300469,17 @@ function createDepsOptimizer(environment2) {
|
|
|
300469
300469
|
logNewlyDiscoveredDeps();
|
|
300470
300470
|
if (warnAboutMissedDependencies) {
|
|
300471
300471
|
logDiscoveredDepsWhileScanning();
|
|
300472
|
-
|
|
300472
|
+
logger18.info(import_picocolors$3.default.magenta(`❗ add these dependencies to optimizeDeps.include to avoid a full page reload during cold start`), { timestamp: true });
|
|
300473
300473
|
warnAboutMissedDependencies = false;
|
|
300474
300474
|
}
|
|
300475
300475
|
}
|
|
300476
|
-
|
|
300476
|
+
logger18.info(import_picocolors$3.default.green(`✨ optimized dependencies changed. reloading`), { timestamp: true });
|
|
300477
300477
|
if (needsInteropMismatch.length > 0)
|
|
300478
|
-
|
|
300478
|
+
logger18.warn(`Mixed ESM and CJS detected in ${import_picocolors$3.default.yellow(needsInteropMismatch.join(", "))}, add ${needsInteropMismatch.length === 1 ? "it" : "them"} to optimizeDeps.needsInterop to speed up cold start`, { timestamp: true });
|
|
300479
300479
|
fullReload();
|
|
300480
300480
|
}
|
|
300481
300481
|
} catch (e$1) {
|
|
300482
|
-
|
|
300482
|
+
logger18.error(import_picocolors$3.default.red(`error while updating dependencies:
|
|
300483
300483
|
${e$1.stack}`), {
|
|
300484
300484
|
timestamp: true,
|
|
300485
300485
|
error: e$1
|
|
@@ -300839,7 +300839,7 @@ function resolveDevEnvironmentOptions(dev, environmentName, consumer, preTransfo
|
|
|
300839
300839
|
sourcemapIgnoreList: resolved.sourcemapIgnoreList === false ? () => false : resolved.sourcemapIgnoreList
|
|
300840
300840
|
};
|
|
300841
300841
|
}
|
|
300842
|
-
function resolveEnvironmentOptions(options$1, alias$2, preserveSymlinks, forceOptimizeDeps,
|
|
300842
|
+
function resolveEnvironmentOptions(options$1, alias$2, preserveSymlinks, forceOptimizeDeps, logger18, environmentName, isSsrTargetWebworkerSet, preTransformRequests) {
|
|
300843
300843
|
const isClientEnvironment = environmentName === "client";
|
|
300844
300844
|
const consumer = options$1.consumer ?? (isClientEnvironment ? "client" : "server");
|
|
300845
300845
|
const isSsrTargetWebworkerEnvironment = isSsrTargetWebworkerSet && environmentName === "ssr";
|
|
@@ -300848,10 +300848,10 @@ function resolveEnvironmentOptions(options$1, alias$2, preserveSymlinks, forceOp
|
|
|
300848
300848
|
if (typeof processEnvDefine === "object") {
|
|
300849
300849
|
const pathKey$1 = Object.entries(processEnvDefine).find(([key2, value$1]) => key2.toLowerCase() === "path" && !!value$1)?.[0];
|
|
300850
300850
|
if (pathKey$1)
|
|
300851
|
-
|
|
300851
|
+
logger18.warnOnce(import_picocolors2.default.yellow(`The \`define\` option contains an object with ${JSON.stringify(pathKey$1)} for "process.env" key. It looks like you may have passed the entire \`process.env\` object to \`define\`, which can unintentionally expose all environment variables. This poses a security risk and is discouraged.`));
|
|
300852
300852
|
}
|
|
300853
300853
|
}
|
|
300854
|
-
const resolve$4 = resolveEnvironmentResolveOptions(options$1.resolve, alias$2, preserveSymlinks,
|
|
300854
|
+
const resolve$4 = resolveEnvironmentResolveOptions(options$1.resolve, alias$2, preserveSymlinks, logger18, consumer, isSsrTargetWebworkerEnvironment);
|
|
300855
300855
|
return {
|
|
300856
300856
|
define: options$1.define,
|
|
300857
300857
|
resolve: resolve$4,
|
|
@@ -300859,7 +300859,7 @@ function resolveEnvironmentOptions(options$1, alias$2, preserveSymlinks, forceOp
|
|
|
300859
300859
|
consumer,
|
|
300860
300860
|
optimizeDeps: resolveDepOptimizationOptions(options$1.optimizeDeps, resolve$4.preserveSymlinks, forceOptimizeDeps, consumer),
|
|
300861
300861
|
dev: resolveDevEnvironmentOptions(options$1.dev, environmentName, consumer, preTransformRequests),
|
|
300862
|
-
build: resolveBuildEnvironmentOptions(options$1.build ?? {},
|
|
300862
|
+
build: resolveBuildEnvironmentOptions(options$1.build ?? {}, logger18, consumer),
|
|
300863
300863
|
plugins: undefined
|
|
300864
300864
|
};
|
|
300865
300865
|
}
|
|
@@ -300875,7 +300875,7 @@ function getDefaultEnvironmentOptions(config$2) {
|
|
|
300875
300875
|
build: config$2.build
|
|
300876
300876
|
};
|
|
300877
300877
|
}
|
|
300878
|
-
function checkBadCharactersInPath(name17, path$13,
|
|
300878
|
+
function checkBadCharactersInPath(name17, path$13, logger18) {
|
|
300879
300879
|
const badChars = [];
|
|
300880
300880
|
if (path$13.includes("#"))
|
|
300881
300881
|
badChars.push("#");
|
|
@@ -300886,10 +300886,10 @@ function checkBadCharactersInPath(name17, path$13, logger17) {
|
|
|
300886
300886
|
if (badChars.length > 0) {
|
|
300887
300887
|
const charString = badChars.map((c10) => `"${c10}"`).join(" and ");
|
|
300888
300888
|
const inflectedChars = badChars.length > 1 ? "characters" : "character";
|
|
300889
|
-
|
|
300889
|
+
logger18.warn(import_picocolors2.default.yellow(`${name17} contains the ${charString} ${inflectedChars} (${import_picocolors2.default.cyan(path$13)}), which may not work when running Vite. Consider renaming the directory / file to remove the characters.`));
|
|
300890
300890
|
}
|
|
300891
300891
|
}
|
|
300892
|
-
function resolveEnvironmentResolveOptions(resolve$4, alias$2, preserveSymlinks,
|
|
300892
|
+
function resolveEnvironmentResolveOptions(resolve$4, alias$2, preserveSymlinks, logger18, consumer, isSsrTargetWebworkerEnvironment) {
|
|
300893
300893
|
const resolvedResolve = mergeWithDefaults({
|
|
300894
300894
|
...configDefaults.resolve,
|
|
300895
300895
|
mainFields: consumer === undefined || consumer === "client" || isSsrTargetWebworkerEnvironment ? DEFAULT_CLIENT_MAIN_FIELDS : DEFAULT_SERVER_MAIN_FIELDS,
|
|
@@ -300899,15 +300899,15 @@ function resolveEnvironmentResolveOptions(resolve$4, alias$2, preserveSymlinks,
|
|
|
300899
300899
|
resolvedResolve.preserveSymlinks = preserveSymlinks;
|
|
300900
300900
|
resolvedResolve.alias = alias$2;
|
|
300901
300901
|
if (resolve$4?.browserField === false && resolvedResolve.mainFields.includes("browser"))
|
|
300902
|
-
|
|
300902
|
+
logger18.warn(import_picocolors2.default.yellow("`resolve.browserField` is set to false, but the option is removed in favour of the 'browser' string in `resolve.mainFields`. You may want to update `resolve.mainFields` to remove the 'browser' string and preserve the previous browser behaviour."));
|
|
300903
300903
|
return resolvedResolve;
|
|
300904
300904
|
}
|
|
300905
|
-
function resolveResolveOptions(resolve$4,
|
|
300905
|
+
function resolveResolveOptions(resolve$4, logger18) {
|
|
300906
300906
|
const alias$2 = normalizeAlias(mergeAlias(clientAlias, resolve$4?.alias || configDefaults.resolve.alias));
|
|
300907
300907
|
const preserveSymlinks = resolve$4?.preserveSymlinks ?? configDefaults.resolve.preserveSymlinks;
|
|
300908
300908
|
if (alias$2.some((a11) => a11.find === "/"))
|
|
300909
|
-
|
|
300910
|
-
return resolveEnvironmentResolveOptions(resolve$4, alias$2, preserveSymlinks,
|
|
300909
|
+
logger18.warn(import_picocolors2.default.yellow("`resolve.alias` contains an alias that maps `/`. This is not recommended as it can cause unexpected behavior when resolving paths."));
|
|
300910
|
+
return resolveEnvironmentResolveOptions(resolve$4, alias$2, preserveSymlinks, logger18, undefined);
|
|
300911
300911
|
}
|
|
300912
300912
|
function resolveDepOptimizationOptions(optimizeDeps$1, preserveSymlinks, forceOptimizeDeps, consumer) {
|
|
300913
300913
|
return mergeWithDefaults({
|
|
@@ -300979,12 +300979,12 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
300979
300979
|
client: {},
|
|
300980
300980
|
...config$2.environments
|
|
300981
300981
|
};
|
|
300982
|
-
const
|
|
300982
|
+
const logger18 = createLogger(config$2.logLevel, {
|
|
300983
300983
|
allowClearScreen: config$2.clearScreen,
|
|
300984
300984
|
customLogger: config$2.customLogger
|
|
300985
300985
|
});
|
|
300986
300986
|
const resolvedRoot = normalizePath5(config$2.root ? path20.resolve(config$2.root) : process.cwd());
|
|
300987
|
-
checkBadCharactersInPath("The project root", resolvedRoot,
|
|
300987
|
+
checkBadCharactersInPath("The project root", resolvedRoot, logger18);
|
|
300988
300988
|
const configEnvironmentsClient = config$2.environments.client;
|
|
300989
300989
|
configEnvironmentsClient.dev ??= {};
|
|
300990
300990
|
const deprecatedSsrOptimizeDepsConfig = config$2.ssr?.optimizeDeps ?? {};
|
|
@@ -301034,17 +301034,17 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
301034
301034
|
};
|
|
301035
301035
|
for (const name17 of Object.keys(config$2.environments))
|
|
301036
301036
|
config$2.environments[name17] = mergeConfig(name17 === "client" ? defaultClientEnvironmentOptions : defaultNonClientEnvironmentOptions, config$2.environments[name17]);
|
|
301037
|
-
await runConfigEnvironmentHook(config$2.environments, userPlugins,
|
|
301037
|
+
await runConfigEnvironmentHook(config$2.environments, userPlugins, logger18, configEnv, config$2.ssr?.target === "webworker");
|
|
301038
301038
|
config$2.resolve ??= {};
|
|
301039
301039
|
config$2.resolve.conditions = config$2.environments.client.resolve?.conditions;
|
|
301040
301040
|
config$2.resolve.mainFields = config$2.environments.client.resolve?.mainFields;
|
|
301041
|
-
const resolvedDefaultResolve = resolveResolveOptions(config$2.resolve,
|
|
301041
|
+
const resolvedDefaultResolve = resolveResolveOptions(config$2.resolve, logger18);
|
|
301042
301042
|
const resolvedEnvironments = {};
|
|
301043
301043
|
for (const environmentName of Object.keys(config$2.environments))
|
|
301044
|
-
resolvedEnvironments[environmentName] = resolveEnvironmentOptions(config$2.environments[environmentName], resolvedDefaultResolve.alias, resolvedDefaultResolve.preserveSymlinks, inlineConfig.forceOptimizeDeps,
|
|
301044
|
+
resolvedEnvironments[environmentName] = resolveEnvironmentOptions(config$2.environments[environmentName], resolvedDefaultResolve.alias, resolvedDefaultResolve.preserveSymlinks, inlineConfig.forceOptimizeDeps, logger18, environmentName, config$2.ssr?.target === "webworker", config$2.server?.preTransformRequests);
|
|
301045
301045
|
const backwardCompatibleOptimizeDeps = resolvedEnvironments.client.optimizeDeps;
|
|
301046
301046
|
const resolvedDevEnvironmentOptions = resolveDevEnvironmentOptions(config$2.dev, undefined, undefined);
|
|
301047
|
-
const resolvedBuildOptions = resolveBuildEnvironmentOptions(config$2.build ?? {},
|
|
301047
|
+
const resolvedBuildOptions = resolveBuildEnvironmentOptions(config$2.build ?? {}, logger18, undefined);
|
|
301048
301048
|
const patchedConfigSsr = {
|
|
301049
301049
|
...config$2.ssr,
|
|
301050
301050
|
external: resolvedEnvironments.ssr?.resolve.external,
|
|
@@ -301066,27 +301066,27 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
301066
301066
|
if (userNodeEnv === "development")
|
|
301067
301067
|
process.env.NODE_ENV = "development";
|
|
301068
301068
|
else
|
|
301069
|
-
|
|
301069
|
+
logger18.warn(`NODE_ENV=${userNodeEnv} is not supported in the .env file. Only NODE_ENV=development is supported to create a development build of your project. If you need to set process.env.NODE_ENV, you can set it in the Vite config instead.`);
|
|
301070
301070
|
const isProduction = false;
|
|
301071
301071
|
const relativeBaseShortcut = config$2.base === "" || config$2.base === "./";
|
|
301072
|
-
const resolvedBase = relativeBaseShortcut ? !isBuild || config$2.build?.ssr ? "/" : "./" : resolveBaseUrl(config$2.base, isBuild,
|
|
301072
|
+
const resolvedBase = relativeBaseShortcut ? !isBuild || config$2.build?.ssr ? "/" : "./" : resolveBaseUrl(config$2.base, isBuild, logger18);
|
|
301073
301073
|
const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
|
|
301074
301074
|
const cacheDir = normalizePath5(config$2.cacheDir ? path20.resolve(resolvedRoot, config$2.cacheDir) : pkgDir ? path20.join(pkgDir, `node_modules/.vite`) : path20.join(resolvedRoot, `.vite`));
|
|
301075
301075
|
const assetsFilter = config$2.assetsInclude && (!Array.isArray(config$2.assetsInclude) || config$2.assetsInclude.length) ? createFilter3(config$2.assetsInclude) : () => false;
|
|
301076
301076
|
const { publicDir } = config$2;
|
|
301077
301077
|
const resolvedPublicDir = publicDir !== false && publicDir !== "" ? normalizePath5(path20.resolve(resolvedRoot, typeof publicDir === "string" ? publicDir : configDefaults.publicDir)) : "";
|
|
301078
|
-
const server = resolveServerOptions(resolvedRoot, config$2.server,
|
|
301078
|
+
const server = resolveServerOptions(resolvedRoot, config$2.server, logger18);
|
|
301079
301079
|
const builder = resolveBuilderOptions(config$2.builder);
|
|
301080
301080
|
const BASE_URL = resolvedBase;
|
|
301081
301081
|
const resolvedConfigContext = new BasicMinimalPluginContext({
|
|
301082
301082
|
...basePluginContextMeta,
|
|
301083
301083
|
watchMode: command === "serve" && !isPreview || command === "build" && !!resolvedBuildOptions.watch
|
|
301084
|
-
},
|
|
301084
|
+
}, logger18);
|
|
301085
301085
|
let resolved;
|
|
301086
301086
|
let createUserWorkerPlugins = config$2.worker?.plugins;
|
|
301087
301087
|
if (Array.isArray(createUserWorkerPlugins)) {
|
|
301088
301088
|
createUserWorkerPlugins = () => config$2.worker?.plugins;
|
|
301089
|
-
|
|
301089
|
+
logger18.warn(import_picocolors2.default.yellow(`worker.plugins is now a function that returns an array of plugins. Please update your Vite config accordingly.
|
|
301090
301090
|
`));
|
|
301091
301091
|
}
|
|
301092
301092
|
const createWorkerPlugins = async function(bundleChain) {
|
|
@@ -301166,7 +301166,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
301166
301166
|
assetsInclude(file8) {
|
|
301167
301167
|
return DEFAULT_ASSETS_RE.test(file8) || assetsFilter(file8);
|
|
301168
301168
|
},
|
|
301169
|
-
logger:
|
|
301169
|
+
logger: logger18,
|
|
301170
301170
|
packageCache,
|
|
301171
301171
|
worker: resolvedWorkerOptions,
|
|
301172
301172
|
appType: config$2.appType ?? "spa",
|
|
@@ -301188,7 +301188,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
301188
301188
|
dev: resolvedDevEnvironmentOptions,
|
|
301189
301189
|
build: resolvedBuildOptions,
|
|
301190
301190
|
environments: resolvedEnvironments,
|
|
301191
|
-
webSocketToken: Buffer.from(
|
|
301191
|
+
webSocketToken: Buffer.from(crypto8.getRandomValues(new Uint8Array(9))).toString("base64url"),
|
|
301192
301192
|
getSortedPlugins: undefined,
|
|
301193
301193
|
getSortedPluginHooks: undefined,
|
|
301194
301194
|
createResolver(options$1) {
|
|
@@ -301257,14 +301257,14 @@ assetFileNames isn't equal for every build.rollupOptions.output. A single patter
|
|
|
301257
301257
|
`));
|
|
301258
301258
|
return resolved;
|
|
301259
301259
|
}
|
|
301260
|
-
function resolveBaseUrl(base2 = configDefaults.base, isBuild,
|
|
301260
|
+
function resolveBaseUrl(base2 = configDefaults.base, isBuild, logger18) {
|
|
301261
301261
|
if (base2[0] === ".") {
|
|
301262
|
-
|
|
301262
|
+
logger18.warn(import_picocolors2.default.yellow(import_picocolors2.default.bold(`(!) invalid "base" option: "${base2}". The value can only be an absolute URL, "./", or an empty string.`)));
|
|
301263
301263
|
return "/";
|
|
301264
301264
|
}
|
|
301265
301265
|
const isExternal$1 = isExternalUrl(base2);
|
|
301266
301266
|
if (!isExternal$1 && base2[0] !== "/")
|
|
301267
|
-
|
|
301267
|
+
logger18.warn(import_picocolors2.default.yellow(import_picocolors2.default.bold(`(!) "base" option should start with a slash.`)));
|
|
301268
301268
|
if (!isBuild || !isExternal$1) {
|
|
301269
301269
|
base2 = new URL(base2, "http://vite.dev").pathname;
|
|
301270
301270
|
if (base2[0] !== "/")
|
|
@@ -301331,9 +301331,9 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
|
301331
301331
|
dependencies
|
|
301332
301332
|
};
|
|
301333
301333
|
} catch (e$1) {
|
|
301334
|
-
const
|
|
301335
|
-
checkBadCharactersInPath("The config path", resolvedPath,
|
|
301336
|
-
|
|
301334
|
+
const logger18 = createLogger(logLevel2, { customLogger });
|
|
301335
|
+
checkBadCharactersInPath("The config path", resolvedPath, logger18);
|
|
301336
|
+
logger18.error(import_picocolors2.default.red(`failed to load config from ${resolvedPath}`), { error: e$1 });
|
|
301337
301337
|
throw e$1;
|
|
301338
301338
|
}
|
|
301339
301339
|
}
|
|
@@ -301510,8 +301510,8 @@ async function runConfigHook(config$2, plugins$1, configEnv) {
|
|
|
301510
301510
|
}
|
|
301511
301511
|
return conf;
|
|
301512
301512
|
}
|
|
301513
|
-
async function runConfigEnvironmentHook(environments, plugins$1,
|
|
301514
|
-
const context15 = new BasicMinimalPluginContext(basePluginContextMeta,
|
|
301513
|
+
async function runConfigEnvironmentHook(environments, plugins$1, logger18, configEnv, isSsrTargetWebworkerSet) {
|
|
301514
|
+
const context15 = new BasicMinimalPluginContext(basePluginContextMeta, logger18);
|
|
301515
301515
|
const environmentNames = Object.keys(environments);
|
|
301516
301516
|
for (const p11 of getSortedPluginsByHook("configEnvironment", plugins$1)) {
|
|
301517
301517
|
const hook = p11.configEnvironment;
|
|
@@ -301675,7 +301675,7 @@ var import_picomatch2, import_esbuild3, VALID_ID_PREFIX = `/@id/`, NULL_BYTE_PLA
|
|
|
301675
301675
|
const names = [];
|
|
301676
301676
|
extractors2[param.type](names, param);
|
|
301677
301677
|
return names;
|
|
301678
|
-
}, blockDeclarations,
|
|
301678
|
+
}, blockDeclarations, Scope4 = class {
|
|
301679
301679
|
constructor(options$1 = {}) {
|
|
301680
301680
|
this.parent = options$1.parent;
|
|
301681
301681
|
this.isBlockScope = !!options$1.block;
|
|
@@ -301699,7 +301699,7 @@ var import_picomatch2, import_esbuild3, VALID_ID_PREFIX = `/@id/`, NULL_BYTE_PLA
|
|
|
301699
301699
|
return this.declarations[name17] || (this.parent ? this.parent.contains(name17) : false);
|
|
301700
301700
|
}
|
|
301701
301701
|
}, attachScopes = function attachScopes$1(ast, propertyName = "scope") {
|
|
301702
|
-
let scope5 = new
|
|
301702
|
+
let scope5 = new Scope4;
|
|
301703
301703
|
walk$2(ast, {
|
|
301704
301704
|
enter(n$2, parent) {
|
|
301705
301705
|
const node3 = n$2;
|
|
@@ -301715,7 +301715,7 @@ var import_picomatch2, import_esbuild3, VALID_ID_PREFIX = `/@id/`, NULL_BYTE_PLA
|
|
|
301715
301715
|
let newScope;
|
|
301716
301716
|
if (node3.type.includes("Function")) {
|
|
301717
301717
|
const func = node3;
|
|
301718
|
-
newScope = new
|
|
301718
|
+
newScope = new Scope4({
|
|
301719
301719
|
parent: scope5,
|
|
301720
301720
|
block: false,
|
|
301721
301721
|
params: func.params
|
|
@@ -301724,17 +301724,17 @@ var import_picomatch2, import_esbuild3, VALID_ID_PREFIX = `/@id/`, NULL_BYTE_PLA
|
|
|
301724
301724
|
newScope.addDeclaration(func, false, false);
|
|
301725
301725
|
}
|
|
301726
301726
|
if (/For(?:In|Of)?Statement/.test(node3.type))
|
|
301727
|
-
newScope = new
|
|
301727
|
+
newScope = new Scope4({
|
|
301728
301728
|
parent: scope5,
|
|
301729
301729
|
block: true
|
|
301730
301730
|
});
|
|
301731
301731
|
if (node3.type === "BlockStatement" && !parent.type.includes("Function"))
|
|
301732
|
-
newScope = new
|
|
301732
|
+
newScope = new Scope4({
|
|
301733
301733
|
parent: scope5,
|
|
301734
301734
|
block: true
|
|
301735
301735
|
});
|
|
301736
301736
|
if (node3.type === "CatchClause")
|
|
301737
|
-
newScope = new
|
|
301737
|
+
newScope = new Scope4({
|
|
301738
301738
|
parent: scope5,
|
|
301739
301739
|
params: node3.param ? [node3.param] : [],
|
|
301740
301740
|
block: true
|
|
@@ -315644,7 +315644,7 @@ Error: ${e$1.message}`);
|
|
|
315644
315644
|
const http$5 = __require2("http");
|
|
315645
315645
|
const net$1 = __require2("net");
|
|
315646
315646
|
const tls = __require2("tls");
|
|
315647
|
-
const { randomBytes:
|
|
315647
|
+
const { randomBytes: randomBytes7, createHash: createHash$1 } = __require2("crypto");
|
|
315648
315648
|
const { Duplex: Duplex$2, Readable: Readable6 } = __require2("stream");
|
|
315649
315649
|
const { URL: URL$3 } = __require2("url");
|
|
315650
315650
|
const PerMessageDeflate$1 = require_permessage_deflate4();
|
|
@@ -316032,7 +316032,7 @@ Error: ${e$1.message}`);
|
|
|
316032
316032
|
}
|
|
316033
316033
|
}
|
|
316034
316034
|
const defaultPort = isSecure ? 443 : 80;
|
|
316035
|
-
const key2 =
|
|
316035
|
+
const key2 = randomBytes7(16).toString("base64");
|
|
316036
316036
|
const request6 = isSecure ? https$4.request : http$5.request;
|
|
316037
316037
|
const protocolSet = /* @__PURE__ */ new Set;
|
|
316038
316038
|
let perMessageDeflate;
|
|
@@ -316498,7 +316498,7 @@ Error: ${e$1.message}`);
|
|
|
316498
316498
|
const EventEmitter$1 = __require2("events");
|
|
316499
316499
|
const http$4 = __require2("http");
|
|
316500
316500
|
const { Duplex: Duplex2 } = __require2("stream");
|
|
316501
|
-
const { createHash:
|
|
316501
|
+
const { createHash: createHash5 } = __require2("crypto");
|
|
316502
316502
|
const extension2 = require_extension3();
|
|
316503
316503
|
const PerMessageDeflate = require_permessage_deflate4();
|
|
316504
316504
|
const subprotocol = require_subprotocol3();
|
|
@@ -316694,7 +316694,7 @@ Error: ${e$1.message}`);
|
|
|
316694
316694
|
throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");
|
|
316695
316695
|
if (this._state > RUNNING)
|
|
316696
316696
|
return abortHandshake(socket, 503);
|
|
316697
|
-
const digest =
|
|
316697
|
+
const digest = createHash5("sha1").update(key2 + GUID).digest("base64");
|
|
316698
316698
|
const headers = [
|
|
316699
316699
|
"HTTP/1.1 101 Switching Protocols",
|
|
316700
316700
|
"Upgrade: websocket",
|
|
@@ -352558,11 +352558,15 @@ function isAutoApproveTool(part) {
|
|
|
352558
352558
|
}
|
|
352559
352559
|
var ToolsByPermission = {
|
|
352560
352560
|
read: [
|
|
352561
|
-
|
|
352562
|
-
|
|
352563
|
-
|
|
352564
|
-
|
|
352565
|
-
|
|
352561
|
+
...[
|
|
352562
|
+
"readFile",
|
|
352563
|
+
"listFiles",
|
|
352564
|
+
"globFiles",
|
|
352565
|
+
"searchFiles",
|
|
352566
|
+
"readBackgroundJobOutput"
|
|
352567
|
+
],
|
|
352568
|
+
"webFetch",
|
|
352569
|
+
"webSearch"
|
|
352566
352570
|
],
|
|
352567
352571
|
write: [
|
|
352568
352572
|
"writeToFile",
|
|
@@ -353212,7 +353216,19 @@ function extractCompactMessages(messages) {
|
|
|
353212
353216
|
}
|
|
353213
353217
|
return messages;
|
|
353214
353218
|
}
|
|
353219
|
+
function removeEmptyTextParts(messages) {
|
|
353220
|
+
return messages.map((message) => {
|
|
353221
|
+
message.parts = message.parts.filter((part) => {
|
|
353222
|
+
if (part.type === "text" || part.type === "reasoning") {
|
|
353223
|
+
return part.text.trim().length > 0;
|
|
353224
|
+
}
|
|
353225
|
+
return true;
|
|
353226
|
+
});
|
|
353227
|
+
return message;
|
|
353228
|
+
});
|
|
353229
|
+
}
|
|
353215
353230
|
var LLMFormatOps = [
|
|
353231
|
+
removeEmptyTextParts,
|
|
353216
353232
|
removeEmptyMessages,
|
|
353217
353233
|
extractCompactMessages,
|
|
353218
353234
|
removeMessagesWithoutTextOrToolCall,
|
|
@@ -356607,6 +356623,90 @@ function updatePochiCredentials(credentials) {
|
|
|
356607
356623
|
});
|
|
356608
356624
|
}
|
|
356609
356625
|
|
|
356626
|
+
// ../vendor-pochi/src/tools/web-fetch.ts
|
|
356627
|
+
var makeWebFetch = (getToken) => ({
|
|
356628
|
+
description: `
|
|
356629
|
+
- Fetches content from a specified URL and converts HTML to markdown
|
|
356630
|
+
- Use this tool when you need to retrieve and analyze web content
|
|
356631
|
+
|
|
356632
|
+
Usage notes:
|
|
356633
|
+
- IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions.
|
|
356634
|
+
- The URL must be a fully-formed valid URL
|
|
356635
|
+
- The prompt should describe what information you want to extract from the page
|
|
356636
|
+
- This tool is read-only and does not modify any files
|
|
356637
|
+
- Includes a self-cleaning 10-minute cache for faster responses when repeatedly accessing the same URL
|
|
356638
|
+
`.trim(),
|
|
356639
|
+
inputSchema: {
|
|
356640
|
+
jsonSchema: v4_default.toJSONSchema(v4_default.object({
|
|
356641
|
+
url: v4_default.url()
|
|
356642
|
+
}))
|
|
356643
|
+
},
|
|
356644
|
+
execute: async (args) => {
|
|
356645
|
+
const token = await getToken();
|
|
356646
|
+
const response = await fetch("https://api-gateway.getpochi.com/https/r.jina.ai", {
|
|
356647
|
+
method: "POST",
|
|
356648
|
+
headers: {
|
|
356649
|
+
"Content-Type": "application/json",
|
|
356650
|
+
Authorization: `Bearer ${token}`
|
|
356651
|
+
},
|
|
356652
|
+
body: JSON.stringify(args)
|
|
356653
|
+
});
|
|
356654
|
+
if (response.ok) {
|
|
356655
|
+
const content = await response.text();
|
|
356656
|
+
return {
|
|
356657
|
+
content: [
|
|
356658
|
+
{
|
|
356659
|
+
type: "text",
|
|
356660
|
+
text: content
|
|
356661
|
+
}
|
|
356662
|
+
]
|
|
356663
|
+
};
|
|
356664
|
+
}
|
|
356665
|
+
throw new Error(`Failed to fetch: ${response.statusText}`);
|
|
356666
|
+
}
|
|
356667
|
+
});
|
|
356668
|
+
// ../vendor-pochi/src/tools/web-search.ts
|
|
356669
|
+
var makeWebSearch = (getToken) => ({
|
|
356670
|
+
description: `
|
|
356671
|
+
- Allows Pochi to search the web and use the results to inform responses
|
|
356672
|
+
- Provides up-to-date information for current events and recent data
|
|
356673
|
+
- Returns search result information formatted as search result blocks
|
|
356674
|
+
- Searches are performed automatically within a single API call
|
|
356675
|
+
`.trim(),
|
|
356676
|
+
inputSchema: {
|
|
356677
|
+
jsonSchema: v4_default.toJSONSchema(v4_default.object({
|
|
356678
|
+
query: v4_default.string().describe("The search query to perform"),
|
|
356679
|
+
country: v4_default.string().optional().describe("Country code to filter search results by, e.g. 'US', 'GB', 'JP'")
|
|
356680
|
+
}))
|
|
356681
|
+
},
|
|
356682
|
+
execute: async (args) => {
|
|
356683
|
+
const token = await getToken();
|
|
356684
|
+
const response = await fetch("https://api-gateway.getpochi.com/https/api.perplexity.ai/search", {
|
|
356685
|
+
method: "POST",
|
|
356686
|
+
headers: {
|
|
356687
|
+
"Content-Type": "application/json",
|
|
356688
|
+
Authorization: `Bearer ${token}`
|
|
356689
|
+
},
|
|
356690
|
+
body: JSON.stringify({
|
|
356691
|
+
...args,
|
|
356692
|
+
max_tokens_per_page: 256
|
|
356693
|
+
})
|
|
356694
|
+
});
|
|
356695
|
+
if (response.ok) {
|
|
356696
|
+
const { results } = await response.json();
|
|
356697
|
+
return {
|
|
356698
|
+
content: results.map((result2) => ({
|
|
356699
|
+
type: "text",
|
|
356700
|
+
text: `# ${result2.title}
|
|
356701
|
+
created: ${result2.date}, last updated: ${result2.last_updated}, [Read more](${result2.url})
|
|
356702
|
+
|
|
356703
|
+
${result2.snippet}`
|
|
356704
|
+
}))
|
|
356705
|
+
};
|
|
356706
|
+
}
|
|
356707
|
+
throw new Error(`Failed to fetch: ${response.statusText}`);
|
|
356708
|
+
}
|
|
356709
|
+
});
|
|
356610
356710
|
// ../vendor-pochi/src/types.ts
|
|
356611
356711
|
var VendorId = "pochi";
|
|
356612
356712
|
|
|
@@ -356660,38 +356760,10 @@ class Pochi extends VendorBase {
|
|
|
356660
356760
|
};
|
|
356661
356761
|
}
|
|
356662
356762
|
async getTools() {
|
|
356763
|
+
const getToken = () => this.getCredentials().then((c3) => c3.jwt || "");
|
|
356663
356764
|
return {
|
|
356664
|
-
webFetch:
|
|
356665
|
-
|
|
356666
|
-
inputSchema: {
|
|
356667
|
-
jsonSchema: v4_default.toJSONSchema(v4_default.object({
|
|
356668
|
-
url: v4_default.url()
|
|
356669
|
-
}))
|
|
356670
|
-
},
|
|
356671
|
-
execute: async (args) => {
|
|
356672
|
-
const { jwt: jwt2 } = await this.getCredentials();
|
|
356673
|
-
const response = await fetch("https://api-gateway.getpochi.com/https/r.jina.ai", {
|
|
356674
|
-
method: "POST",
|
|
356675
|
-
headers: {
|
|
356676
|
-
"Content-Type": "application/json",
|
|
356677
|
-
Authorization: `Bearer ${jwt2}`
|
|
356678
|
-
},
|
|
356679
|
-
body: JSON.stringify(args)
|
|
356680
|
-
});
|
|
356681
|
-
if (response.ok) {
|
|
356682
|
-
const content = await response.text();
|
|
356683
|
-
return {
|
|
356684
|
-
content: [
|
|
356685
|
-
{
|
|
356686
|
-
type: "text",
|
|
356687
|
-
text: content
|
|
356688
|
-
}
|
|
356689
|
-
]
|
|
356690
|
-
};
|
|
356691
|
-
}
|
|
356692
|
-
throw new Error(`Failed to fetch: ${response.statusText}`);
|
|
356693
|
-
}
|
|
356694
|
-
}
|
|
356765
|
+
webFetch: makeWebFetch(getToken),
|
|
356766
|
+
webSearch: makeWebSearch(getToken)
|
|
356695
356767
|
};
|
|
356696
356768
|
}
|
|
356697
356769
|
}
|
|
@@ -358305,6 +358377,235 @@ class GithubCopilot extends VendorBase {
|
|
|
358305
358377
|
// ../vendor-github-copilot/src/node.ts
|
|
358306
358378
|
registerVendor(new GithubCopilot);
|
|
358307
358379
|
|
|
358380
|
+
// ../vendor-qwen-code/src/auth.ts
|
|
358381
|
+
import * as crypto5 from "node:crypto";
|
|
358382
|
+
|
|
358383
|
+
// ../vendor-qwen-code/src/types.ts
|
|
358384
|
+
var VendorId7 = "qwen-code";
|
|
358385
|
+
|
|
358386
|
+
// ../vendor-qwen-code/src/auth.ts
|
|
358387
|
+
var logger7 = getLogger(VendorId7);
|
|
358388
|
+
var BaseUrl = "https://chat.qwen.ai";
|
|
358389
|
+
var DeviceCodeEndpoint = `${BaseUrl}/api/v1/oauth2/device/code`;
|
|
358390
|
+
var TokenEndpoint = `${BaseUrl}/api/v1/oauth2/token`;
|
|
358391
|
+
var ClientId3 = "f0304373b74a44d2b584a3fb70ca9e56";
|
|
358392
|
+
var Scope = "openid profile email model.completion";
|
|
358393
|
+
var GrantType = "urn:ietf:params:oauth:grant-type:device_code";
|
|
358394
|
+
function objectToUrlEncoded(data) {
|
|
358395
|
+
return Object.keys(data).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(data[key])}`).join("&");
|
|
358396
|
+
}
|
|
358397
|
+
async function startOAuthFlow4() {
|
|
358398
|
+
try {
|
|
358399
|
+
const pkce = generatePKCEParams3();
|
|
358400
|
+
const deviceAuth = await requestDeviceAuthorization(pkce);
|
|
358401
|
+
console.log(`
|
|
358402
|
+
=== Qwen OAuth Device Authorization ===`);
|
|
358403
|
+
console.log("Please visit the following URL in your browser to authorize:");
|
|
358404
|
+
console.log(`
|
|
358405
|
+
${deviceAuth.verification_uri_complete}
|
|
358406
|
+
`);
|
|
358407
|
+
console.log(`Or go to: ${deviceAuth.verification_uri}`);
|
|
358408
|
+
console.log(`And enter code: ${deviceAuth.user_code}
|
|
358409
|
+
`);
|
|
358410
|
+
console.log(`Waiting for authorization...
|
|
358411
|
+
`);
|
|
358412
|
+
const credentials = pollForToken(deviceAuth.device_code, pkce.verifier, deviceAuth.expires_in);
|
|
358413
|
+
return {
|
|
358414
|
+
url: deviceAuth.verification_uri_complete,
|
|
358415
|
+
credentials
|
|
358416
|
+
};
|
|
358417
|
+
} catch (error40) {
|
|
358418
|
+
logger7.error("Failed to start OAuth flow:", error40);
|
|
358419
|
+
throw error40;
|
|
358420
|
+
}
|
|
358421
|
+
}
|
|
358422
|
+
async function requestDeviceAuthorization(pkce) {
|
|
358423
|
+
const bodyData = {
|
|
358424
|
+
client_id: ClientId3,
|
|
358425
|
+
scope: Scope,
|
|
358426
|
+
code_challenge: pkce.challenge,
|
|
358427
|
+
code_challenge_method: "S256"
|
|
358428
|
+
};
|
|
358429
|
+
logger7.debug("Requesting device authorization with body:", bodyData);
|
|
358430
|
+
const response = await fetch(DeviceCodeEndpoint, {
|
|
358431
|
+
method: "POST",
|
|
358432
|
+
headers: {
|
|
358433
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
358434
|
+
Accept: "application/json"
|
|
358435
|
+
},
|
|
358436
|
+
body: objectToUrlEncoded(bodyData)
|
|
358437
|
+
});
|
|
358438
|
+
if (!response.ok) {
|
|
358439
|
+
const errorText = await response.text();
|
|
358440
|
+
logger7.error("Device authorization failed:", errorText);
|
|
358441
|
+
throw new Error(`Device authorization failed: ${response.status} ${response.statusText}. Response: ${errorText}`);
|
|
358442
|
+
}
|
|
358443
|
+
const result2 = await response.json();
|
|
358444
|
+
if ("error" in result2) {
|
|
358445
|
+
throw new Error(`Device authorization error: ${result2.error} - ${result2.error_description || "No details"}`);
|
|
358446
|
+
}
|
|
358447
|
+
logger7.debug("Device authorization successful:", result2);
|
|
358448
|
+
return result2;
|
|
358449
|
+
}
|
|
358450
|
+
async function pollForToken(deviceCode, codeVerifier, expiresIn) {
|
|
358451
|
+
const pollInterval = 2000;
|
|
358452
|
+
let currentInterval = pollInterval;
|
|
358453
|
+
const maxAttempts = Math.ceil(expiresIn / (pollInterval / 1000));
|
|
358454
|
+
for (let attempt = 0;attempt < maxAttempts; attempt++) {
|
|
358455
|
+
try {
|
|
358456
|
+
const bodyData = {
|
|
358457
|
+
grant_type: GrantType,
|
|
358458
|
+
client_id: ClientId3,
|
|
358459
|
+
device_code: deviceCode,
|
|
358460
|
+
code_verifier: codeVerifier
|
|
358461
|
+
};
|
|
358462
|
+
logger7.debug(`Polling for token (attempt ${attempt + 1}/${maxAttempts})`);
|
|
358463
|
+
const response = await fetch(TokenEndpoint, {
|
|
358464
|
+
method: "POST",
|
|
358465
|
+
headers: {
|
|
358466
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
358467
|
+
Accept: "application/json"
|
|
358468
|
+
},
|
|
358469
|
+
body: objectToUrlEncoded(bodyData)
|
|
358470
|
+
});
|
|
358471
|
+
if (response.ok) {
|
|
358472
|
+
const tokenData = await response.json();
|
|
358473
|
+
if (tokenData.access_token) {
|
|
358474
|
+
logger7.debug("Authentication successful! Access token obtained.");
|
|
358475
|
+
return {
|
|
358476
|
+
access_token: tokenData.access_token,
|
|
358477
|
+
refresh_token: tokenData.refresh_token || "",
|
|
358478
|
+
token_type: tokenData.token_type || "",
|
|
358479
|
+
resource_url: tokenData.resource_url || "",
|
|
358480
|
+
expiry_date: tokenData.expires_in ? Date.now() + tokenData.expires_in * 1000 : Date.now() + 3600 * 1000
|
|
358481
|
+
};
|
|
358482
|
+
}
|
|
358483
|
+
}
|
|
358484
|
+
if (!response.ok) {
|
|
358485
|
+
try {
|
|
358486
|
+
const errorData = await response.json();
|
|
358487
|
+
if (response.status === 400) {
|
|
358488
|
+
if (errorData.error === "authorization_pending") {
|
|
358489
|
+
logger7.debug("Authorization pending...");
|
|
358490
|
+
} else if (errorData.error === "slow_down") {
|
|
358491
|
+
currentInterval = Math.min(currentInterval * 1.5, 1e4);
|
|
358492
|
+
logger7.debug(`Slowing down poll interval to ${currentInterval}ms`);
|
|
358493
|
+
} else if (errorData.error === "access_denied") {
|
|
358494
|
+
throw new Error("Authorization was denied by the user");
|
|
358495
|
+
} else if (errorData.error === "expired_token") {
|
|
358496
|
+
throw new Error("Device code has expired. Please restart the authorization process.");
|
|
358497
|
+
} else {
|
|
358498
|
+
throw new Error(`Token poll error: ${errorData.error} - ${errorData.error_description || "Unknown error"}`);
|
|
358499
|
+
}
|
|
358500
|
+
} else if (response.status === 429) {
|
|
358501
|
+
currentInterval = Math.min(currentInterval * 2, 1e4);
|
|
358502
|
+
logger7.warn(`Rate limited. Increasing poll interval to ${currentInterval}ms`);
|
|
358503
|
+
} else {
|
|
358504
|
+
throw new Error(`Unexpected response: ${response.status} ${response.statusText}`);
|
|
358505
|
+
}
|
|
358506
|
+
} catch (parseError) {
|
|
358507
|
+
const errorText = await response.text();
|
|
358508
|
+
logger7.error(`Failed to parse error response: ${errorText}`);
|
|
358509
|
+
}
|
|
358510
|
+
}
|
|
358511
|
+
await new Promise((resolve2) => setTimeout(resolve2, currentInterval));
|
|
358512
|
+
} catch (error40) {
|
|
358513
|
+
if (error40 instanceof Error && (error40.message.includes("denied") || error40.message.includes("expired"))) {
|
|
358514
|
+
throw error40;
|
|
358515
|
+
}
|
|
358516
|
+
logger7.error(`Error polling for token (attempt ${attempt + 1}):`, error40);
|
|
358517
|
+
await new Promise((resolve2) => setTimeout(resolve2, currentInterval));
|
|
358518
|
+
}
|
|
358519
|
+
}
|
|
358520
|
+
throw new Error("Authorization timeout. Please restart the process.");
|
|
358521
|
+
}
|
|
358522
|
+
async function renewCredentials5(credentials) {
|
|
358523
|
+
if (credentials.expiry_date > Date.now() + 5 * 60 * 1000) {
|
|
358524
|
+
return credentials;
|
|
358525
|
+
}
|
|
358526
|
+
if (!credentials.refresh_token) {
|
|
358527
|
+
logger7.error("No refresh token available");
|
|
358528
|
+
return;
|
|
358529
|
+
}
|
|
358530
|
+
try {
|
|
358531
|
+
const bodyData = {
|
|
358532
|
+
grant_type: "refresh_token",
|
|
358533
|
+
refresh_token: credentials.refresh_token,
|
|
358534
|
+
client_id: ClientId3
|
|
358535
|
+
};
|
|
358536
|
+
const response = await fetch(TokenEndpoint, {
|
|
358537
|
+
method: "POST",
|
|
358538
|
+
headers: {
|
|
358539
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
358540
|
+
Accept: "application/json"
|
|
358541
|
+
},
|
|
358542
|
+
body: objectToUrlEncoded(bodyData)
|
|
358543
|
+
});
|
|
358544
|
+
logger7.debug("Token refresh response status:", response.ok);
|
|
358545
|
+
if (!response.ok) {
|
|
358546
|
+
const errorText = await response.text();
|
|
358547
|
+
if (response.status === 400) {
|
|
358548
|
+
logger7.error("Refresh token expired or invalid:", errorText);
|
|
358549
|
+
return;
|
|
358550
|
+
}
|
|
358551
|
+
throw new Error(`Token refresh failed: ${response.status} ${response.statusText}. Response: ${errorText}`);
|
|
358552
|
+
}
|
|
358553
|
+
const tokenData = await response.json();
|
|
358554
|
+
return {
|
|
358555
|
+
access_token: tokenData.access_token,
|
|
358556
|
+
refresh_token: tokenData.refresh_token || credentials.refresh_token,
|
|
358557
|
+
token_type: tokenData.token_type || "",
|
|
358558
|
+
resource_url: tokenData.resource_url || "",
|
|
358559
|
+
expiry_date: Date.now() + tokenData.expires_in * 1000
|
|
358560
|
+
};
|
|
358561
|
+
} catch (error40) {
|
|
358562
|
+
logger7.error("Failed to refresh Qwen token:", error40);
|
|
358563
|
+
return;
|
|
358564
|
+
}
|
|
358565
|
+
}
|
|
358566
|
+
async function fetchUserInfo5(_credentials) {
|
|
358567
|
+
return {
|
|
358568
|
+
email: "",
|
|
358569
|
+
name: "Logged-in"
|
|
358570
|
+
};
|
|
358571
|
+
}
|
|
358572
|
+
function generatePKCEParams3() {
|
|
358573
|
+
const verifier = crypto5.randomBytes(32).toString("base64url");
|
|
358574
|
+
const challenge = crypto5.createHash("sha256").update(verifier).digest("base64url");
|
|
358575
|
+
return { verifier, challenge };
|
|
358576
|
+
}
|
|
358577
|
+
|
|
358578
|
+
// ../vendor-qwen-code/src/vendor.ts
|
|
358579
|
+
class QwenCode extends VendorBase {
|
|
358580
|
+
constructor() {
|
|
358581
|
+
super(VendorId7);
|
|
358582
|
+
}
|
|
358583
|
+
authenticate() {
|
|
358584
|
+
return startOAuthFlow4();
|
|
358585
|
+
}
|
|
358586
|
+
async renewCredentials(credentials) {
|
|
358587
|
+
return renewCredentials5(credentials);
|
|
358588
|
+
}
|
|
358589
|
+
async fetchUserInfo(credentials) {
|
|
358590
|
+
return fetchUserInfo5(credentials);
|
|
358591
|
+
}
|
|
358592
|
+
async fetchModels() {
|
|
358593
|
+
return {
|
|
358594
|
+
"qwen3-coder-plus": {
|
|
358595
|
+
contextWindow: 1e6,
|
|
358596
|
+
useToolCallMiddleware: false
|
|
358597
|
+
},
|
|
358598
|
+
"qwen3-coder": {
|
|
358599
|
+
contextWindow: 256000,
|
|
358600
|
+
useToolCallMiddleware: false
|
|
358601
|
+
}
|
|
358602
|
+
};
|
|
358603
|
+
}
|
|
358604
|
+
}
|
|
358605
|
+
|
|
358606
|
+
// ../vendor-qwen-code/src/node.ts
|
|
358607
|
+
registerVendor(new QwenCode);
|
|
358608
|
+
|
|
358308
358609
|
// ../common/src/vendor/edge.ts
|
|
358309
358610
|
var { register: register2, get: get2 } = createRegistry();
|
|
358310
358611
|
var registerModel = register2;
|
|
@@ -358365,7 +358666,7 @@ function createPochiModel({
|
|
|
358365
358666
|
};
|
|
358366
358667
|
}
|
|
358367
358668
|
function createApiClient(getCredentials) {
|
|
358368
|
-
const
|
|
358669
|
+
const apiClient = hc(getServerBaseUrl(), {
|
|
358369
358670
|
async fetch(input2, init) {
|
|
358370
358671
|
const { token } = await getCredentials();
|
|
358371
358672
|
const headers = new Headers(init?.headers);
|
|
@@ -358376,7 +358677,7 @@ function createApiClient(getCredentials) {
|
|
|
358376
358677
|
});
|
|
358377
358678
|
}
|
|
358378
358679
|
});
|
|
358379
|
-
return
|
|
358680
|
+
return apiClient;
|
|
358380
358681
|
}
|
|
358381
358682
|
function convertFilePartDataToBase64(prompt) {
|
|
358382
358683
|
return prompt.map((message) => {
|
|
@@ -368045,6 +368346,66 @@ function createPatchedFetch3(getCredentials) {
|
|
|
368045
368346
|
// ../vendor-github-copilot/src/edge.ts
|
|
368046
368347
|
registerModel(VendorId6, createCopilotModel);
|
|
368047
368348
|
|
|
368349
|
+
// ../vendor-qwen-code/src/model.ts
|
|
368350
|
+
var BaseUrl2 = "https://portal.qwen.ai/v1";
|
|
368351
|
+
function createQwenModel({
|
|
368352
|
+
modelId,
|
|
368353
|
+
getCredentials
|
|
368354
|
+
}) {
|
|
368355
|
+
const qwenModel = createOpenAICompatible({
|
|
368356
|
+
name: "OpenAI",
|
|
368357
|
+
baseURL: BaseUrl2,
|
|
368358
|
+
fetch: createPatchedFetch4(getCredentials)
|
|
368359
|
+
})(modelId);
|
|
368360
|
+
return wrapLanguageModel({
|
|
368361
|
+
model: qwenModel,
|
|
368362
|
+
middleware: {
|
|
368363
|
+
middlewareVersion: "v2",
|
|
368364
|
+
async transformParams({ params }) {
|
|
368365
|
+
return {
|
|
368366
|
+
...params,
|
|
368367
|
+
max_tokens: 8192
|
|
368368
|
+
};
|
|
368369
|
+
}
|
|
368370
|
+
}
|
|
368371
|
+
});
|
|
368372
|
+
}
|
|
368373
|
+
function createPatchedFetch4(getCredentials) {
|
|
368374
|
+
return async (requestInfo, requestInit) => {
|
|
368375
|
+
const { access_token } = await getCredentials();
|
|
368376
|
+
const headers = new Headers(requestInit?.headers);
|
|
368377
|
+
headers.set("Authorization", `Bearer ${access_token}`);
|
|
368378
|
+
let finalUrl;
|
|
368379
|
+
if (globalThis.POCHI_CORS_PROXY_PORT) {
|
|
368380
|
+
const originalUrl = new URL(requestInfo.toString());
|
|
368381
|
+
const url2 = new URL(originalUrl);
|
|
368382
|
+
url2.protocol = "http:";
|
|
368383
|
+
url2.host = "localhost";
|
|
368384
|
+
url2.port = globalThis.POCHI_CORS_PROXY_PORT;
|
|
368385
|
+
headers.set("x-proxy-origin", originalUrl.origin);
|
|
368386
|
+
finalUrl = url2;
|
|
368387
|
+
} else {
|
|
368388
|
+
finalUrl = requestInfo;
|
|
368389
|
+
}
|
|
368390
|
+
const resp = await fetch(finalUrl, {
|
|
368391
|
+
...requestInit,
|
|
368392
|
+
headers
|
|
368393
|
+
});
|
|
368394
|
+
if (!resp.ok) {
|
|
368395
|
+
throw new APICallError({
|
|
368396
|
+
message: `Failed to fetch: ${resp.status} ${resp.statusText}`,
|
|
368397
|
+
statusCode: resp.status,
|
|
368398
|
+
url: typeof requestInfo === "string" ? requestInfo : requestInfo.toString(),
|
|
368399
|
+
requestBodyValues: null
|
|
368400
|
+
});
|
|
368401
|
+
}
|
|
368402
|
+
return resp;
|
|
368403
|
+
};
|
|
368404
|
+
}
|
|
368405
|
+
|
|
368406
|
+
// ../vendor-qwen-code/src/edge.ts
|
|
368407
|
+
registerModel(VendorId7, createQwenModel);
|
|
368408
|
+
|
|
368048
368409
|
// ../../node_modules/@commander-js/extra-typings/esm.mjs
|
|
368049
368410
|
var import__5 = __toESM(require_extra_typings(), 1);
|
|
368050
368411
|
var {
|
|
@@ -368082,7 +368443,7 @@ var {
|
|
|
368082
368443
|
// package.json
|
|
368083
368444
|
var package_default = {
|
|
368084
368445
|
name: "@getpochi/cli",
|
|
368085
|
-
version: "0.5.
|
|
368446
|
+
version: "0.5.44",
|
|
368086
368447
|
type: "module",
|
|
368087
368448
|
bin: {
|
|
368088
368449
|
pochi: "src/cli.ts"
|
|
@@ -368106,6 +368467,7 @@ var package_default = {
|
|
|
368106
368467
|
"@getpochi/vendor-gemini-cli": "workspace:*",
|
|
368107
368468
|
"@getpochi/vendor-pochi": "workspace:*",
|
|
368108
368469
|
"@getpochi/vendor-codex": "workspace:*",
|
|
368470
|
+
"@getpochi/vendor-qwen-code": "workspace:*",
|
|
368109
368471
|
"@inquirer/select": "^4.3.2",
|
|
368110
368472
|
"@getpochi/vendor-github-copilot": "workspace:*",
|
|
368111
368473
|
"@livestore/adapter-node": "catalog:",
|
|
@@ -369462,9 +369824,9 @@ var MaxTerminalOutputSize = 30000;
|
|
|
369462
369824
|
|
|
369463
369825
|
// ../common/src/tool-utils/ripgrep.ts
|
|
369464
369826
|
var execAsync = promisify(exec2);
|
|
369465
|
-
var
|
|
369827
|
+
var logger10 = getLogger("RipgrepUtils");
|
|
369466
369828
|
async function searchFilesWithRipgrep(path4, regex, rgPath, workspacePath, filePattern, abortSignal) {
|
|
369467
|
-
|
|
369829
|
+
logger10.debug("searchFiles", path4, regex, filePattern);
|
|
369468
369830
|
const matches = [];
|
|
369469
369831
|
let command = `"${rgPath.replace(/"/g, "\\\"")}" --json --case-sensitive --binary --sortr modified `;
|
|
369470
369832
|
if (filePattern) {
|
|
@@ -369472,14 +369834,14 @@ async function searchFilesWithRipgrep(path4, regex, rgPath, workspacePath, fileP
|
|
|
369472
369834
|
}
|
|
369473
369835
|
const absPath = resolve5(workspacePath, path4.replace(/'/g, "'\\''"));
|
|
369474
369836
|
command += `'${regex.replace(/'/g, "'\\''")}' '${absPath}'`;
|
|
369475
|
-
|
|
369837
|
+
logger10.debug("command", command);
|
|
369476
369838
|
try {
|
|
369477
369839
|
const { stdout: stdout2, stderr: stderr2 } = await execAsync(command, {
|
|
369478
369840
|
maxBuffer: 1024 * 1024 * 10,
|
|
369479
369841
|
signal: abortSignal
|
|
369480
369842
|
});
|
|
369481
369843
|
if (stderr2) {
|
|
369482
|
-
|
|
369844
|
+
logger10.warn("rg command stderr: ", stderr2.slice(0, 1000));
|
|
369483
369845
|
}
|
|
369484
369846
|
const outputLines = stdout2.trim().split(`
|
|
369485
369847
|
`);
|
|
@@ -369495,25 +369857,25 @@ async function searchFilesWithRipgrep(path4, regex, rgPath, workspacePath, fileP
|
|
|
369495
369857
|
});
|
|
369496
369858
|
}
|
|
369497
369859
|
} catch (parseError2) {
|
|
369498
|
-
|
|
369860
|
+
logger10.error(`Failed to parse rg JSON output line: ${line}`, parseError2);
|
|
369499
369861
|
}
|
|
369500
369862
|
}
|
|
369501
369863
|
} catch (error42) {
|
|
369502
369864
|
if (!error42) {
|
|
369503
|
-
|
|
369865
|
+
logger10.error("rg command error: ", error42);
|
|
369504
369866
|
throw error42;
|
|
369505
369867
|
}
|
|
369506
369868
|
if (error42.code && error42.code > 1) {
|
|
369507
369869
|
throw new Error(`rg command failed with code ${error42.code}: ${error42.stderr || error42.message}`);
|
|
369508
369870
|
}
|
|
369509
369871
|
if (!error42.code && error42.stderr) {
|
|
369510
|
-
|
|
369872
|
+
logger10.warn(`rg command stderr (exit code 0): ${error42.stderr}`);
|
|
369511
369873
|
} else if (error42.code === 1 && !error42.stdout && !error42.stderr) {} else if (error42.code === 1 && error42.stdout) {
|
|
369512
369874
|
if (error42.stderr) {
|
|
369513
|
-
|
|
369875
|
+
logger10.warn(`rg command stderr (exit code 1): ${error42.stderr}`);
|
|
369514
369876
|
}
|
|
369515
369877
|
} else {
|
|
369516
|
-
|
|
369878
|
+
logger10.error("Error executing rg command: ", error42);
|
|
369517
369879
|
throw error42;
|
|
369518
369880
|
}
|
|
369519
369881
|
}
|
|
@@ -369526,7 +369888,7 @@ async function searchFilesWithRipgrep(path4, regex, rgPath, workspacePath, fileP
|
|
|
369526
369888
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
369527
369889
|
import * as fs3 from "node:fs/promises";
|
|
369528
369890
|
import * as path4 from "node:path";
|
|
369529
|
-
var
|
|
369891
|
+
var logger11 = getLogger("ignoreWalk");
|
|
369530
369892
|
var MaxScanItems = 1e4;
|
|
369531
369893
|
async function attemptLoadIgnoreFromPath(directoryPath) {
|
|
369532
369894
|
try {
|
|
@@ -369572,9 +369934,9 @@ async function ignoreWalk({
|
|
|
369572
369934
|
const scannedFileResults = [];
|
|
369573
369935
|
const processedDirs = new Set;
|
|
369574
369936
|
const queue = [{ uri: dir2, ignore: import_ignore.default().add(".git") }];
|
|
369575
|
-
|
|
369937
|
+
logger11.trace(`Starting traversal from ${dir2} with limit ${MaxScanItems}, recursive: ${recursive}`);
|
|
369576
369938
|
if (abortSignal?.aborted) {
|
|
369577
|
-
|
|
369939
|
+
logger11.debug("Traversal aborted before starting.");
|
|
369578
369940
|
return [];
|
|
369579
369941
|
}
|
|
369580
369942
|
let fileScannedCount = 0;
|
|
@@ -369593,23 +369955,23 @@ async function ignoreWalk({
|
|
|
369593
369955
|
const entries4 = await fs3.readdir(currentFsPath, { withFileTypes: true });
|
|
369594
369956
|
for (const entry of entries4) {
|
|
369595
369957
|
if (abortSignal?.aborted) {
|
|
369596
|
-
|
|
369958
|
+
logger11.debug("Traversal aborted during directory processing.");
|
|
369597
369959
|
break;
|
|
369598
369960
|
}
|
|
369599
369961
|
const maxItemsReached = await processDirectoryEntry(entry, currentFsPath, dir2, directoryIg, recursive, processedDirs, queue, scannedFileResults);
|
|
369600
369962
|
fileScannedCount++;
|
|
369601
369963
|
if (maxItemsReached || fileScannedCount >= MaxScanItems) {
|
|
369602
|
-
|
|
369964
|
+
logger11.debug(`MaxScanItems (${MaxScanItems}) reached or exceeded. Halting traversal.`);
|
|
369603
369965
|
queue.length = 0;
|
|
369604
369966
|
break;
|
|
369605
369967
|
}
|
|
369606
369968
|
}
|
|
369607
369969
|
} catch (error42) {
|
|
369608
369970
|
const message = error42 instanceof Error ? error42.message : String(error42);
|
|
369609
|
-
|
|
369971
|
+
logger11.warn(`Error reading directory ${currentFsPath}: ${message}`);
|
|
369610
369972
|
}
|
|
369611
369973
|
}
|
|
369612
|
-
|
|
369974
|
+
logger11.trace(`Completed traversal. Found ${scannedFileResults.length} items. Processed approximately ${fileScannedCount} entries.`);
|
|
369613
369975
|
return scannedFileResults;
|
|
369614
369976
|
}
|
|
369615
369977
|
// ../common/src/tool-utils/fs.ts
|
|
@@ -369713,10 +370075,10 @@ async function isFileExists(filePath) {
|
|
|
369713
370075
|
}
|
|
369714
370076
|
// ../common/src/tool-utils/list-files.ts
|
|
369715
370077
|
import path6 from "node:path";
|
|
369716
|
-
var
|
|
370078
|
+
var logger12 = getLogger("listFiles");
|
|
369717
370079
|
async function listFiles2(options4) {
|
|
369718
370080
|
const { cwd, path: dirPath, recursive, abortSignal } = options4;
|
|
369719
|
-
|
|
370081
|
+
logger12.debug("handling listFile with dirPath", dirPath, "and recursive", recursive);
|
|
369720
370082
|
const dir2 = resolvePath(dirPath, cwd);
|
|
369721
370083
|
if (!path6.isAbsolute(dirPath)) {
|
|
369722
370084
|
validateRelativePath(dirPath);
|
|
@@ -369733,7 +370095,7 @@ async function listFiles2(options4) {
|
|
|
369733
370095
|
return { files, isTruncated };
|
|
369734
370096
|
} catch (error42) {
|
|
369735
370097
|
const errorMessage = error42 instanceof Error ? error42.message : String(error42);
|
|
369736
|
-
|
|
370098
|
+
logger12.error("Error listing files:", errorMessage);
|
|
369737
370099
|
throw new Error(`Failed to list files: ${errorMessage}`);
|
|
369738
370100
|
}
|
|
369739
370101
|
}
|
|
@@ -369744,7 +370106,7 @@ async function listWorkspaceFiles(options4) {
|
|
|
369744
370106
|
abortSignal,
|
|
369745
370107
|
maxItems: maxItems2 = MaxListFileItems
|
|
369746
370108
|
} = options4;
|
|
369747
|
-
|
|
370109
|
+
logger12.debug("Listing workspace files from", cwd, "with maxItems", maxItems2);
|
|
369748
370110
|
try {
|
|
369749
370111
|
const results = await ignoreWalk({
|
|
369750
370112
|
dir: cwd,
|
|
@@ -369757,16 +370119,16 @@ async function listWorkspaceFiles(options4) {
|
|
|
369757
370119
|
});
|
|
369758
370120
|
return { files, isTruncated };
|
|
369759
370121
|
} catch (error42) {
|
|
369760
|
-
|
|
370122
|
+
logger12.warn("Failed to list workspace files:", error42);
|
|
369761
370123
|
return { files: [], isTruncated: false };
|
|
369762
370124
|
}
|
|
369763
370125
|
}
|
|
369764
370126
|
// ../common/src/tool-utils/glob-files.ts
|
|
369765
370127
|
import * as path7 from "node:path";
|
|
369766
|
-
var
|
|
370128
|
+
var logger13 = getLogger("globFiles");
|
|
369767
370129
|
async function globFiles2(options4) {
|
|
369768
370130
|
const { cwd, path: searchPath, globPattern, abortSignal } = options4;
|
|
369769
|
-
|
|
370131
|
+
logger13.debug("handling globFiles with searchPath:", searchPath, "and pattern", globPattern);
|
|
369770
370132
|
const dir2 = resolvePath(searchPath, cwd);
|
|
369771
370133
|
if (!path7.isAbsolute(searchPath)) {
|
|
369772
370134
|
validateRelativePath(searchPath);
|
|
@@ -369792,8 +370154,8 @@ async function globFiles2(options4) {
|
|
|
369792
370154
|
const errorMessage = error42 instanceof Error ? error42.message : String(error42);
|
|
369793
370155
|
throw new Error(`Failed to glob files: ${errorMessage}`);
|
|
369794
370156
|
}
|
|
369795
|
-
|
|
369796
|
-
|
|
370157
|
+
logger13.debug(`Found ${files.length} files matching pattern ${globPattern}`);
|
|
370158
|
+
logger13.trace("Files found in globFiles:", files);
|
|
369797
370159
|
return { files, isTruncated };
|
|
369798
370160
|
}
|
|
369799
370161
|
// ../common/src/tool-utils/system-info.ts
|
|
@@ -369889,7 +370251,7 @@ function parseGitOriginUrl(originUrl) {
|
|
|
369889
370251
|
}
|
|
369890
370252
|
|
|
369891
370253
|
// ../common/src/tool-utils/git-status.ts
|
|
369892
|
-
var
|
|
370254
|
+
var logger14 = getLogger("GitStatus");
|
|
369893
370255
|
|
|
369894
370256
|
class GitStatusReader {
|
|
369895
370257
|
execPromise = promisify2(exec3);
|
|
@@ -369996,16 +370358,16 @@ class GitStatusReader {
|
|
|
369996
370358
|
}
|
|
369997
370359
|
async readGitStatus() {
|
|
369998
370360
|
if (!this.cwd) {
|
|
369999
|
-
|
|
370361
|
+
logger14.warn("No Git repository path specified");
|
|
370000
370362
|
return;
|
|
370001
370363
|
}
|
|
370002
370364
|
try {
|
|
370003
|
-
|
|
370365
|
+
logger14.trace("Reading Git status for repository", {
|
|
370004
370366
|
path: this.cwd
|
|
370005
370367
|
});
|
|
370006
370368
|
return await this.readGitStatusImpl();
|
|
370007
370369
|
} catch (error42) {
|
|
370008
|
-
|
|
370370
|
+
logger14.error("Error reading Git status", error42);
|
|
370009
370371
|
return;
|
|
370010
370372
|
}
|
|
370011
370373
|
}
|
|
@@ -379731,7 +380093,7 @@ async function parseWorkflowFrontmatter(content3) {
|
|
|
379731
380093
|
};
|
|
379732
380094
|
}
|
|
379733
380095
|
// src/lib/load-agents.ts
|
|
379734
|
-
var
|
|
380096
|
+
var logger15 = getLogger("loadAgents");
|
|
379735
380097
|
async function readAgentsFromDir(dir2) {
|
|
379736
380098
|
const agents = [];
|
|
379737
380099
|
try {
|
|
@@ -379748,30 +380110,32 @@ async function readAgentsFromDir(dir2) {
|
|
|
379748
380110
|
}
|
|
379749
380111
|
}
|
|
379750
380112
|
} catch (error42) {
|
|
379751
|
-
|
|
380113
|
+
logger15.debug(`Could not read agents from directory ${dir2}:`, error42);
|
|
379752
380114
|
}
|
|
379753
380115
|
return agents;
|
|
379754
380116
|
}
|
|
379755
|
-
async function loadAgents(workingDirectory2) {
|
|
380117
|
+
async function loadAgents(workingDirectory2, includeSystemAgents = true) {
|
|
379756
380118
|
try {
|
|
379757
380119
|
const allAgents = [];
|
|
379758
380120
|
if (workingDirectory2) {
|
|
379759
380121
|
const projectAgentsDir = path10.join(workingDirectory2, ".pochi", "agents");
|
|
379760
380122
|
allAgents.push(...await readAgentsFromDir(projectAgentsDir));
|
|
379761
380123
|
}
|
|
379762
|
-
|
|
379763
|
-
|
|
380124
|
+
if (includeSystemAgents) {
|
|
380125
|
+
const systemAgentsDir = path10.join(os6.homedir(), ".pochi", "agents");
|
|
380126
|
+
allAgents.push(...await readAgentsFromDir(systemAgentsDir));
|
|
380127
|
+
}
|
|
379764
380128
|
const validAgents = allAgents.filter((agent) => {
|
|
379765
380129
|
if (isValidCustomAgentFile(agent)) {
|
|
379766
380130
|
return true;
|
|
379767
380131
|
}
|
|
379768
|
-
|
|
380132
|
+
logger15.warn(`Ignoring invalid custom agent file ${agent.filePath}: [${agent.error}] ${agent.message}`);
|
|
379769
380133
|
return false;
|
|
379770
380134
|
});
|
|
379771
|
-
|
|
380135
|
+
logger15.debug(`Loaded ${allAgents.length} custom agents (${validAgents.length} valid, ${allAgents.length - validAgents.length} invalid)`);
|
|
379772
380136
|
return validAgents;
|
|
379773
380137
|
} catch (error42) {
|
|
379774
|
-
|
|
380138
|
+
logger15.error("Failed to load custom agents", error42);
|
|
379775
380139
|
return [];
|
|
379776
380140
|
}
|
|
379777
380141
|
}
|
|
@@ -384403,10 +384767,10 @@ function isElectron() {
|
|
|
384403
384767
|
}
|
|
384404
384768
|
|
|
384405
384769
|
// ../../node_modules/pkce-challenge/dist/index.node.js
|
|
384406
|
-
var
|
|
384407
|
-
|
|
384770
|
+
var crypto6;
|
|
384771
|
+
crypto6 = globalThis.crypto?.webcrypto ?? globalThis.crypto ?? import("node:crypto").then((m) => m.webcrypto);
|
|
384408
384772
|
async function getRandomValues(size28) {
|
|
384409
|
-
return (await
|
|
384773
|
+
return (await crypto6).getRandomValues(new Uint8Array(size28));
|
|
384410
384774
|
}
|
|
384411
384775
|
async function random4(size28) {
|
|
384412
384776
|
const mask = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
|
|
@@ -384422,7 +384786,7 @@ async function generateVerifier(length5) {
|
|
|
384422
384786
|
return await random4(length5);
|
|
384423
384787
|
}
|
|
384424
384788
|
async function generateChallenge(code_verifier) {
|
|
384425
|
-
const buffer4 = await (await
|
|
384789
|
+
const buffer4 = await (await crypto6).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
384426
384790
|
return btoa(String.fromCharCode(...new Uint8Array(buffer4))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
384427
384791
|
}
|
|
384428
384792
|
async function pkceChallenge(length5) {
|
|
@@ -385443,7 +385807,7 @@ class McpConnection {
|
|
|
385443
385807
|
}
|
|
385444
385808
|
|
|
385445
385809
|
// ../common/src/mcp-utils/mcp-hub.ts
|
|
385446
|
-
var
|
|
385810
|
+
var logger16 = getLogger("MCPHub");
|
|
385447
385811
|
|
|
385448
385812
|
class McpHub {
|
|
385449
385813
|
listeners = [];
|
|
@@ -385465,7 +385829,7 @@ class McpHub {
|
|
|
385465
385829
|
if (connection) {
|
|
385466
385830
|
connection.restart();
|
|
385467
385831
|
} else {
|
|
385468
|
-
|
|
385832
|
+
logger16.debug(`Tried to restart non-existing connection: ${name17}`);
|
|
385469
385833
|
}
|
|
385470
385834
|
}
|
|
385471
385835
|
start(name17) {
|
|
@@ -385476,7 +385840,7 @@ class McpHub {
|
|
|
385476
385840
|
};
|
|
385477
385841
|
this.saveConfig(newConfig);
|
|
385478
385842
|
} else {
|
|
385479
|
-
|
|
385843
|
+
logger16.debug(`Tried to start non-existing server: ${name17}`);
|
|
385480
385844
|
}
|
|
385481
385845
|
}
|
|
385482
385846
|
stop(name17) {
|
|
@@ -385487,7 +385851,7 @@ class McpHub {
|
|
|
385487
385851
|
};
|
|
385488
385852
|
this.saveConfig(newConfig);
|
|
385489
385853
|
} else {
|
|
385490
|
-
|
|
385854
|
+
logger16.debug(`Tried to stop non-existing server: ${name17}`);
|
|
385491
385855
|
}
|
|
385492
385856
|
}
|
|
385493
385857
|
async addServer(name17, serverConfig) {
|
|
@@ -385518,7 +385882,7 @@ class McpHub {
|
|
|
385518
385882
|
const { effectiveTargets } = inspect(`mcp.${name17}`);
|
|
385519
385883
|
const editTarget = effectiveTargets[0] || "user";
|
|
385520
385884
|
await updateConfig({ mcp: { [name17]: config4 } }, editTarget).catch((error42) => {
|
|
385521
|
-
|
|
385885
|
+
logger16.error("Failed to persist MCP configuration changes", error42);
|
|
385522
385886
|
});
|
|
385523
385887
|
}
|
|
385524
385888
|
}
|
|
@@ -385543,7 +385907,7 @@ class McpHub {
|
|
|
385543
385907
|
toggleToolEnabled(serverName, toolName) {
|
|
385544
385908
|
const serverConfig = this.config.value[serverName];
|
|
385545
385909
|
if (!serverConfig) {
|
|
385546
|
-
|
|
385910
|
+
logger16.debug(`Server ${serverName} not found`);
|
|
385547
385911
|
return;
|
|
385548
385912
|
}
|
|
385549
385913
|
const disabledTools = serverConfig.disabledTools ?? [];
|
|
@@ -385569,7 +385933,7 @@ class McpHub {
|
|
|
385569
385933
|
return serverName;
|
|
385570
385934
|
}
|
|
385571
385935
|
init() {
|
|
385572
|
-
|
|
385936
|
+
logger16.trace("Initializing MCP Hub with config:", this.config.value);
|
|
385573
385937
|
o(() => {
|
|
385574
385938
|
for (const [name17, config4] of Object.entries(this.config.value)) {
|
|
385575
385939
|
this.createConnection(name17, config4);
|
|
@@ -385577,13 +385941,13 @@ class McpHub {
|
|
|
385577
385941
|
});
|
|
385578
385942
|
this.listeners.push({
|
|
385579
385943
|
dispose: this.config.subscribe(() => {
|
|
385580
|
-
|
|
385944
|
+
logger16.debug("MCP servers configuration changed via signal:");
|
|
385581
385945
|
this.onConfigChanged();
|
|
385582
385946
|
})
|
|
385583
385947
|
});
|
|
385584
385948
|
}
|
|
385585
385949
|
buildStatus() {
|
|
385586
|
-
|
|
385950
|
+
logger16.debug("Build MCPHub Status");
|
|
385587
385951
|
const connections = {};
|
|
385588
385952
|
for (const [vendorId, tools] of Object.entries(this.vendorTools.value)) {
|
|
385589
385953
|
connections[vendorId] = {
|
|
@@ -385620,7 +385984,7 @@ ${instructions2}`).join(`
|
|
|
385620
385984
|
};
|
|
385621
385985
|
}
|
|
385622
385986
|
onConnectionStatusChanged = () => {
|
|
385623
|
-
|
|
385987
|
+
logger16.debug("Connection status changed.");
|
|
385624
385988
|
this.connections.value = {
|
|
385625
385989
|
...this.connections.value
|
|
385626
385990
|
};
|
|
@@ -385631,12 +385995,12 @@ ${instructions2}`).join(`
|
|
|
385631
385995
|
...this.connections.value,
|
|
385632
385996
|
[name17]: connection
|
|
385633
385997
|
};
|
|
385634
|
-
|
|
385998
|
+
logger16.debug(`Connection ${name17} created.`);
|
|
385635
385999
|
}
|
|
385636
386000
|
updateConnection(name17, config4) {
|
|
385637
386001
|
const connection = this.connections.value[name17];
|
|
385638
386002
|
if (connection) {
|
|
385639
|
-
|
|
386003
|
+
logger16.debug(`Updating ${name17} with new config.`);
|
|
385640
386004
|
connection.updateConfig(config4);
|
|
385641
386005
|
}
|
|
385642
386006
|
}
|
|
@@ -385645,7 +386009,7 @@ ${instructions2}`).join(`
|
|
|
385645
386009
|
if (connection) {
|
|
385646
386010
|
connection.dispose();
|
|
385647
386011
|
this.connections.value = y2(this.connections.value, [name17]);
|
|
385648
|
-
|
|
386012
|
+
logger16.debug(`Connection ${name17} removed.`);
|
|
385649
386013
|
}
|
|
385650
386014
|
}
|
|
385651
386015
|
dispose() {
|
|
@@ -385660,7 +386024,7 @@ ${instructions2}`).join(`
|
|
|
385660
386024
|
}
|
|
385661
386025
|
}
|
|
385662
386026
|
// src/lib/mcp-hub-factory.ts
|
|
385663
|
-
var
|
|
386027
|
+
var logger17 = getLogger("McpHubFactory");
|
|
385664
386028
|
async function createCliMcpHub() {
|
|
385665
386029
|
const config4 = w(() => config2.value.mcp || {});
|
|
385666
386030
|
const vendorTools = d(await fetchTools());
|
|
@@ -385682,7 +386046,7 @@ async function fetchTools() {
|
|
|
385682
386046
|
toolsets[vendorId] = tools;
|
|
385683
386047
|
}
|
|
385684
386048
|
} catch (e2) {
|
|
385685
|
-
|
|
386049
|
+
logger17.error(`Failed to fetch models for vendor ${vendorId}:`, e2);
|
|
385686
386050
|
}
|
|
385687
386051
|
}
|
|
385688
386052
|
}
|
|
@@ -409395,12 +409759,12 @@ function toTaskError(error46) {
|
|
|
409395
409759
|
}
|
|
409396
409760
|
|
|
409397
409761
|
// ../livekit/src/chat/llm/generate-task-title.ts
|
|
409398
|
-
var
|
|
409762
|
+
var logger18 = getLogger("generateTaskTitle");
|
|
409399
409763
|
async function generateTaskTitle(options6) {
|
|
409400
409764
|
const { title } = options6;
|
|
409401
409765
|
const newTitle = await generateTaskTitleImpl(options6);
|
|
409402
409766
|
if (newTitle !== undefined) {
|
|
409403
|
-
|
|
409767
|
+
logger18.debug(`Generating task title, old: ${title}, new: ${newTitle}`);
|
|
409404
409768
|
}
|
|
409405
409769
|
return newTitle;
|
|
409406
409770
|
}
|
|
@@ -409427,7 +409791,7 @@ async function generateTaskTitleImpl({
|
|
|
409427
409791
|
return title2;
|
|
409428
409792
|
}
|
|
409429
409793
|
} catch (err2) {
|
|
409430
|
-
|
|
409794
|
+
logger18.warn("Failed to generate title", err2);
|
|
409431
409795
|
}
|
|
409432
409796
|
}
|
|
409433
409797
|
if (title === null) {
|
|
@@ -409473,7 +409837,7 @@ async function generateTitle2(model2, inputMessages, abortSignal) {
|
|
|
409473
409837
|
}
|
|
409474
409838
|
|
|
409475
409839
|
// ../livekit/src/chat/background-job/manager.ts
|
|
409476
|
-
var
|
|
409840
|
+
var logger19 = getLogger("BackgroundJobManager");
|
|
409477
409841
|
|
|
409478
409842
|
class BackgroundJobManager {
|
|
409479
409843
|
jobs = Promise.resolve();
|
|
@@ -409487,7 +409851,7 @@ class BackgroundJobManager {
|
|
|
409487
409851
|
}
|
|
409488
409852
|
this.pendingJobs.delete(nextJob.id);
|
|
409489
409853
|
return nextJob.process().catch((error46) => {
|
|
409490
|
-
|
|
409854
|
+
logger19.error(`Failed to process job for task ${nextJob.id}`, error46);
|
|
409491
409855
|
});
|
|
409492
409856
|
});
|
|
409493
409857
|
job.waitUntil?.(this.jobs);
|
|
@@ -409496,7 +409860,7 @@ class BackgroundJobManager {
|
|
|
409496
409860
|
var backgroundJobManager = new BackgroundJobManager;
|
|
409497
409861
|
|
|
409498
409862
|
// ../livekit/src/chat/background-job/generate-title.ts
|
|
409499
|
-
var
|
|
409863
|
+
var logger20 = getLogger("GenerateTitleManager");
|
|
409500
409864
|
function scheduleGenerateTitleJob(job) {
|
|
409501
409865
|
backgroundJobManager.push({
|
|
409502
409866
|
id: `generate-title-${job.taskId}`,
|
|
@@ -409512,7 +409876,7 @@ async function process16({
|
|
|
409512
409876
|
}) {
|
|
409513
409877
|
const task = store.query(makeTaskQuery(taskId));
|
|
409514
409878
|
if (!task) {
|
|
409515
|
-
|
|
409879
|
+
logger20.warn(`Task not found for title generation: ${taskId}`);
|
|
409516
409880
|
return;
|
|
409517
409881
|
}
|
|
409518
409882
|
const newTitle = await generateTaskTitle({
|
|
@@ -409529,7 +409893,7 @@ async function process16({
|
|
|
409529
409893
|
}
|
|
409530
409894
|
}
|
|
409531
409895
|
// ../livekit/src/chat/llm/repair-tool-call.ts
|
|
409532
|
-
var
|
|
409896
|
+
var logger21 = getLogger("RepairToolCall");
|
|
409533
409897
|
var makeRepairToolCall = (model2) => async ({ toolCall, inputSchema, error: error46 }) => {
|
|
409534
409898
|
if (NoSuchToolError.isInstance(error46)) {
|
|
409535
409899
|
return null;
|
|
@@ -409573,11 +409937,11 @@ var makeRepairToolCall = (model2) => async ({ toolCall, inputSchema, error: erro
|
|
|
409573
409937
|
maxRetries: 0
|
|
409574
409938
|
});
|
|
409575
409939
|
const input2 = await result2.text;
|
|
409576
|
-
|
|
409940
|
+
logger21.debug("Repairing tool call:", toolCall.toolName, input2);
|
|
409577
409941
|
return { ...toolCall, input: input2 };
|
|
409578
409942
|
};
|
|
409579
409943
|
// ../livekit/src/chat/llm/compact-task.ts
|
|
409580
|
-
var
|
|
409944
|
+
var logger22 = getLogger("compactTask");
|
|
409581
409945
|
async function compactTask({
|
|
409582
409946
|
model: model2,
|
|
409583
409947
|
messages: messages2,
|
|
@@ -409599,7 +409963,7 @@ async function compactTask({
|
|
|
409599
409963
|
}
|
|
409600
409964
|
return text20;
|
|
409601
409965
|
} catch (err2) {
|
|
409602
|
-
|
|
409966
|
+
logger22.warn("Failed to create summary", err2);
|
|
409603
409967
|
}
|
|
409604
409968
|
}
|
|
409605
409969
|
async function createSummary(model2, abortSignal, inputMessages) {
|
|
@@ -409664,8 +410028,10 @@ var contentOutputFn = (output2) => {
|
|
|
409664
410028
|
};
|
|
409665
410029
|
};
|
|
409666
410030
|
var toModelOutputFn = {
|
|
410031
|
+
take_screenshot: contentOutputFn,
|
|
409667
410032
|
browser_take_screenshot: contentOutputFn,
|
|
409668
|
-
webFetch: contentOutputFn
|
|
410033
|
+
webFetch: contentOutputFn,
|
|
410034
|
+
webSearch: contentOutputFn
|
|
409669
410035
|
};
|
|
409670
410036
|
|
|
409671
410037
|
// ../livekit/src/chat/middlewares/utils.ts
|
|
@@ -410425,7 +410791,7 @@ function createGoogleVertexTuningModel(llm) {
|
|
|
410425
410791
|
}
|
|
410426
410792
|
|
|
410427
410793
|
// ../livekit/src/chat/models/openai.ts
|
|
410428
|
-
var
|
|
410794
|
+
var logger23 = getLogger("openai");
|
|
410429
410795
|
var OpenAIRequestParamsSchema = exports_external.object({
|
|
410430
410796
|
max_tokens: exports_external.number().positive().optional(),
|
|
410431
410797
|
max_completion_tokens: exports_external.number().positive().optional()
|
|
@@ -410475,7 +410841,7 @@ function overrideMaxOutputToken(body3) {
|
|
|
410475
410841
|
const json10 = JSON.parse(body3);
|
|
410476
410842
|
const result2 = OpenAIRequestParamsSchema.safeParse(json10);
|
|
410477
410843
|
if (!result2.success) {
|
|
410478
|
-
|
|
410844
|
+
logger23.error("OpenAI request body validation failed:", result2.error);
|
|
410479
410845
|
return;
|
|
410480
410846
|
}
|
|
410481
410847
|
const parsed = result2.data;
|
|
@@ -410484,7 +410850,7 @@ function overrideMaxOutputToken(body3) {
|
|
|
410484
410850
|
}
|
|
410485
410851
|
return JSON.stringify(parsed);
|
|
410486
410852
|
} catch (error46) {
|
|
410487
|
-
|
|
410853
|
+
logger23.error("Failed to parse OpenAI request body:", error46);
|
|
410488
410854
|
}
|
|
410489
410855
|
return;
|
|
410490
410856
|
}
|
|
@@ -410665,7 +411031,7 @@ function estimateTotalTokens(messages2) {
|
|
|
410665
411031
|
}
|
|
410666
411032
|
|
|
410667
411033
|
// ../livekit/src/chat/live-chat-kit.ts
|
|
410668
|
-
var
|
|
411034
|
+
var logger24 = getLogger("LiveChatKit");
|
|
410669
411035
|
|
|
410670
411036
|
class LiveChatKit {
|
|
410671
411037
|
taskId;
|
|
@@ -410721,7 +411087,7 @@ class LiveChatKit {
|
|
|
410721
411087
|
inline: true
|
|
410722
411088
|
});
|
|
410723
411089
|
} catch (err2) {
|
|
410724
|
-
|
|
411090
|
+
logger24.error("Failed to compact task", err2);
|
|
410725
411091
|
throw err2;
|
|
410726
411092
|
}
|
|
410727
411093
|
}
|
|
@@ -410851,7 +411217,7 @@ class LiveChatKit {
|
|
|
410851
411217
|
}));
|
|
410852
411218
|
};
|
|
410853
411219
|
onError = (error46) => {
|
|
410854
|
-
|
|
411220
|
+
logger24.error("onError", error46);
|
|
410855
411221
|
const lastMessage = this.chat.messages.at(-1) || null;
|
|
410856
411222
|
this.store.commit(events.chatStreamFailed({
|
|
410857
411223
|
id: this.taskId,
|
|
@@ -411004,7 +411370,7 @@ import * as nodePath from "node:path";
|
|
|
411004
411370
|
|
|
411005
411371
|
// ../common/src/diff-utils.ts
|
|
411006
411372
|
var import_fast_levenshtein = __toESM(require_levenshtein(), 1);
|
|
411007
|
-
var
|
|
411373
|
+
var logger25 = getLogger("diffUtils");
|
|
411008
411374
|
function normalize6(content3) {
|
|
411009
411375
|
return content3.replace(/\r\n/g, `
|
|
411010
411376
|
`).trimEnd();
|
|
@@ -411017,7 +411383,7 @@ class DiffError extends Error {
|
|
|
411017
411383
|
}
|
|
411018
411384
|
}
|
|
411019
411385
|
async function parseDiffAndApply(fileContent3, searchContent, replaceContent, expectedReplacements = 1) {
|
|
411020
|
-
|
|
411386
|
+
logger25.trace(`Applying diff with expectedReplacements: ${expectedReplacements}`);
|
|
411021
411387
|
const isCRLF = fileContent3.includes(`\r
|
|
411022
411388
|
`);
|
|
411023
411389
|
const normalizedFileContent = normalize6(fileContent3);
|
|
@@ -411034,11 +411400,11 @@ async function parseDiffAndApply(fileContent3, searchContent, replaceContent, ex
|
|
|
411034
411400
|
const matches2 = searchContentExact(normalizedFileContent, normalizedSearchContent);
|
|
411035
411401
|
if (matches2.length < expectedReplacements) {
|
|
411036
411402
|
matches2.push(...searchContentWithLineTrimmed(normalizedFileContent, normalizedSearchContent));
|
|
411037
|
-
|
|
411403
|
+
logger25.trace(`Found ${matches2.length} matches after line trimming search strategy`);
|
|
411038
411404
|
}
|
|
411039
411405
|
if (matches2.length < expectedReplacements) {
|
|
411040
411406
|
matches2.push(...searchContentByBlockAnchor(normalizedFileContent, normalizedSearchContent));
|
|
411041
|
-
|
|
411407
|
+
logger25.trace(`Found ${matches2.length} matches after block anchor search strategy`);
|
|
411042
411408
|
}
|
|
411043
411409
|
if (matches2.length === 0) {
|
|
411044
411410
|
throw new DiffError("Search content does not match the file content. Try to reread the file for the latest content.");
|
|
@@ -411047,7 +411413,7 @@ async function parseDiffAndApply(fileContent3, searchContent, replaceContent, ex
|
|
|
411047
411413
|
throw new DiffError(`Expected ${expectedReplacements} occurrences but found ${matches2.length}. Please verify the search content and expectedReplacements parameter.`);
|
|
411048
411414
|
}
|
|
411049
411415
|
const result2 = replaceMatches(normalizedFileContent, matches2, replaceContent);
|
|
411050
|
-
|
|
411416
|
+
logger25.trace("Successfully applied diff");
|
|
411051
411417
|
if (isCRLF) {
|
|
411052
411418
|
return result2.replace(/\n/g, `\r
|
|
411053
411419
|
`);
|
|
@@ -411401,11 +411767,11 @@ var readFile13 = (context15) => async ({ path: path27, startLine, endLine }) =>
|
|
|
411401
411767
|
|
|
411402
411768
|
// src/tools/search-files.ts
|
|
411403
411769
|
import * as fs14 from "node:fs";
|
|
411404
|
-
var
|
|
411770
|
+
var logger26 = getLogger("searchFiles");
|
|
411405
411771
|
var searchFiles2 = (context15) => async ({ path: path27, regex: regex3, filePattern }, { abortSignal }) => {
|
|
411406
411772
|
const rgPath = context15.rg;
|
|
411407
411773
|
if (!rgPath || !fs14.existsSync(rgPath)) {
|
|
411408
|
-
|
|
411774
|
+
logger26.error("Ripgrep not found at path", rgPath);
|
|
411409
411775
|
throw new Error(`Ripgrep not found at path: ${rgPath}`);
|
|
411410
411776
|
}
|
|
411411
411777
|
return await searchFilesWithRipgrep(path27, regex3, rgPath, context15.cwd, filePattern, abortSignal);
|
|
@@ -411482,7 +411848,7 @@ async function executeToolCall(tool4, options6, abortSignal) {
|
|
|
411482
411848
|
}
|
|
411483
411849
|
|
|
411484
411850
|
// src/task-runner.ts
|
|
411485
|
-
var
|
|
411851
|
+
var logger27 = getLogger("TaskRunner");
|
|
411486
411852
|
|
|
411487
411853
|
class TaskRunner {
|
|
411488
411854
|
toolCallOptions;
|
|
@@ -411557,9 +411923,9 @@ class TaskRunner {
|
|
|
411557
411923
|
return this.chatKit.task?.shareId;
|
|
411558
411924
|
}
|
|
411559
411925
|
async run() {
|
|
411560
|
-
|
|
411926
|
+
logger27.debug("Starting TaskRunner...");
|
|
411561
411927
|
try {
|
|
411562
|
-
|
|
411928
|
+
logger27.trace("Start step loop.");
|
|
411563
411929
|
this.stepCount.reset();
|
|
411564
411930
|
while (true) {
|
|
411565
411931
|
const stepResult = await this.step();
|
|
@@ -411574,7 +411940,7 @@ class TaskRunner {
|
|
|
411574
411940
|
}
|
|
411575
411941
|
} catch (e11) {
|
|
411576
411942
|
const error46 = toError2(e11);
|
|
411577
|
-
|
|
411943
|
+
logger27.trace("Failed:", error46);
|
|
411578
411944
|
}
|
|
411579
411945
|
}
|
|
411580
411946
|
async step() {
|
|
@@ -411612,24 +411978,24 @@ class TaskRunner {
|
|
|
411612
411978
|
throw new Error("Task is not loaded");
|
|
411613
411979
|
}
|
|
411614
411980
|
if ((task.status === "completed" || task.status === "pending-input") && isResultMessage(message)) {
|
|
411615
|
-
|
|
411981
|
+
logger27.trace("Task is completed or pending input, no more steps to process.");
|
|
411616
411982
|
return "finished";
|
|
411617
411983
|
}
|
|
411618
411984
|
if (task.status === "failed") {
|
|
411619
411985
|
if (task.error?.kind === "APICallError" && !task.error.isRetryable) {
|
|
411620
411986
|
return "finished";
|
|
411621
411987
|
}
|
|
411622
|
-
|
|
411988
|
+
logger27.error("Task is failed, trying to resend last message to resume it.", task.error);
|
|
411623
411989
|
return "retry";
|
|
411624
411990
|
}
|
|
411625
411991
|
if (message.role !== "assistant") {
|
|
411626
|
-
|
|
411992
|
+
logger27.trace("Last message is not a assistant message, resending it to resume the task.");
|
|
411627
411993
|
return "retry";
|
|
411628
411994
|
}
|
|
411629
411995
|
if (isAssistantMessageWithEmptyParts(message) || isAssistantMessageWithPartialToolCalls(message) || isAssistantMessageWithOutputError(message) || lastAssistantMessageIsCompleteWithToolCalls({
|
|
411630
411996
|
messages: this.chat.messages
|
|
411631
411997
|
})) {
|
|
411632
|
-
|
|
411998
|
+
logger27.trace("Last message is assistant with empty parts or partial/completed tool calls, resending it to resume the task.");
|
|
411633
411999
|
const processed = prepareLastMessageForRetry(message);
|
|
411634
412000
|
if (processed) {
|
|
411635
412001
|
this.chat.appendOrReplaceMessage(processed);
|
|
@@ -411637,28 +412003,28 @@ class TaskRunner {
|
|
|
411637
412003
|
return "retry";
|
|
411638
412004
|
}
|
|
411639
412005
|
if (isAssistantMessageWithNoToolCalls(message)) {
|
|
411640
|
-
|
|
412006
|
+
logger27.trace("Last message is assistant with no tool calls, sending a new user reminder.");
|
|
411641
412007
|
const message2 = createUserMessage(prompts.createSystemReminder("You should use tool calls to answer the question, for example, use attemptCompletion if the job is done, or use askFollowupQuestions to clarify the request."));
|
|
411642
412008
|
this.chat.appendOrReplaceMessage(message2);
|
|
411643
412009
|
return "next";
|
|
411644
412010
|
}
|
|
411645
412011
|
}
|
|
411646
412012
|
async processToolCalls(message) {
|
|
411647
|
-
|
|
412013
|
+
logger27.trace("Processing tool calls in the last message.");
|
|
411648
412014
|
for (const toolCall of message.parts.filter(isToolUIPart)) {
|
|
411649
412015
|
if (toolCall.state !== "input-available")
|
|
411650
412016
|
continue;
|
|
411651
412017
|
const toolName = getToolName(toolCall);
|
|
411652
|
-
|
|
412018
|
+
logger27.trace(`Found tool call: ${toolName} with args: ${JSON.stringify(toolCall.input)}`);
|
|
411653
412019
|
const toolResult = await executeToolCall(toolCall, this.toolCallOptions);
|
|
411654
412020
|
this.chatKit.chat.addToolResult({
|
|
411655
412021
|
tool: toolName,
|
|
411656
412022
|
toolCallId: toolCall.toolCallId,
|
|
411657
412023
|
output: toolResult
|
|
411658
412024
|
});
|
|
411659
|
-
|
|
412025
|
+
logger27.trace(`Tool call result: ${JSON.stringify(toolResult)}`);
|
|
411660
412026
|
}
|
|
411661
|
-
|
|
412027
|
+
logger27.trace("All tool calls processed in the last message.");
|
|
411662
412028
|
return "next";
|
|
411663
412029
|
}
|
|
411664
412030
|
}
|
|
@@ -411955,8 +412321,8 @@ function registerUpgradeCommand(program5) {
|
|
|
411955
412321
|
});
|
|
411956
412322
|
}
|
|
411957
412323
|
// src/cli.ts
|
|
411958
|
-
var
|
|
411959
|
-
|
|
412324
|
+
var logger28 = getLogger("Pochi");
|
|
412325
|
+
logger28.debug(`pochi v${package_default.version}`);
|
|
411960
412326
|
var parsePositiveInt = (input2) => {
|
|
411961
412327
|
if (!input2) {
|
|
411962
412328
|
return program5.error("The value for this option must be a positive integer.");
|