@getpochi/cli 0.5.43 → 0.5.45
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 +615 -317
- 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",
|
|
@@ -358377,6 +358377,235 @@ class GithubCopilot extends VendorBase {
|
|
|
358377
358377
|
// ../vendor-github-copilot/src/node.ts
|
|
358378
358378
|
registerVendor(new GithubCopilot);
|
|
358379
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
|
+
"qwen-vl-max": {
|
|
358599
|
+
contextWindow: 128000,
|
|
358600
|
+
useToolCallMiddleware: false
|
|
358601
|
+
}
|
|
358602
|
+
};
|
|
358603
|
+
}
|
|
358604
|
+
}
|
|
358605
|
+
|
|
358606
|
+
// ../vendor-qwen-code/src/node.ts
|
|
358607
|
+
registerVendor(new QwenCode);
|
|
358608
|
+
|
|
358380
358609
|
// ../common/src/vendor/edge.ts
|
|
358381
358610
|
var { register: register2, get: get2 } = createRegistry();
|
|
358382
358611
|
var registerModel = register2;
|
|
@@ -368117,6 +368346,70 @@ function createPatchedFetch3(getCredentials) {
|
|
|
368117
368346
|
// ../vendor-github-copilot/src/edge.ts
|
|
368118
368347
|
registerModel(VendorId6, createCopilotModel);
|
|
368119
368348
|
|
|
368349
|
+
// ../vendor-qwen-code/src/model.ts
|
|
368350
|
+
var BaseUrl2 = "https://portal.qwen.ai/v1";
|
|
368351
|
+
var ModelIdMap2 = {
|
|
368352
|
+
"qwen-vl-max": "vision-model"
|
|
368353
|
+
};
|
|
368354
|
+
function createQwenModel({
|
|
368355
|
+
modelId,
|
|
368356
|
+
getCredentials
|
|
368357
|
+
}) {
|
|
368358
|
+
const actualModelId = ModelIdMap2[modelId] || modelId;
|
|
368359
|
+
const qwenModel = createOpenAICompatible({
|
|
368360
|
+
name: "OpenAI",
|
|
368361
|
+
baseURL: BaseUrl2,
|
|
368362
|
+
fetch: createPatchedFetch4(getCredentials)
|
|
368363
|
+
})(actualModelId);
|
|
368364
|
+
return wrapLanguageModel({
|
|
368365
|
+
model: qwenModel,
|
|
368366
|
+
middleware: {
|
|
368367
|
+
middlewareVersion: "v2",
|
|
368368
|
+
async transformParams({ params }) {
|
|
368369
|
+
return {
|
|
368370
|
+
...params,
|
|
368371
|
+
max_tokens: 8192
|
|
368372
|
+
};
|
|
368373
|
+
}
|
|
368374
|
+
}
|
|
368375
|
+
});
|
|
368376
|
+
}
|
|
368377
|
+
function createPatchedFetch4(getCredentials) {
|
|
368378
|
+
return async (requestInfo, requestInit) => {
|
|
368379
|
+
const { access_token } = await getCredentials();
|
|
368380
|
+
const headers = new Headers(requestInit?.headers);
|
|
368381
|
+
headers.set("Authorization", `Bearer ${access_token}`);
|
|
368382
|
+
let finalUrl;
|
|
368383
|
+
if (globalThis.POCHI_CORS_PROXY_PORT) {
|
|
368384
|
+
const originalUrl = new URL(requestInfo.toString());
|
|
368385
|
+
const url2 = new URL(originalUrl);
|
|
368386
|
+
url2.protocol = "http:";
|
|
368387
|
+
url2.host = "localhost";
|
|
368388
|
+
url2.port = globalThis.POCHI_CORS_PROXY_PORT;
|
|
368389
|
+
headers.set("x-proxy-origin", originalUrl.origin);
|
|
368390
|
+
finalUrl = url2;
|
|
368391
|
+
} else {
|
|
368392
|
+
finalUrl = requestInfo;
|
|
368393
|
+
}
|
|
368394
|
+
const resp = await fetch(finalUrl, {
|
|
368395
|
+
...requestInit,
|
|
368396
|
+
headers
|
|
368397
|
+
});
|
|
368398
|
+
if (!resp.ok) {
|
|
368399
|
+
throw new APICallError({
|
|
368400
|
+
message: `Failed to fetch: ${resp.status} ${resp.statusText}`,
|
|
368401
|
+
statusCode: resp.status,
|
|
368402
|
+
url: typeof requestInfo === "string" ? requestInfo : requestInfo.toString(),
|
|
368403
|
+
requestBodyValues: null
|
|
368404
|
+
});
|
|
368405
|
+
}
|
|
368406
|
+
return resp;
|
|
368407
|
+
};
|
|
368408
|
+
}
|
|
368409
|
+
|
|
368410
|
+
// ../vendor-qwen-code/src/edge.ts
|
|
368411
|
+
registerModel(VendorId7, createQwenModel);
|
|
368412
|
+
|
|
368120
368413
|
// ../../node_modules/@commander-js/extra-typings/esm.mjs
|
|
368121
368414
|
var import__5 = __toESM(require_extra_typings(), 1);
|
|
368122
368415
|
var {
|
|
@@ -368154,7 +368447,7 @@ var {
|
|
|
368154
368447
|
// package.json
|
|
368155
368448
|
var package_default = {
|
|
368156
368449
|
name: "@getpochi/cli",
|
|
368157
|
-
version: "0.5.
|
|
368450
|
+
version: "0.5.45",
|
|
368158
368451
|
type: "module",
|
|
368159
368452
|
bin: {
|
|
368160
368453
|
pochi: "src/cli.ts"
|
|
@@ -368178,6 +368471,7 @@ var package_default = {
|
|
|
368178
368471
|
"@getpochi/vendor-gemini-cli": "workspace:*",
|
|
368179
368472
|
"@getpochi/vendor-pochi": "workspace:*",
|
|
368180
368473
|
"@getpochi/vendor-codex": "workspace:*",
|
|
368474
|
+
"@getpochi/vendor-qwen-code": "workspace:*",
|
|
368181
368475
|
"@inquirer/select": "^4.3.2",
|
|
368182
368476
|
"@getpochi/vendor-github-copilot": "workspace:*",
|
|
368183
368477
|
"@livestore/adapter-node": "catalog:",
|
|
@@ -369534,9 +369828,9 @@ var MaxTerminalOutputSize = 30000;
|
|
|
369534
369828
|
|
|
369535
369829
|
// ../common/src/tool-utils/ripgrep.ts
|
|
369536
369830
|
var execAsync = promisify(exec2);
|
|
369537
|
-
var
|
|
369831
|
+
var logger10 = getLogger("RipgrepUtils");
|
|
369538
369832
|
async function searchFilesWithRipgrep(path4, regex, rgPath, workspacePath, filePattern, abortSignal) {
|
|
369539
|
-
|
|
369833
|
+
logger10.debug("searchFiles", path4, regex, filePattern);
|
|
369540
369834
|
const matches = [];
|
|
369541
369835
|
let command = `"${rgPath.replace(/"/g, "\\\"")}" --json --case-sensitive --binary --sortr modified `;
|
|
369542
369836
|
if (filePattern) {
|
|
@@ -369544,14 +369838,14 @@ async function searchFilesWithRipgrep(path4, regex, rgPath, workspacePath, fileP
|
|
|
369544
369838
|
}
|
|
369545
369839
|
const absPath = resolve5(workspacePath, path4.replace(/'/g, "'\\''"));
|
|
369546
369840
|
command += `'${regex.replace(/'/g, "'\\''")}' '${absPath}'`;
|
|
369547
|
-
|
|
369841
|
+
logger10.debug("command", command);
|
|
369548
369842
|
try {
|
|
369549
369843
|
const { stdout: stdout2, stderr: stderr2 } = await execAsync(command, {
|
|
369550
369844
|
maxBuffer: 1024 * 1024 * 10,
|
|
369551
369845
|
signal: abortSignal
|
|
369552
369846
|
});
|
|
369553
369847
|
if (stderr2) {
|
|
369554
|
-
|
|
369848
|
+
logger10.warn("rg command stderr: ", stderr2.slice(0, 1000));
|
|
369555
369849
|
}
|
|
369556
369850
|
const outputLines = stdout2.trim().split(`
|
|
369557
369851
|
`);
|
|
@@ -369567,25 +369861,25 @@ async function searchFilesWithRipgrep(path4, regex, rgPath, workspacePath, fileP
|
|
|
369567
369861
|
});
|
|
369568
369862
|
}
|
|
369569
369863
|
} catch (parseError2) {
|
|
369570
|
-
|
|
369864
|
+
logger10.error(`Failed to parse rg JSON output line: ${line}`, parseError2);
|
|
369571
369865
|
}
|
|
369572
369866
|
}
|
|
369573
369867
|
} catch (error42) {
|
|
369574
369868
|
if (!error42) {
|
|
369575
|
-
|
|
369869
|
+
logger10.error("rg command error: ", error42);
|
|
369576
369870
|
throw error42;
|
|
369577
369871
|
}
|
|
369578
369872
|
if (error42.code && error42.code > 1) {
|
|
369579
369873
|
throw new Error(`rg command failed with code ${error42.code}: ${error42.stderr || error42.message}`);
|
|
369580
369874
|
}
|
|
369581
369875
|
if (!error42.code && error42.stderr) {
|
|
369582
|
-
|
|
369876
|
+
logger10.warn(`rg command stderr (exit code 0): ${error42.stderr}`);
|
|
369583
369877
|
} else if (error42.code === 1 && !error42.stdout && !error42.stderr) {} else if (error42.code === 1 && error42.stdout) {
|
|
369584
369878
|
if (error42.stderr) {
|
|
369585
|
-
|
|
369879
|
+
logger10.warn(`rg command stderr (exit code 1): ${error42.stderr}`);
|
|
369586
369880
|
}
|
|
369587
369881
|
} else {
|
|
369588
|
-
|
|
369882
|
+
logger10.error("Error executing rg command: ", error42);
|
|
369589
369883
|
throw error42;
|
|
369590
369884
|
}
|
|
369591
369885
|
}
|
|
@@ -369598,7 +369892,7 @@ async function searchFilesWithRipgrep(path4, regex, rgPath, workspacePath, fileP
|
|
|
369598
369892
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
369599
369893
|
import * as fs3 from "node:fs/promises";
|
|
369600
369894
|
import * as path4 from "node:path";
|
|
369601
|
-
var
|
|
369895
|
+
var logger11 = getLogger("ignoreWalk");
|
|
369602
369896
|
var MaxScanItems = 1e4;
|
|
369603
369897
|
async function attemptLoadIgnoreFromPath(directoryPath) {
|
|
369604
369898
|
try {
|
|
@@ -369644,9 +369938,9 @@ async function ignoreWalk({
|
|
|
369644
369938
|
const scannedFileResults = [];
|
|
369645
369939
|
const processedDirs = new Set;
|
|
369646
369940
|
const queue = [{ uri: dir2, ignore: import_ignore.default().add(".git") }];
|
|
369647
|
-
|
|
369941
|
+
logger11.trace(`Starting traversal from ${dir2} with limit ${MaxScanItems}, recursive: ${recursive}`);
|
|
369648
369942
|
if (abortSignal?.aborted) {
|
|
369649
|
-
|
|
369943
|
+
logger11.debug("Traversal aborted before starting.");
|
|
369650
369944
|
return [];
|
|
369651
369945
|
}
|
|
369652
369946
|
let fileScannedCount = 0;
|
|
@@ -369665,23 +369959,23 @@ async function ignoreWalk({
|
|
|
369665
369959
|
const entries4 = await fs3.readdir(currentFsPath, { withFileTypes: true });
|
|
369666
369960
|
for (const entry of entries4) {
|
|
369667
369961
|
if (abortSignal?.aborted) {
|
|
369668
|
-
|
|
369962
|
+
logger11.debug("Traversal aborted during directory processing.");
|
|
369669
369963
|
break;
|
|
369670
369964
|
}
|
|
369671
369965
|
const maxItemsReached = await processDirectoryEntry(entry, currentFsPath, dir2, directoryIg, recursive, processedDirs, queue, scannedFileResults);
|
|
369672
369966
|
fileScannedCount++;
|
|
369673
369967
|
if (maxItemsReached || fileScannedCount >= MaxScanItems) {
|
|
369674
|
-
|
|
369968
|
+
logger11.debug(`MaxScanItems (${MaxScanItems}) reached or exceeded. Halting traversal.`);
|
|
369675
369969
|
queue.length = 0;
|
|
369676
369970
|
break;
|
|
369677
369971
|
}
|
|
369678
369972
|
}
|
|
369679
369973
|
} catch (error42) {
|
|
369680
369974
|
const message = error42 instanceof Error ? error42.message : String(error42);
|
|
369681
|
-
|
|
369975
|
+
logger11.warn(`Error reading directory ${currentFsPath}: ${message}`);
|
|
369682
369976
|
}
|
|
369683
369977
|
}
|
|
369684
|
-
|
|
369978
|
+
logger11.trace(`Completed traversal. Found ${scannedFileResults.length} items. Processed approximately ${fileScannedCount} entries.`);
|
|
369685
369979
|
return scannedFileResults;
|
|
369686
369980
|
}
|
|
369687
369981
|
// ../common/src/tool-utils/fs.ts
|
|
@@ -369785,10 +370079,10 @@ async function isFileExists(filePath) {
|
|
|
369785
370079
|
}
|
|
369786
370080
|
// ../common/src/tool-utils/list-files.ts
|
|
369787
370081
|
import path6 from "node:path";
|
|
369788
|
-
var
|
|
370082
|
+
var logger12 = getLogger("listFiles");
|
|
369789
370083
|
async function listFiles2(options4) {
|
|
369790
370084
|
const { cwd, path: dirPath, recursive, abortSignal } = options4;
|
|
369791
|
-
|
|
370085
|
+
logger12.debug("handling listFile with dirPath", dirPath, "and recursive", recursive);
|
|
369792
370086
|
const dir2 = resolvePath(dirPath, cwd);
|
|
369793
370087
|
if (!path6.isAbsolute(dirPath)) {
|
|
369794
370088
|
validateRelativePath(dirPath);
|
|
@@ -369805,7 +370099,7 @@ async function listFiles2(options4) {
|
|
|
369805
370099
|
return { files, isTruncated };
|
|
369806
370100
|
} catch (error42) {
|
|
369807
370101
|
const errorMessage = error42 instanceof Error ? error42.message : String(error42);
|
|
369808
|
-
|
|
370102
|
+
logger12.error("Error listing files:", errorMessage);
|
|
369809
370103
|
throw new Error(`Failed to list files: ${errorMessage}`);
|
|
369810
370104
|
}
|
|
369811
370105
|
}
|
|
@@ -369816,7 +370110,7 @@ async function listWorkspaceFiles(options4) {
|
|
|
369816
370110
|
abortSignal,
|
|
369817
370111
|
maxItems: maxItems2 = MaxListFileItems
|
|
369818
370112
|
} = options4;
|
|
369819
|
-
|
|
370113
|
+
logger12.debug("Listing workspace files from", cwd, "with maxItems", maxItems2);
|
|
369820
370114
|
try {
|
|
369821
370115
|
const results = await ignoreWalk({
|
|
369822
370116
|
dir: cwd,
|
|
@@ -369829,16 +370123,16 @@ async function listWorkspaceFiles(options4) {
|
|
|
369829
370123
|
});
|
|
369830
370124
|
return { files, isTruncated };
|
|
369831
370125
|
} catch (error42) {
|
|
369832
|
-
|
|
370126
|
+
logger12.warn("Failed to list workspace files:", error42);
|
|
369833
370127
|
return { files: [], isTruncated: false };
|
|
369834
370128
|
}
|
|
369835
370129
|
}
|
|
369836
370130
|
// ../common/src/tool-utils/glob-files.ts
|
|
369837
370131
|
import * as path7 from "node:path";
|
|
369838
|
-
var
|
|
370132
|
+
var logger13 = getLogger("globFiles");
|
|
369839
370133
|
async function globFiles2(options4) {
|
|
369840
370134
|
const { cwd, path: searchPath, globPattern, abortSignal } = options4;
|
|
369841
|
-
|
|
370135
|
+
logger13.debug("handling globFiles with searchPath:", searchPath, "and pattern", globPattern);
|
|
369842
370136
|
const dir2 = resolvePath(searchPath, cwd);
|
|
369843
370137
|
if (!path7.isAbsolute(searchPath)) {
|
|
369844
370138
|
validateRelativePath(searchPath);
|
|
@@ -369864,8 +370158,8 @@ async function globFiles2(options4) {
|
|
|
369864
370158
|
const errorMessage = error42 instanceof Error ? error42.message : String(error42);
|
|
369865
370159
|
throw new Error(`Failed to glob files: ${errorMessage}`);
|
|
369866
370160
|
}
|
|
369867
|
-
|
|
369868
|
-
|
|
370161
|
+
logger13.debug(`Found ${files.length} files matching pattern ${globPattern}`);
|
|
370162
|
+
logger13.trace("Files found in globFiles:", files);
|
|
369869
370163
|
return { files, isTruncated };
|
|
369870
370164
|
}
|
|
369871
370165
|
// ../common/src/tool-utils/system-info.ts
|
|
@@ -369961,7 +370255,7 @@ function parseGitOriginUrl(originUrl) {
|
|
|
369961
370255
|
}
|
|
369962
370256
|
|
|
369963
370257
|
// ../common/src/tool-utils/git-status.ts
|
|
369964
|
-
var
|
|
370258
|
+
var logger14 = getLogger("GitStatus");
|
|
369965
370259
|
|
|
369966
370260
|
class GitStatusReader {
|
|
369967
370261
|
execPromise = promisify2(exec3);
|
|
@@ -370068,16 +370362,16 @@ class GitStatusReader {
|
|
|
370068
370362
|
}
|
|
370069
370363
|
async readGitStatus() {
|
|
370070
370364
|
if (!this.cwd) {
|
|
370071
|
-
|
|
370365
|
+
logger14.warn("No Git repository path specified");
|
|
370072
370366
|
return;
|
|
370073
370367
|
}
|
|
370074
370368
|
try {
|
|
370075
|
-
|
|
370369
|
+
logger14.trace("Reading Git status for repository", {
|
|
370076
370370
|
path: this.cwd
|
|
370077
370371
|
});
|
|
370078
370372
|
return await this.readGitStatusImpl();
|
|
370079
370373
|
} catch (error42) {
|
|
370080
|
-
|
|
370374
|
+
logger14.error("Error reading Git status", error42);
|
|
370081
370375
|
return;
|
|
370082
370376
|
}
|
|
370083
370377
|
}
|
|
@@ -370223,7 +370517,7 @@ function all15(values9, includeImageAlt, includeHtml) {
|
|
|
370223
370517
|
function node(value9) {
|
|
370224
370518
|
return Boolean(value9 && typeof value9 === "object");
|
|
370225
370519
|
}
|
|
370226
|
-
// ../../node_modules/
|
|
370520
|
+
// ../../node_modules/character-entities/index.js
|
|
370227
370521
|
var characterEntities = {
|
|
370228
370522
|
AElig: "Æ",
|
|
370229
370523
|
AMP: "&",
|
|
@@ -379803,7 +380097,7 @@ async function parseWorkflowFrontmatter(content3) {
|
|
|
379803
380097
|
};
|
|
379804
380098
|
}
|
|
379805
380099
|
// src/lib/load-agents.ts
|
|
379806
|
-
var
|
|
380100
|
+
var logger15 = getLogger("loadAgents");
|
|
379807
380101
|
async function readAgentsFromDir(dir2) {
|
|
379808
380102
|
const agents = [];
|
|
379809
380103
|
try {
|
|
@@ -379820,30 +380114,32 @@ async function readAgentsFromDir(dir2) {
|
|
|
379820
380114
|
}
|
|
379821
380115
|
}
|
|
379822
380116
|
} catch (error42) {
|
|
379823
|
-
|
|
380117
|
+
logger15.debug(`Could not read agents from directory ${dir2}:`, error42);
|
|
379824
380118
|
}
|
|
379825
380119
|
return agents;
|
|
379826
380120
|
}
|
|
379827
|
-
async function loadAgents(workingDirectory2) {
|
|
380121
|
+
async function loadAgents(workingDirectory2, includeSystemAgents = true) {
|
|
379828
380122
|
try {
|
|
379829
380123
|
const allAgents = [];
|
|
379830
380124
|
if (workingDirectory2) {
|
|
379831
380125
|
const projectAgentsDir = path10.join(workingDirectory2, ".pochi", "agents");
|
|
379832
380126
|
allAgents.push(...await readAgentsFromDir(projectAgentsDir));
|
|
379833
380127
|
}
|
|
379834
|
-
|
|
379835
|
-
|
|
380128
|
+
if (includeSystemAgents) {
|
|
380129
|
+
const systemAgentsDir = path10.join(os6.homedir(), ".pochi", "agents");
|
|
380130
|
+
allAgents.push(...await readAgentsFromDir(systemAgentsDir));
|
|
380131
|
+
}
|
|
379836
380132
|
const validAgents = allAgents.filter((agent) => {
|
|
379837
380133
|
if (isValidCustomAgentFile(agent)) {
|
|
379838
380134
|
return true;
|
|
379839
380135
|
}
|
|
379840
|
-
|
|
380136
|
+
logger15.warn(`Ignoring invalid custom agent file ${agent.filePath}: [${agent.error}] ${agent.message}`);
|
|
379841
380137
|
return false;
|
|
379842
380138
|
});
|
|
379843
|
-
|
|
380139
|
+
logger15.debug(`Loaded ${allAgents.length} custom agents (${validAgents.length} valid, ${allAgents.length - validAgents.length} invalid)`);
|
|
379844
380140
|
return validAgents;
|
|
379845
380141
|
} catch (error42) {
|
|
379846
|
-
|
|
380142
|
+
logger15.error("Failed to load custom agents", error42);
|
|
379847
380143
|
return [];
|
|
379848
380144
|
}
|
|
379849
380145
|
}
|
|
@@ -384475,10 +384771,10 @@ function isElectron() {
|
|
|
384475
384771
|
}
|
|
384476
384772
|
|
|
384477
384773
|
// ../../node_modules/pkce-challenge/dist/index.node.js
|
|
384478
|
-
var
|
|
384479
|
-
|
|
384774
|
+
var crypto6;
|
|
384775
|
+
crypto6 = globalThis.crypto?.webcrypto ?? globalThis.crypto ?? import("node:crypto").then((m) => m.webcrypto);
|
|
384480
384776
|
async function getRandomValues(size28) {
|
|
384481
|
-
return (await
|
|
384777
|
+
return (await crypto6).getRandomValues(new Uint8Array(size28));
|
|
384482
384778
|
}
|
|
384483
384779
|
async function random4(size28) {
|
|
384484
384780
|
const mask = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
|
|
@@ -384494,7 +384790,7 @@ async function generateVerifier(length5) {
|
|
|
384494
384790
|
return await random4(length5);
|
|
384495
384791
|
}
|
|
384496
384792
|
async function generateChallenge(code_verifier) {
|
|
384497
|
-
const buffer4 = await (await
|
|
384793
|
+
const buffer4 = await (await crypto6).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
384498
384794
|
return btoa(String.fromCharCode(...new Uint8Array(buffer4))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
384499
384795
|
}
|
|
384500
384796
|
async function pkceChallenge(length5) {
|
|
@@ -385515,7 +385811,7 @@ class McpConnection {
|
|
|
385515
385811
|
}
|
|
385516
385812
|
|
|
385517
385813
|
// ../common/src/mcp-utils/mcp-hub.ts
|
|
385518
|
-
var
|
|
385814
|
+
var logger16 = getLogger("MCPHub");
|
|
385519
385815
|
|
|
385520
385816
|
class McpHub {
|
|
385521
385817
|
listeners = [];
|
|
@@ -385537,7 +385833,7 @@ class McpHub {
|
|
|
385537
385833
|
if (connection) {
|
|
385538
385834
|
connection.restart();
|
|
385539
385835
|
} else {
|
|
385540
|
-
|
|
385836
|
+
logger16.debug(`Tried to restart non-existing connection: ${name17}`);
|
|
385541
385837
|
}
|
|
385542
385838
|
}
|
|
385543
385839
|
start(name17) {
|
|
@@ -385548,7 +385844,7 @@ class McpHub {
|
|
|
385548
385844
|
};
|
|
385549
385845
|
this.saveConfig(newConfig);
|
|
385550
385846
|
} else {
|
|
385551
|
-
|
|
385847
|
+
logger16.debug(`Tried to start non-existing server: ${name17}`);
|
|
385552
385848
|
}
|
|
385553
385849
|
}
|
|
385554
385850
|
stop(name17) {
|
|
@@ -385559,7 +385855,7 @@ class McpHub {
|
|
|
385559
385855
|
};
|
|
385560
385856
|
this.saveConfig(newConfig);
|
|
385561
385857
|
} else {
|
|
385562
|
-
|
|
385858
|
+
logger16.debug(`Tried to stop non-existing server: ${name17}`);
|
|
385563
385859
|
}
|
|
385564
385860
|
}
|
|
385565
385861
|
async addServer(name17, serverConfig) {
|
|
@@ -385590,7 +385886,7 @@ class McpHub {
|
|
|
385590
385886
|
const { effectiveTargets } = inspect(`mcp.${name17}`);
|
|
385591
385887
|
const editTarget = effectiveTargets[0] || "user";
|
|
385592
385888
|
await updateConfig({ mcp: { [name17]: config4 } }, editTarget).catch((error42) => {
|
|
385593
|
-
|
|
385889
|
+
logger16.error("Failed to persist MCP configuration changes", error42);
|
|
385594
385890
|
});
|
|
385595
385891
|
}
|
|
385596
385892
|
}
|
|
@@ -385615,7 +385911,7 @@ class McpHub {
|
|
|
385615
385911
|
toggleToolEnabled(serverName, toolName) {
|
|
385616
385912
|
const serverConfig = this.config.value[serverName];
|
|
385617
385913
|
if (!serverConfig) {
|
|
385618
|
-
|
|
385914
|
+
logger16.debug(`Server ${serverName} not found`);
|
|
385619
385915
|
return;
|
|
385620
385916
|
}
|
|
385621
385917
|
const disabledTools = serverConfig.disabledTools ?? [];
|
|
@@ -385641,7 +385937,7 @@ class McpHub {
|
|
|
385641
385937
|
return serverName;
|
|
385642
385938
|
}
|
|
385643
385939
|
init() {
|
|
385644
|
-
|
|
385940
|
+
logger16.trace("Initializing MCP Hub with config:", this.config.value);
|
|
385645
385941
|
o(() => {
|
|
385646
385942
|
for (const [name17, config4] of Object.entries(this.config.value)) {
|
|
385647
385943
|
this.createConnection(name17, config4);
|
|
@@ -385649,13 +385945,13 @@ class McpHub {
|
|
|
385649
385945
|
});
|
|
385650
385946
|
this.listeners.push({
|
|
385651
385947
|
dispose: this.config.subscribe(() => {
|
|
385652
|
-
|
|
385948
|
+
logger16.debug("MCP servers configuration changed via signal:");
|
|
385653
385949
|
this.onConfigChanged();
|
|
385654
385950
|
})
|
|
385655
385951
|
});
|
|
385656
385952
|
}
|
|
385657
385953
|
buildStatus() {
|
|
385658
|
-
|
|
385954
|
+
logger16.debug("Build MCPHub Status");
|
|
385659
385955
|
const connections = {};
|
|
385660
385956
|
for (const [vendorId, tools] of Object.entries(this.vendorTools.value)) {
|
|
385661
385957
|
connections[vendorId] = {
|
|
@@ -385692,7 +385988,7 @@ ${instructions2}`).join(`
|
|
|
385692
385988
|
};
|
|
385693
385989
|
}
|
|
385694
385990
|
onConnectionStatusChanged = () => {
|
|
385695
|
-
|
|
385991
|
+
logger16.debug("Connection status changed.");
|
|
385696
385992
|
this.connections.value = {
|
|
385697
385993
|
...this.connections.value
|
|
385698
385994
|
};
|
|
@@ -385703,12 +385999,12 @@ ${instructions2}`).join(`
|
|
|
385703
385999
|
...this.connections.value,
|
|
385704
386000
|
[name17]: connection
|
|
385705
386001
|
};
|
|
385706
|
-
|
|
386002
|
+
logger16.debug(`Connection ${name17} created.`);
|
|
385707
386003
|
}
|
|
385708
386004
|
updateConnection(name17, config4) {
|
|
385709
386005
|
const connection = this.connections.value[name17];
|
|
385710
386006
|
if (connection) {
|
|
385711
|
-
|
|
386007
|
+
logger16.debug(`Updating ${name17} with new config.`);
|
|
385712
386008
|
connection.updateConfig(config4);
|
|
385713
386009
|
}
|
|
385714
386010
|
}
|
|
@@ -385717,7 +386013,7 @@ ${instructions2}`).join(`
|
|
|
385717
386013
|
if (connection) {
|
|
385718
386014
|
connection.dispose();
|
|
385719
386015
|
this.connections.value = y2(this.connections.value, [name17]);
|
|
385720
|
-
|
|
386016
|
+
logger16.debug(`Connection ${name17} removed.`);
|
|
385721
386017
|
}
|
|
385722
386018
|
}
|
|
385723
386019
|
dispose() {
|
|
@@ -385732,7 +386028,7 @@ ${instructions2}`).join(`
|
|
|
385732
386028
|
}
|
|
385733
386029
|
}
|
|
385734
386030
|
// src/lib/mcp-hub-factory.ts
|
|
385735
|
-
var
|
|
386031
|
+
var logger17 = getLogger("McpHubFactory");
|
|
385736
386032
|
async function createCliMcpHub() {
|
|
385737
386033
|
const config4 = w(() => config2.value.mcp || {});
|
|
385738
386034
|
const vendorTools = d(await fetchTools());
|
|
@@ -385754,7 +386050,7 @@ async function fetchTools() {
|
|
|
385754
386050
|
toolsets[vendorId] = tools;
|
|
385755
386051
|
}
|
|
385756
386052
|
} catch (e2) {
|
|
385757
|
-
|
|
386053
|
+
logger17.error(`Failed to fetch models for vendor ${vendorId}:`, e2);
|
|
385758
386054
|
}
|
|
385759
386055
|
}
|
|
385760
386056
|
}
|
|
@@ -397690,7 +397986,7 @@ function stringify5(values10, options6) {
|
|
|
397690
397986
|
return input2.join((settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")).trim();
|
|
397691
397987
|
}
|
|
397692
397988
|
|
|
397693
|
-
// ../../node_modules/hast-util-
|
|
397989
|
+
// ../../node_modules/hast-util-parse-selector/lib/index.js
|
|
397694
397990
|
var search2 = /[#.]/g;
|
|
397695
397991
|
function parseSelector(selector, defaultTagName) {
|
|
397696
397992
|
const value10 = selector || "";
|
|
@@ -397735,7 +398031,7 @@ function stringify6(values10) {
|
|
|
397735
398031
|
return values10.join(" ").trim();
|
|
397736
398032
|
}
|
|
397737
398033
|
|
|
397738
|
-
// ../../node_modules/
|
|
398034
|
+
// ../../node_modules/hastscript/lib/create-h.js
|
|
397739
398035
|
function createH(schema7, defaultTagName, caseSensitive) {
|
|
397740
398036
|
const adjust = caseSensitive ? createAdjustMap(caseSensitive) : undefined;
|
|
397741
398037
|
function h11(selector, properties, ...children3) {
|
|
@@ -397875,7 +398171,7 @@ function createAdjustMap(values10) {
|
|
|
397875
398171
|
return result2;
|
|
397876
398172
|
}
|
|
397877
398173
|
|
|
397878
|
-
// ../../node_modules/
|
|
398174
|
+
// ../../node_modules/hastscript/lib/svg-case-sensitive-tag-names.js
|
|
397879
398175
|
var svgCaseSensitiveTagNames = [
|
|
397880
398176
|
"altGlyph",
|
|
397881
398177
|
"altGlyphDef",
|
|
@@ -397918,7 +398214,7 @@ var svgCaseSensitiveTagNames = [
|
|
|
397918
398214
|
"textPath"
|
|
397919
398215
|
];
|
|
397920
398216
|
|
|
397921
|
-
// ../../node_modules/
|
|
398217
|
+
// ../../node_modules/hastscript/lib/index.js
|
|
397922
398218
|
var h11 = createH(html5, "div");
|
|
397923
398219
|
var s13 = createH(svg2, "g", svgCaseSensitiveTagNames);
|
|
397924
398220
|
// ../../node_modules/vfile-location/lib/index.js
|
|
@@ -406089,7 +406385,7 @@ function toDecimal(code3, next6, omit9) {
|
|
|
406089
406385
|
return omit9 && next6 && !decimalRegex.test(String.fromCharCode(next6)) ? value10 : value10 + ";";
|
|
406090
406386
|
}
|
|
406091
406387
|
|
|
406092
|
-
// ../../node_modules/
|
|
406388
|
+
// ../../node_modules/character-entities-legacy/index.js
|
|
406093
406389
|
var characterEntitiesLegacy = [
|
|
406094
406390
|
"AElig",
|
|
406095
406391
|
"AMP",
|
|
@@ -409467,12 +409763,12 @@ function toTaskError(error46) {
|
|
|
409467
409763
|
}
|
|
409468
409764
|
|
|
409469
409765
|
// ../livekit/src/chat/llm/generate-task-title.ts
|
|
409470
|
-
var
|
|
409766
|
+
var logger18 = getLogger("generateTaskTitle");
|
|
409471
409767
|
async function generateTaskTitle(options6) {
|
|
409472
409768
|
const { title } = options6;
|
|
409473
409769
|
const newTitle = await generateTaskTitleImpl(options6);
|
|
409474
409770
|
if (newTitle !== undefined) {
|
|
409475
|
-
|
|
409771
|
+
logger18.debug(`Generating task title, old: ${title}, new: ${newTitle}`);
|
|
409476
409772
|
}
|
|
409477
409773
|
return newTitle;
|
|
409478
409774
|
}
|
|
@@ -409499,7 +409795,7 @@ async function generateTaskTitleImpl({
|
|
|
409499
409795
|
return title2;
|
|
409500
409796
|
}
|
|
409501
409797
|
} catch (err2) {
|
|
409502
|
-
|
|
409798
|
+
logger18.warn("Failed to generate title", err2);
|
|
409503
409799
|
}
|
|
409504
409800
|
}
|
|
409505
409801
|
if (title === null) {
|
|
@@ -409545,7 +409841,7 @@ async function generateTitle2(model2, inputMessages, abortSignal) {
|
|
|
409545
409841
|
}
|
|
409546
409842
|
|
|
409547
409843
|
// ../livekit/src/chat/background-job/manager.ts
|
|
409548
|
-
var
|
|
409844
|
+
var logger19 = getLogger("BackgroundJobManager");
|
|
409549
409845
|
|
|
409550
409846
|
class BackgroundJobManager {
|
|
409551
409847
|
jobs = Promise.resolve();
|
|
@@ -409559,7 +409855,7 @@ class BackgroundJobManager {
|
|
|
409559
409855
|
}
|
|
409560
409856
|
this.pendingJobs.delete(nextJob.id);
|
|
409561
409857
|
return nextJob.process().catch((error46) => {
|
|
409562
|
-
|
|
409858
|
+
logger19.error(`Failed to process job for task ${nextJob.id}`, error46);
|
|
409563
409859
|
});
|
|
409564
409860
|
});
|
|
409565
409861
|
job.waitUntil?.(this.jobs);
|
|
@@ -409568,7 +409864,7 @@ class BackgroundJobManager {
|
|
|
409568
409864
|
var backgroundJobManager = new BackgroundJobManager;
|
|
409569
409865
|
|
|
409570
409866
|
// ../livekit/src/chat/background-job/generate-title.ts
|
|
409571
|
-
var
|
|
409867
|
+
var logger20 = getLogger("GenerateTitleManager");
|
|
409572
409868
|
function scheduleGenerateTitleJob(job) {
|
|
409573
409869
|
backgroundJobManager.push({
|
|
409574
409870
|
id: `generate-title-${job.taskId}`,
|
|
@@ -409584,7 +409880,7 @@ async function process16({
|
|
|
409584
409880
|
}) {
|
|
409585
409881
|
const task = store.query(makeTaskQuery(taskId));
|
|
409586
409882
|
if (!task) {
|
|
409587
|
-
|
|
409883
|
+
logger20.warn(`Task not found for title generation: ${taskId}`);
|
|
409588
409884
|
return;
|
|
409589
409885
|
}
|
|
409590
409886
|
const newTitle = await generateTaskTitle({
|
|
@@ -409601,7 +409897,7 @@ async function process16({
|
|
|
409601
409897
|
}
|
|
409602
409898
|
}
|
|
409603
409899
|
// ../livekit/src/chat/llm/repair-tool-call.ts
|
|
409604
|
-
var
|
|
409900
|
+
var logger21 = getLogger("RepairToolCall");
|
|
409605
409901
|
var makeRepairToolCall = (model2) => async ({ toolCall, inputSchema, error: error46 }) => {
|
|
409606
409902
|
if (NoSuchToolError.isInstance(error46)) {
|
|
409607
409903
|
return null;
|
|
@@ -409645,11 +409941,11 @@ var makeRepairToolCall = (model2) => async ({ toolCall, inputSchema, error: erro
|
|
|
409645
409941
|
maxRetries: 0
|
|
409646
409942
|
});
|
|
409647
409943
|
const input2 = await result2.text;
|
|
409648
|
-
|
|
409944
|
+
logger21.debug("Repairing tool call:", toolCall.toolName, input2);
|
|
409649
409945
|
return { ...toolCall, input: input2 };
|
|
409650
409946
|
};
|
|
409651
409947
|
// ../livekit/src/chat/llm/compact-task.ts
|
|
409652
|
-
var
|
|
409948
|
+
var logger22 = getLogger("compactTask");
|
|
409653
409949
|
async function compactTask({
|
|
409654
409950
|
model: model2,
|
|
409655
409951
|
messages: messages2,
|
|
@@ -409671,7 +409967,7 @@ async function compactTask({
|
|
|
409671
409967
|
}
|
|
409672
409968
|
return text20;
|
|
409673
409969
|
} catch (err2) {
|
|
409674
|
-
|
|
409970
|
+
logger22.warn("Failed to create summary", err2);
|
|
409675
409971
|
}
|
|
409676
409972
|
}
|
|
409677
409973
|
async function createSummary(model2, abortSignal, inputMessages) {
|
|
@@ -409736,8 +410032,10 @@ var contentOutputFn = (output2) => {
|
|
|
409736
410032
|
};
|
|
409737
410033
|
};
|
|
409738
410034
|
var toModelOutputFn = {
|
|
410035
|
+
take_screenshot: contentOutputFn,
|
|
409739
410036
|
browser_take_screenshot: contentOutputFn,
|
|
409740
|
-
webFetch: contentOutputFn
|
|
410037
|
+
webFetch: contentOutputFn,
|
|
410038
|
+
webSearch: contentOutputFn
|
|
409741
410039
|
};
|
|
409742
410040
|
|
|
409743
410041
|
// ../livekit/src/chat/middlewares/utils.ts
|
|
@@ -410497,7 +410795,7 @@ function createGoogleVertexTuningModel(llm) {
|
|
|
410497
410795
|
}
|
|
410498
410796
|
|
|
410499
410797
|
// ../livekit/src/chat/models/openai.ts
|
|
410500
|
-
var
|
|
410798
|
+
var logger23 = getLogger("openai");
|
|
410501
410799
|
var OpenAIRequestParamsSchema = exports_external.object({
|
|
410502
410800
|
max_tokens: exports_external.number().positive().optional(),
|
|
410503
410801
|
max_completion_tokens: exports_external.number().positive().optional()
|
|
@@ -410547,7 +410845,7 @@ function overrideMaxOutputToken(body3) {
|
|
|
410547
410845
|
const json10 = JSON.parse(body3);
|
|
410548
410846
|
const result2 = OpenAIRequestParamsSchema.safeParse(json10);
|
|
410549
410847
|
if (!result2.success) {
|
|
410550
|
-
|
|
410848
|
+
logger23.error("OpenAI request body validation failed:", result2.error);
|
|
410551
410849
|
return;
|
|
410552
410850
|
}
|
|
410553
410851
|
const parsed = result2.data;
|
|
@@ -410556,7 +410854,7 @@ function overrideMaxOutputToken(body3) {
|
|
|
410556
410854
|
}
|
|
410557
410855
|
return JSON.stringify(parsed);
|
|
410558
410856
|
} catch (error46) {
|
|
410559
|
-
|
|
410857
|
+
logger23.error("Failed to parse OpenAI request body:", error46);
|
|
410560
410858
|
}
|
|
410561
410859
|
return;
|
|
410562
410860
|
}
|
|
@@ -410737,7 +411035,7 @@ function estimateTotalTokens(messages2) {
|
|
|
410737
411035
|
}
|
|
410738
411036
|
|
|
410739
411037
|
// ../livekit/src/chat/live-chat-kit.ts
|
|
410740
|
-
var
|
|
411038
|
+
var logger24 = getLogger("LiveChatKit");
|
|
410741
411039
|
|
|
410742
411040
|
class LiveChatKit {
|
|
410743
411041
|
taskId;
|
|
@@ -410793,7 +411091,7 @@ class LiveChatKit {
|
|
|
410793
411091
|
inline: true
|
|
410794
411092
|
});
|
|
410795
411093
|
} catch (err2) {
|
|
410796
|
-
|
|
411094
|
+
logger24.error("Failed to compact task", err2);
|
|
410797
411095
|
throw err2;
|
|
410798
411096
|
}
|
|
410799
411097
|
}
|
|
@@ -410923,7 +411221,7 @@ class LiveChatKit {
|
|
|
410923
411221
|
}));
|
|
410924
411222
|
};
|
|
410925
411223
|
onError = (error46) => {
|
|
410926
|
-
|
|
411224
|
+
logger24.error("onError", error46);
|
|
410927
411225
|
const lastMessage = this.chat.messages.at(-1) || null;
|
|
410928
411226
|
this.store.commit(events.chatStreamFailed({
|
|
410929
411227
|
id: this.taskId,
|
|
@@ -411076,7 +411374,7 @@ import * as nodePath from "node:path";
|
|
|
411076
411374
|
|
|
411077
411375
|
// ../common/src/diff-utils.ts
|
|
411078
411376
|
var import_fast_levenshtein = __toESM(require_levenshtein(), 1);
|
|
411079
|
-
var
|
|
411377
|
+
var logger25 = getLogger("diffUtils");
|
|
411080
411378
|
function normalize6(content3) {
|
|
411081
411379
|
return content3.replace(/\r\n/g, `
|
|
411082
411380
|
`).trimEnd();
|
|
@@ -411089,7 +411387,7 @@ class DiffError extends Error {
|
|
|
411089
411387
|
}
|
|
411090
411388
|
}
|
|
411091
411389
|
async function parseDiffAndApply(fileContent3, searchContent, replaceContent, expectedReplacements = 1) {
|
|
411092
|
-
|
|
411390
|
+
logger25.trace(`Applying diff with expectedReplacements: ${expectedReplacements}`);
|
|
411093
411391
|
const isCRLF = fileContent3.includes(`\r
|
|
411094
411392
|
`);
|
|
411095
411393
|
const normalizedFileContent = normalize6(fileContent3);
|
|
@@ -411106,11 +411404,11 @@ async function parseDiffAndApply(fileContent3, searchContent, replaceContent, ex
|
|
|
411106
411404
|
const matches2 = searchContentExact(normalizedFileContent, normalizedSearchContent);
|
|
411107
411405
|
if (matches2.length < expectedReplacements) {
|
|
411108
411406
|
matches2.push(...searchContentWithLineTrimmed(normalizedFileContent, normalizedSearchContent));
|
|
411109
|
-
|
|
411407
|
+
logger25.trace(`Found ${matches2.length} matches after line trimming search strategy`);
|
|
411110
411408
|
}
|
|
411111
411409
|
if (matches2.length < expectedReplacements) {
|
|
411112
411410
|
matches2.push(...searchContentByBlockAnchor(normalizedFileContent, normalizedSearchContent));
|
|
411113
|
-
|
|
411411
|
+
logger25.trace(`Found ${matches2.length} matches after block anchor search strategy`);
|
|
411114
411412
|
}
|
|
411115
411413
|
if (matches2.length === 0) {
|
|
411116
411414
|
throw new DiffError("Search content does not match the file content. Try to reread the file for the latest content.");
|
|
@@ -411119,7 +411417,7 @@ async function parseDiffAndApply(fileContent3, searchContent, replaceContent, ex
|
|
|
411119
411417
|
throw new DiffError(`Expected ${expectedReplacements} occurrences but found ${matches2.length}. Please verify the search content and expectedReplacements parameter.`);
|
|
411120
411418
|
}
|
|
411121
411419
|
const result2 = replaceMatches(normalizedFileContent, matches2, replaceContent);
|
|
411122
|
-
|
|
411420
|
+
logger25.trace("Successfully applied diff");
|
|
411123
411421
|
if (isCRLF) {
|
|
411124
411422
|
return result2.replace(/\n/g, `\r
|
|
411125
411423
|
`);
|
|
@@ -411473,11 +411771,11 @@ var readFile13 = (context15) => async ({ path: path27, startLine, endLine }) =>
|
|
|
411473
411771
|
|
|
411474
411772
|
// src/tools/search-files.ts
|
|
411475
411773
|
import * as fs14 from "node:fs";
|
|
411476
|
-
var
|
|
411774
|
+
var logger26 = getLogger("searchFiles");
|
|
411477
411775
|
var searchFiles2 = (context15) => async ({ path: path27, regex: regex3, filePattern }, { abortSignal }) => {
|
|
411478
411776
|
const rgPath = context15.rg;
|
|
411479
411777
|
if (!rgPath || !fs14.existsSync(rgPath)) {
|
|
411480
|
-
|
|
411778
|
+
logger26.error("Ripgrep not found at path", rgPath);
|
|
411481
411779
|
throw new Error(`Ripgrep not found at path: ${rgPath}`);
|
|
411482
411780
|
}
|
|
411483
411781
|
return await searchFilesWithRipgrep(path27, regex3, rgPath, context15.cwd, filePattern, abortSignal);
|
|
@@ -411554,7 +411852,7 @@ async function executeToolCall(tool4, options6, abortSignal) {
|
|
|
411554
411852
|
}
|
|
411555
411853
|
|
|
411556
411854
|
// src/task-runner.ts
|
|
411557
|
-
var
|
|
411855
|
+
var logger27 = getLogger("TaskRunner");
|
|
411558
411856
|
|
|
411559
411857
|
class TaskRunner {
|
|
411560
411858
|
toolCallOptions;
|
|
@@ -411629,9 +411927,9 @@ class TaskRunner {
|
|
|
411629
411927
|
return this.chatKit.task?.shareId;
|
|
411630
411928
|
}
|
|
411631
411929
|
async run() {
|
|
411632
|
-
|
|
411930
|
+
logger27.debug("Starting TaskRunner...");
|
|
411633
411931
|
try {
|
|
411634
|
-
|
|
411932
|
+
logger27.trace("Start step loop.");
|
|
411635
411933
|
this.stepCount.reset();
|
|
411636
411934
|
while (true) {
|
|
411637
411935
|
const stepResult = await this.step();
|
|
@@ -411646,7 +411944,7 @@ class TaskRunner {
|
|
|
411646
411944
|
}
|
|
411647
411945
|
} catch (e11) {
|
|
411648
411946
|
const error46 = toError2(e11);
|
|
411649
|
-
|
|
411947
|
+
logger27.trace("Failed:", error46);
|
|
411650
411948
|
}
|
|
411651
411949
|
}
|
|
411652
411950
|
async step() {
|
|
@@ -411684,24 +411982,24 @@ class TaskRunner {
|
|
|
411684
411982
|
throw new Error("Task is not loaded");
|
|
411685
411983
|
}
|
|
411686
411984
|
if ((task.status === "completed" || task.status === "pending-input") && isResultMessage(message)) {
|
|
411687
|
-
|
|
411985
|
+
logger27.trace("Task is completed or pending input, no more steps to process.");
|
|
411688
411986
|
return "finished";
|
|
411689
411987
|
}
|
|
411690
411988
|
if (task.status === "failed") {
|
|
411691
411989
|
if (task.error?.kind === "APICallError" && !task.error.isRetryable) {
|
|
411692
411990
|
return "finished";
|
|
411693
411991
|
}
|
|
411694
|
-
|
|
411992
|
+
logger27.error("Task is failed, trying to resend last message to resume it.", task.error);
|
|
411695
411993
|
return "retry";
|
|
411696
411994
|
}
|
|
411697
411995
|
if (message.role !== "assistant") {
|
|
411698
|
-
|
|
411996
|
+
logger27.trace("Last message is not a assistant message, resending it to resume the task.");
|
|
411699
411997
|
return "retry";
|
|
411700
411998
|
}
|
|
411701
411999
|
if (isAssistantMessageWithEmptyParts(message) || isAssistantMessageWithPartialToolCalls(message) || isAssistantMessageWithOutputError(message) || lastAssistantMessageIsCompleteWithToolCalls({
|
|
411702
412000
|
messages: this.chat.messages
|
|
411703
412001
|
})) {
|
|
411704
|
-
|
|
412002
|
+
logger27.trace("Last message is assistant with empty parts or partial/completed tool calls, resending it to resume the task.");
|
|
411705
412003
|
const processed = prepareLastMessageForRetry(message);
|
|
411706
412004
|
if (processed) {
|
|
411707
412005
|
this.chat.appendOrReplaceMessage(processed);
|
|
@@ -411709,28 +412007,28 @@ class TaskRunner {
|
|
|
411709
412007
|
return "retry";
|
|
411710
412008
|
}
|
|
411711
412009
|
if (isAssistantMessageWithNoToolCalls(message)) {
|
|
411712
|
-
|
|
412010
|
+
logger27.trace("Last message is assistant with no tool calls, sending a new user reminder.");
|
|
411713
412011
|
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."));
|
|
411714
412012
|
this.chat.appendOrReplaceMessage(message2);
|
|
411715
412013
|
return "next";
|
|
411716
412014
|
}
|
|
411717
412015
|
}
|
|
411718
412016
|
async processToolCalls(message) {
|
|
411719
|
-
|
|
412017
|
+
logger27.trace("Processing tool calls in the last message.");
|
|
411720
412018
|
for (const toolCall of message.parts.filter(isToolUIPart)) {
|
|
411721
412019
|
if (toolCall.state !== "input-available")
|
|
411722
412020
|
continue;
|
|
411723
412021
|
const toolName = getToolName(toolCall);
|
|
411724
|
-
|
|
412022
|
+
logger27.trace(`Found tool call: ${toolName} with args: ${JSON.stringify(toolCall.input)}`);
|
|
411725
412023
|
const toolResult = await executeToolCall(toolCall, this.toolCallOptions);
|
|
411726
412024
|
this.chatKit.chat.addToolResult({
|
|
411727
412025
|
tool: toolName,
|
|
411728
412026
|
toolCallId: toolCall.toolCallId,
|
|
411729
412027
|
output: toolResult
|
|
411730
412028
|
});
|
|
411731
|
-
|
|
412029
|
+
logger27.trace(`Tool call result: ${JSON.stringify(toolResult)}`);
|
|
411732
412030
|
}
|
|
411733
|
-
|
|
412031
|
+
logger27.trace("All tool calls processed in the last message.");
|
|
411734
412032
|
return "next";
|
|
411735
412033
|
}
|
|
411736
412034
|
}
|
|
@@ -412027,8 +412325,8 @@ function registerUpgradeCommand(program5) {
|
|
|
412027
412325
|
});
|
|
412028
412326
|
}
|
|
412029
412327
|
// src/cli.ts
|
|
412030
|
-
var
|
|
412031
|
-
|
|
412328
|
+
var logger28 = getLogger("Pochi");
|
|
412329
|
+
logger28.debug(`pochi v${package_default.version}`);
|
|
412032
412330
|
var parsePositiveInt = (input2) => {
|
|
412033
412331
|
if (!input2) {
|
|
412034
412332
|
return program5.error("The value for this option must be a positive integer.");
|
|
@@ -412068,13 +412366,13 @@ var program5 = new Command().name("pochi").description(`${source_default.bold("P
|
|
|
412068
412366
|
});
|
|
412069
412367
|
const renderer = new OutputRenderer(runner.state);
|
|
412070
412368
|
await runner.run();
|
|
412369
|
+
renderer.shutdown();
|
|
412071
412370
|
const shareId = runner.shareId;
|
|
412072
412371
|
if (shareId) {
|
|
412073
412372
|
const shareUrl = source_default.underline(`https://app.getpochi.com/share/${shareId}`);
|
|
412074
412373
|
console.log(`
|
|
412075
412374
|
${source_default.bold("Task link: ")} ${shareUrl}`);
|
|
412076
412375
|
}
|
|
412077
|
-
renderer.shutdown();
|
|
412078
412376
|
mcpHub.dispose();
|
|
412079
412377
|
await waitForSync(store, "2 second").catch(console.error);
|
|
412080
412378
|
await store.shutdownPromise();
|