@getpochi/cli 0.5.24 → 0.5.26
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 +320 -276
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -30265,8 +30265,8 @@ var init_fiberRuntime = __esm(() => {
|
|
|
30265
30265
|
const clockService = get10(this.getFiberRef(currentServices), clockTag);
|
|
30266
30266
|
const date6 = new Date(clockService.unsafeCurrentTimeMillis());
|
|
30267
30267
|
withRedactableContext(contextMap, () => {
|
|
30268
|
-
for (const
|
|
30269
|
-
|
|
30268
|
+
for (const logger12 of loggers) {
|
|
30269
|
+
logger12.log({
|
|
30270
30270
|
fiberId: this.id(),
|
|
30271
30271
|
logLevel,
|
|
30272
30272
|
message,
|
|
@@ -35625,7 +35625,7 @@ var init_FiberRef = __esm(() => {
|
|
|
35625
35625
|
});
|
|
35626
35626
|
|
|
35627
35627
|
// ../../node_modules/effect/dist/esm/internal/layer/circular.js
|
|
35628
|
-
var minimumLogLevel = (level) => scopedDiscard(fiberRefLocallyScoped(currentMinimumLogLevel, level)), withMinimumLogLevel, addLogger = (
|
|
35628
|
+
var minimumLogLevel = (level) => scopedDiscard(fiberRefLocallyScoped(currentMinimumLogLevel, level)), withMinimumLogLevel, addLogger = (logger12) => scopedDiscard(fiberRefLocallyScopedWith(currentLoggers, add2(logger12))), addLoggerEffect = (effect) => unwrapEffect(map17(effect, addLogger)), addLoggerScoped = (effect) => unwrapScoped(map17(effect, addLogger)), removeLogger = (logger12) => scopedDiscard(fiberRefLocallyScopedWith(currentLoggers, remove6(logger12))), replaceLogger, replaceLoggerEffect, replaceLoggerScoped, setConfigProvider = (configProvider) => scopedDiscard(withConfigProviderScoped(configProvider)), parentSpan = (span2) => succeedContext(make11(spanTag, span2)), span2 = (name17, options) => {
|
|
35629
35629
|
options = addSpanStackTrace(options);
|
|
35630
35630
|
return scoped2(spanTag, options?.onEnd ? tap2(makeSpanScoped(name17, options), (span3) => addFinalizer((exit4) => options.onEnd(span3, exit4))) : makeSpanScoped(name17, options));
|
|
35631
35631
|
}, setTracer = (tracer3) => scopedDiscard(withTracerScoped(tracer3));
|
|
@@ -64716,7 +64716,7 @@ var init_httpApp = __esm(() => {
|
|
|
64716
64716
|
});
|
|
64717
64717
|
|
|
64718
64718
|
// ../../node_modules/@effect/platform/dist/esm/internal/httpMiddleware.js
|
|
64719
|
-
var make86 = (middleware) => middleware, loggerDisabled, withLoggerDisabled = (self2) => zipRight7(set10(loggerDisabled, true), self2), currentTracerDisabledWhen2, withTracerDisabledWhen2, withTracerDisabledWhenEffect, withTracerDisabledForUrls, SpanNameGenerator2, withSpanNameGenerator2,
|
|
64719
|
+
var make86 = (middleware) => middleware, loggerDisabled, withLoggerDisabled = (self2) => zipRight7(set10(loggerDisabled, true), self2), currentTracerDisabledWhen2, withTracerDisabledWhen2, withTracerDisabledWhenEffect, withTracerDisabledForUrls, SpanNameGenerator2, withSpanNameGenerator2, logger12, tracer3, xForwardedHeaders, searchParamsParser = (httpApp) => withFiberRuntime2((fiber) => {
|
|
64720
64720
|
const context10 = fiber.currentContext;
|
|
64721
64721
|
const request2 = unsafeGet5(context10, HttpServerRequest);
|
|
64722
64722
|
const params = searchParamsFromURL2(new URL(request2.originalUrl));
|
|
@@ -64831,7 +64831,7 @@ var init_httpMiddleware = __esm(() => {
|
|
|
64831
64831
|
defaultValue: () => (request2) => `http.server ${request2.method}`
|
|
64832
64832
|
});
|
|
64833
64833
|
withSpanNameGenerator2 = /* @__PURE__ */ dual(2, (self2, f2) => provide3(self2, succeed12(SpanNameGenerator2, f2)));
|
|
64834
|
-
|
|
64834
|
+
logger12 = /* @__PURE__ */ make86((httpApp) => {
|
|
64835
64835
|
let counter6 = 0;
|
|
64836
64836
|
return withFiberRuntime2((fiber) => {
|
|
64837
64837
|
const request2 = unsafeGet5(fiber.currentContext, HttpServerRequest);
|
|
@@ -65844,16 +65844,16 @@ __export(exports_HttpMiddleware, {
|
|
|
65844
65844
|
searchParamsParser: () => searchParamsParser2,
|
|
65845
65845
|
make: () => make89,
|
|
65846
65846
|
loggerDisabled: () => loggerDisabled2,
|
|
65847
|
-
logger: () =>
|
|
65847
|
+
logger: () => logger13,
|
|
65848
65848
|
currentTracerDisabledWhen: () => currentTracerDisabledWhen3,
|
|
65849
65849
|
cors: () => cors2,
|
|
65850
65850
|
SpanNameGenerator: () => SpanNameGenerator3
|
|
65851
65851
|
});
|
|
65852
|
-
var make89,
|
|
65852
|
+
var make89, logger13, loggerDisabled2, withLoggerDisabled2, currentTracerDisabledWhen3, withTracerDisabledWhen3, withTracerDisabledWhenEffect2, withTracerDisabledForUrls2, xForwardedHeaders2, searchParamsParser2, cors2, SpanNameGenerator3, withSpanNameGenerator3;
|
|
65853
65853
|
var init_HttpMiddleware = __esm(() => {
|
|
65854
65854
|
init_httpMiddleware();
|
|
65855
65855
|
make89 = make86;
|
|
65856
|
-
|
|
65856
|
+
logger13 = logger12;
|
|
65857
65857
|
loggerDisabled2 = loggerDisabled;
|
|
65858
65858
|
withLoggerDisabled2 = withLoggerDisabled;
|
|
65859
65859
|
currentTracerDisabledWhen3 = currentTracerDisabledWhen2;
|
|
@@ -180811,24 +180811,24 @@ function createLogger(level = "info", options4 = {}) {
|
|
|
180811
180811
|
}
|
|
180812
180812
|
}
|
|
180813
180813
|
const warnedMessages = /* @__PURE__ */ new Set;
|
|
180814
|
-
const
|
|
180814
|
+
const logger14 = {
|
|
180815
180815
|
hasWarned: false,
|
|
180816
180816
|
info(msg, opts) {
|
|
180817
180817
|
output2("info", msg, opts);
|
|
180818
180818
|
},
|
|
180819
180819
|
warn(msg, opts) {
|
|
180820
|
-
|
|
180820
|
+
logger14.hasWarned = true;
|
|
180821
180821
|
output2("warn", msg, opts);
|
|
180822
180822
|
},
|
|
180823
180823
|
warnOnce(msg, opts) {
|
|
180824
180824
|
if (warnedMessages.has(msg))
|
|
180825
180825
|
return;
|
|
180826
|
-
|
|
180826
|
+
logger14.hasWarned = true;
|
|
180827
180827
|
output2("warn", msg, opts);
|
|
180828
180828
|
warnedMessages.add(msg);
|
|
180829
180829
|
},
|
|
180830
180830
|
error(msg, opts) {
|
|
180831
|
-
|
|
180831
|
+
logger14.hasWarned = true;
|
|
180832
180832
|
output2("error", msg, opts);
|
|
180833
180833
|
},
|
|
180834
180834
|
clearScreen(type3) {
|
|
@@ -180839,7 +180839,7 @@ function createLogger(level = "info", options4 = {}) {
|
|
|
180839
180839
|
return loggedErrors.has(error42);
|
|
180840
180840
|
}
|
|
180841
180841
|
};
|
|
180842
|
-
return
|
|
180842
|
+
return logger14;
|
|
180843
180843
|
}
|
|
180844
180844
|
function printServerUrls(urls, optionsHost, info2) {
|
|
180845
180845
|
const colorUrl = (url3) => import_picocolors.default.cyan(url3.replace(/:(\d+)\//, (_7, port2) => `:${import_picocolors.default.bold(port2)}/`));
|
|
@@ -188456,8 +188456,8 @@ var SOURCEMAPPING_URL = "sourceMa", isWindows, windowsSlashRE, postfixRE, AsyncF
|
|
|
188456
188456
|
customListenersMap = /* @__PURE__ */ new Map;
|
|
188457
188457
|
ctxToListenersMap = /* @__PURE__ */ new Map;
|
|
188458
188458
|
currentFirstInvalidatedBy;
|
|
188459
|
-
constructor(
|
|
188460
|
-
this.logger =
|
|
188459
|
+
constructor(logger14, transport, importUpdatedModule) {
|
|
188460
|
+
this.logger = logger14, this.transport = transport, this.importUpdatedModule = importUpdatedModule;
|
|
188461
188461
|
}
|
|
188462
188462
|
async notifyListeners(event, data) {
|
|
188463
188463
|
let cbs = this.customListenersMap.get(event);
|
|
@@ -200985,11 +200985,11 @@ Did you specify these with the most recent transformation maps first?`);
|
|
|
200985
200985
|
}
|
|
200986
200986
|
if (flattenedConfigs.some(({ config: { options: { ignore: ignore7, only } } }) => shouldIgnore(context15, ignore7, only, dirname7)))
|
|
200987
200987
|
return null;
|
|
200988
|
-
const chain = emptyChain(),
|
|
200988
|
+
const chain = emptyChain(), logger14 = createLogger2(input2, context15, baseLogger);
|
|
200989
200989
|
for (const { config: config5, index: index3, envName } of flattenedConfigs) {
|
|
200990
200990
|
if (!(yield* mergeExtendsChain(chain, config5.options, dirname7, context15, files, baseLogger)))
|
|
200991
200991
|
return null;
|
|
200992
|
-
|
|
200992
|
+
logger14(config5, index3, envName), yield* mergeChainOpts(chain, config5);
|
|
200993
200993
|
}
|
|
200994
200994
|
return chain;
|
|
200995
200995
|
};
|
|
@@ -251396,13 +251396,13 @@ function getNamesFromAssets(consumedFiles) {
|
|
|
251396
251396
|
names.sort((a11, b10) => a11.length - b10.length || (a11 > b10 ? 1 : a11 === b10 ? 0 : -1));
|
|
251397
251397
|
return { names, originalFileNames };
|
|
251398
251398
|
}
|
|
251399
|
-
function getLogHandler(level, code2,
|
|
251399
|
+
function getLogHandler(level, code2, logger14, pluginName, logLevel2) {
|
|
251400
251400
|
if (logLevelPriority[level] < logLevelPriority[logLevel2]) {
|
|
251401
251401
|
return doNothing;
|
|
251402
251402
|
}
|
|
251403
251403
|
return (log7, pos) => {
|
|
251404
251404
|
if (pos != null) {
|
|
251405
|
-
|
|
251405
|
+
logger14(LOGLEVEL_WARN, logInvalidLogPosition(pluginName));
|
|
251406
251406
|
}
|
|
251407
251407
|
log7 = normalizeLog(log7);
|
|
251408
251408
|
if (log7.code && !log7.pluginCode) {
|
|
@@ -251410,7 +251410,7 @@ function getLogHandler(level, code2, logger13, pluginName, logLevel2) {
|
|
|
251410
251410
|
}
|
|
251411
251411
|
log7.code = code2;
|
|
251412
251412
|
log7.plugin = pluginName;
|
|
251413
|
-
|
|
251413
|
+
logger14(level, log7);
|
|
251414
251414
|
};
|
|
251415
251415
|
}
|
|
251416
251416
|
function getPluginContext(plugin, pluginCache, graph, options4, fileEmitter, existingPluginNames) {
|
|
@@ -252059,7 +252059,7 @@ async function initWasm() {}
|
|
|
252059
252059
|
function getLogger2(plugins, onLog, watchMode, logLevel2) {
|
|
252060
252060
|
plugins = getSortedValidatedPlugins("onLog", plugins);
|
|
252061
252061
|
const minimalPriority = logLevelPriority[logLevel2];
|
|
252062
|
-
const
|
|
252062
|
+
const logger14 = (level, log7, skipped = EMPTY_SET) => {
|
|
252063
252063
|
augmentLogMessage(log7);
|
|
252064
252064
|
const logPriority = logLevelPriority[level];
|
|
252065
252065
|
if (logPriority < minimalPriority) {
|
|
@@ -252073,7 +252073,7 @@ function getLogger2(plugins, onLog, watchMode, logLevel2) {
|
|
|
252073
252073
|
if (logLevelPriority[level2] < minimalPriority) {
|
|
252074
252074
|
return doNothing;
|
|
252075
252075
|
}
|
|
252076
|
-
return (log8) =>
|
|
252076
|
+
return (log8) => logger14(level2, normalizeLog(log8), new Set(skipped).add(plugin));
|
|
252077
252077
|
};
|
|
252078
252078
|
const handler2 = "handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog;
|
|
252079
252079
|
if (handler2.call({
|
|
@@ -252088,7 +252088,7 @@ function getLogger2(plugins, onLog, watchMode, logLevel2) {
|
|
|
252088
252088
|
}
|
|
252089
252089
|
onLog(level, log7);
|
|
252090
252090
|
};
|
|
252091
|
-
return
|
|
252091
|
+
return logger14;
|
|
252092
252092
|
}
|
|
252093
252093
|
async function normalizeInputOptions(config5, watchMode) {
|
|
252094
252094
|
const unsetOptions = new Set;
|
|
@@ -252293,16 +252293,16 @@ async function getInputOptions(initialInputOptions, watchMode) {
|
|
|
252293
252293
|
async function getProcessedInputOptions(inputOptions, watchMode) {
|
|
252294
252294
|
const plugins = getSortedValidatedPlugins("options", await normalizePluginOption(inputOptions.plugins));
|
|
252295
252295
|
const logLevel2 = inputOptions.logLevel || LOGLEVEL_INFO;
|
|
252296
|
-
const
|
|
252296
|
+
const logger14 = getLogger2(plugins, getOnLog(inputOptions, logLevel2), watchMode, logLevel2);
|
|
252297
252297
|
for (const plugin of plugins) {
|
|
252298
252298
|
const { name: name17, options: options4 } = plugin;
|
|
252299
252299
|
const handler2 = "handler" in options4 ? options4.handler : options4;
|
|
252300
252300
|
const processedOptions = await handler2.call({
|
|
252301
|
-
debug: getLogHandler(LOGLEVEL_DEBUG, "PLUGIN_LOG",
|
|
252301
|
+
debug: getLogHandler(LOGLEVEL_DEBUG, "PLUGIN_LOG", logger14, name17, logLevel2),
|
|
252302
252302
|
error: (error_) => error42(logPluginError(normalizeLog(error_), name17, { hook: "onLog" })),
|
|
252303
|
-
info: getLogHandler(LOGLEVEL_INFO, "PLUGIN_LOG",
|
|
252303
|
+
info: getLogHandler(LOGLEVEL_INFO, "PLUGIN_LOG", logger14, name17, logLevel2),
|
|
252304
252304
|
meta: { rollupVersion: version4, watchMode },
|
|
252305
|
-
warn: getLogHandler(LOGLEVEL_WARN, "PLUGIN_WARNING",
|
|
252305
|
+
warn: getLogHandler(LOGLEVEL_WARN, "PLUGIN_WARNING", logger14, name17, logLevel2)
|
|
252306
252306
|
}, inputOptions);
|
|
252307
252307
|
if (processedOptions) {
|
|
252308
252308
|
inputOptions = processedOptions;
|
|
@@ -280487,7 +280487,7 @@ async function computeSourceRoute(map$1, file5) {
|
|
|
280487
280487
|
} catch {}
|
|
280488
280488
|
return sourceRoot;
|
|
280489
280489
|
}
|
|
280490
|
-
async function injectSourcesContent(map$1, file5,
|
|
280490
|
+
async function injectSourcesContent(map$1, file5, logger14) {
|
|
280491
280491
|
let sourceRootPromise;
|
|
280492
280492
|
const missingSources = [];
|
|
280493
280493
|
const sourcesContent = map$1.sourcesContent || [];
|
|
@@ -280510,7 +280510,7 @@ async function injectSourcesContent(map$1, file5, logger13) {
|
|
|
280510
280510
|
await Promise.all(sourcesContentPromises);
|
|
280511
280511
|
map$1.sourcesContent = sourcesContent;
|
|
280512
280512
|
if (missingSources.length) {
|
|
280513
|
-
|
|
280513
|
+
logger14.warnOnce(`Sourcemap for "${file5}" points to missing source files`);
|
|
280514
280514
|
debug$16?.(`Missing sources:
|
|
280515
280515
|
` + missingSources.join(`
|
|
280516
280516
|
`));
|
|
@@ -280534,7 +280534,7 @@ function getCodeWithSourcemap(type3, code2, map$1) {
|
|
|
280534
280534
|
/*# sourceMappingURL=${genSourceMapUrl(map$1)} */`;
|
|
280535
280535
|
return code2;
|
|
280536
280536
|
}
|
|
280537
|
-
function applySourcemapIgnoreList(map$1, sourcemapPath, sourcemapIgnoreList,
|
|
280537
|
+
function applySourcemapIgnoreList(map$1, sourcemapPath, sourcemapIgnoreList, logger14) {
|
|
280538
280538
|
let { x_google_ignoreList } = map$1;
|
|
280539
280539
|
if (x_google_ignoreList === undefined)
|
|
280540
280540
|
x_google_ignoreList = [];
|
|
@@ -280543,8 +280543,8 @@ function applySourcemapIgnoreList(map$1, sourcemapPath, sourcemapIgnoreList, log
|
|
|
280543
280543
|
if (!sourcePath)
|
|
280544
280544
|
continue;
|
|
280545
280545
|
const ignoreList = sourcemapIgnoreList(path16.isAbsolute(sourcePath) ? sourcePath : path16.resolve(path16.dirname(sourcemapPath), sourcePath), sourcemapPath);
|
|
280546
|
-
if (
|
|
280547
|
-
|
|
280546
|
+
if (logger14 && typeof ignoreList !== "boolean")
|
|
280547
|
+
logger14.warn("sourcemapIgnoreList function must return a boolean.");
|
|
280548
280548
|
if (ignoreList && !x_google_ignoreList.includes(sourcesIndex))
|
|
280549
280549
|
x_google_ignoreList.push(sourcesIndex);
|
|
280550
280550
|
}
|
|
@@ -281218,7 +281218,7 @@ function err$1(e$1, pos) {
|
|
|
281218
281218
|
error$1.pos = pos;
|
|
281219
281219
|
return error$1;
|
|
281220
281220
|
}
|
|
281221
|
-
function parseGlobOptions(rawOpts, optsStartIndex,
|
|
281221
|
+
function parseGlobOptions(rawOpts, optsStartIndex, logger14) {
|
|
281222
281222
|
let opts = {};
|
|
281223
281223
|
try {
|
|
281224
281224
|
opts = evalValue(rawOpts);
|
|
@@ -281253,9 +281253,9 @@ function parseGlobOptions(rawOpts, optsStartIndex, logger13) {
|
|
|
281253
281253
|
}
|
|
281254
281254
|
opts.query = stringifyQuery(opts.query);
|
|
281255
281255
|
}
|
|
281256
|
-
if (opts.as &&
|
|
281256
|
+
if (opts.as && logger14) {
|
|
281257
281257
|
const importSuggestion = forceDefaultAs.includes(opts.as) ? `, import: 'default'` : "";
|
|
281258
|
-
|
|
281258
|
+
logger14.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}\`.`));
|
|
281259
281259
|
}
|
|
281260
281260
|
if (opts.as && forceDefaultAs.includes(opts.as)) {
|
|
281261
281261
|
if (opts.import && opts.import !== "default" && opts.import !== "*")
|
|
@@ -281270,7 +281270,7 @@ function parseGlobOptions(rawOpts, optsStartIndex, logger13) {
|
|
|
281270
281270
|
opts.query = `?${opts.query}`;
|
|
281271
281271
|
return opts;
|
|
281272
281272
|
}
|
|
281273
|
-
async function parseImportGlob(code2, importer, root3, resolveId2,
|
|
281273
|
+
async function parseImportGlob(code2, importer, root3, resolveId2, logger14) {
|
|
281274
281274
|
let cleanCode;
|
|
281275
281275
|
try {
|
|
281276
281276
|
cleanCode = stripLiteral(code2);
|
|
@@ -281323,7 +281323,7 @@ async function parseImportGlob(code2, importer, root3, resolveId2, logger13) {
|
|
|
281323
281323
|
if (arg2) {
|
|
281324
281324
|
if (arg2.type !== "ObjectExpression")
|
|
281325
281325
|
throw err$2(`Expected the second argument to be an object literal, but got "${arg2.type}"`);
|
|
281326
|
-
options$1 = parseGlobOptions(code2.slice(start4 + arg2.start, start4 + arg2.end), start4 + arg2.start,
|
|
281326
|
+
options$1 = parseGlobOptions(code2.slice(start4 + arg2.start, start4 + arg2.end), start4 + arg2.start, logger14);
|
|
281327
281327
|
}
|
|
281328
281328
|
const globsResolved = await Promise.all(globs.map((glob$1) => toAbsoluteGlob(glob$1, root3, importer, resolveId2, options$1.base)));
|
|
281329
281329
|
const isRelative$1 = globs.every((i$1) => ".!".includes(i$1[0]));
|
|
@@ -281366,12 +281366,12 @@ function findCorrespondingCloseParenthesisPosition(cleanCode, openPos) {
|
|
|
281366
281366
|
}
|
|
281367
281367
|
return -1;
|
|
281368
281368
|
}
|
|
281369
|
-
async function transformGlobImport(code2, id5, root3, resolveId2, restoreQueryExtension = false,
|
|
281369
|
+
async function transformGlobImport(code2, id5, root3, resolveId2, restoreQueryExtension = false, logger14) {
|
|
281370
281370
|
id5 = slash2(id5);
|
|
281371
281371
|
root3 = slash2(root3);
|
|
281372
281372
|
const isVirtual = isVirtualModule(id5);
|
|
281373
281373
|
const dir2 = isVirtual ? undefined : dirname$2(id5);
|
|
281374
|
-
const matches$2 = await parseImportGlob(code2, isVirtual ? undefined : id5, root3, resolveId2,
|
|
281374
|
+
const matches$2 = await parseImportGlob(code2, isVirtual ? undefined : id5, root3, resolveId2, logger14);
|
|
281375
281375
|
const matchedFiles = /* @__PURE__ */ new Set;
|
|
281376
281376
|
if (!matches$2.length)
|
|
281377
281377
|
return null;
|
|
@@ -282382,13 +282382,13 @@ async function prepareEsbuildOptimizerRun(environment2, depsInfo, processingCach
|
|
|
282382
282382
|
};
|
|
282383
282383
|
}
|
|
282384
282384
|
async function addManuallyIncludedOptimizeDeps(environment2, deps) {
|
|
282385
|
-
const { logger:
|
|
282385
|
+
const { logger: logger14 } = environment2;
|
|
282386
282386
|
const { optimizeDeps: optimizeDeps$1 } = environment2.config;
|
|
282387
282387
|
const optimizeDepsInclude = optimizeDeps$1.include ?? [];
|
|
282388
282388
|
if (optimizeDepsInclude.length) {
|
|
282389
282389
|
const unableToOptimize = (id5, msg) => {
|
|
282390
282390
|
if (optimizeDepsInclude.includes(id5))
|
|
282391
|
-
|
|
282391
|
+
logger14.warn(`${msg}: ${import_picocolors$26.default.cyan(id5)}, present in ${environment2.name} 'optimizeDeps.include'`);
|
|
282392
282392
|
};
|
|
282393
282393
|
const includes2 = [...optimizeDepsInclude];
|
|
282394
282394
|
for (let i$1 = 0;i$1 < includes2.length; i$1++) {
|
|
@@ -283556,7 +283556,7 @@ async function readFileIfExists(value$1) {
|
|
|
283556
283556
|
return value$1;
|
|
283557
283557
|
}
|
|
283558
283558
|
async function httpServerStart(httpServer, serverOptions) {
|
|
283559
|
-
let { port: port2, strictPort, host, logger:
|
|
283559
|
+
let { port: port2, strictPort, host, logger: logger14 } = serverOptions;
|
|
283560
283560
|
return new Promise((resolve$4, reject3) => {
|
|
283561
283561
|
const onError$1 = (e$1) => {
|
|
283562
283562
|
if (e$1.code === "EADDRINUSE")
|
|
@@ -283564,7 +283564,7 @@ async function httpServerStart(httpServer, serverOptions) {
|
|
|
283564
283564
|
httpServer.removeListener("error", onError$1);
|
|
283565
283565
|
reject3(/* @__PURE__ */ new Error(`Port ${port2} is already in use`));
|
|
283566
283566
|
} else {
|
|
283567
|
-
|
|
283567
|
+
logger14.info(`Port ${port2} is in use, trying another one...`);
|
|
283568
283568
|
httpServer.listen(++port2, host);
|
|
283569
283569
|
}
|
|
283570
283570
|
else {
|
|
@@ -283579,12 +283579,12 @@ async function httpServerStart(httpServer, serverOptions) {
|
|
|
283579
283579
|
});
|
|
283580
283580
|
});
|
|
283581
283581
|
}
|
|
283582
|
-
function setClientErrorHandler(server,
|
|
283582
|
+
function setClientErrorHandler(server, logger14) {
|
|
283583
283583
|
server.on("clientError", (err$2, socket) => {
|
|
283584
283584
|
let msg = "400 Bad Request";
|
|
283585
283585
|
if (err$2.code === "HPE_HEADER_OVERFLOW") {
|
|
283586
283586
|
msg = "431 Request Header Fields Too Large";
|
|
283587
|
-
|
|
283587
|
+
logger14.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."));
|
|
283588
283588
|
}
|
|
283589
283589
|
if (err$2.code === "ECONNRESET" || !socket.writable)
|
|
283590
283590
|
return;
|
|
@@ -284265,16 +284265,16 @@ function detectPlatformBinary({ [platform4]: platformBinary }, { wsl }) {
|
|
|
284265
284265
|
throw new Error(`${platform4} is not supported`);
|
|
284266
284266
|
return detectArchBinary(platformBinary);
|
|
284267
284267
|
}
|
|
284268
|
-
function openBrowser(url$3, opt,
|
|
284268
|
+
function openBrowser(url$3, opt, logger14) {
|
|
284269
284269
|
const browser2 = typeof opt === "string" ? opt : process.env.BROWSER || "";
|
|
284270
284270
|
if (browser2.toLowerCase().endsWith(".js"))
|
|
284271
|
-
executeNodeScript(browser2, url$3,
|
|
284271
|
+
executeNodeScript(browser2, url$3, logger14);
|
|
284272
284272
|
else if (browser2.toLowerCase() !== "none") {
|
|
284273
284273
|
const browserArgs = process.env.BROWSER_ARGS ? process.env.BROWSER_ARGS.split(" ") : [];
|
|
284274
|
-
startBrowserProcess(browser2, browserArgs, url$3,
|
|
284274
|
+
startBrowserProcess(browser2, browserArgs, url$3, logger14);
|
|
284275
284275
|
}
|
|
284276
284276
|
}
|
|
284277
|
-
function executeNodeScript(scriptPath, url$3,
|
|
284277
|
+
function executeNodeScript(scriptPath, url$3, logger14) {
|
|
284278
284278
|
const extraArgs = process.argv.slice(2);
|
|
284279
284279
|
const child = (0, import_cross_spawn.default)(process.execPath, [
|
|
284280
284280
|
scriptPath,
|
|
@@ -284283,13 +284283,13 @@ function executeNodeScript(scriptPath, url$3, logger13) {
|
|
|
284283
284283
|
], { stdio: "inherit" });
|
|
284284
284284
|
child.on("close", (code2) => {
|
|
284285
284285
|
if (code2 !== 0)
|
|
284286
|
-
|
|
284286
|
+
logger14.error(import_picocolors$19.default.red(`
|
|
284287
284287
|
The script specified as BROWSER environment variable failed.
|
|
284288
284288
|
|
|
284289
284289
|
${import_picocolors$19.default.cyan(scriptPath)} exited with code ${code2}.`), { error: null });
|
|
284290
284290
|
});
|
|
284291
284291
|
}
|
|
284292
|
-
async function startBrowserProcess(browser2, browserArgs, url$3,
|
|
284292
|
+
async function startBrowserProcess(browser2, browserArgs, url$3, logger14) {
|
|
284293
284293
|
const preferredOSXBrowser = browser2 === "google chrome" ? "Google Chrome" : browser2;
|
|
284294
284294
|
const shouldTryOpenChromeWithJXA = process.platform === "darwin" && (!preferredOSXBrowser || supportedChromiumBrowsers.includes(preferredOSXBrowser));
|
|
284295
284295
|
if (shouldTryOpenChromeWithJXA)
|
|
@@ -284313,7 +284313,7 @@ async function startBrowserProcess(browser2, browserArgs, url$3, logger13) {
|
|
|
284313
284313
|
subprocess.on("error", reject3);
|
|
284314
284314
|
}).catch(reject3);
|
|
284315
284315
|
}).catch((err$2) => {
|
|
284316
|
-
|
|
284316
|
+
logger14.error(err$2.stack || err$2.message);
|
|
284317
284317
|
});
|
|
284318
284318
|
return true;
|
|
284319
284319
|
} catch {
|
|
@@ -284374,12 +284374,12 @@ function getResolvedOutDirs(root3, outDir, outputOptions) {
|
|
|
284374
284374
|
return new Set([resolvedOutDir]);
|
|
284375
284375
|
return new Set(arraify(outputOptions).map(({ dir: dir2 }) => dir2 ? path16.resolve(root3, dir2) : resolvedOutDir));
|
|
284376
284376
|
}
|
|
284377
|
-
function resolveEmptyOutDir(emptyOutDir, root3, outDirs,
|
|
284377
|
+
function resolveEmptyOutDir(emptyOutDir, root3, outDirs, logger14) {
|
|
284378
284378
|
if (emptyOutDir != null)
|
|
284379
284379
|
return emptyOutDir;
|
|
284380
284380
|
for (const outDir of outDirs)
|
|
284381
284381
|
if (!normalizePath5(outDir).startsWith(withTrailingSlash(root3))) {
|
|
284382
|
-
|
|
284382
|
+
logger14?.warn(import_picocolors$17.default.yellow(`
|
|
284383
284383
|
${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.
|
|
284384
284384
|
Use --emptyOutDir to override.
|
|
284385
284385
|
`));
|
|
@@ -285344,7 +285344,7 @@ async function getCachedTransformResult(environment2, url$3, module$1, timestamp
|
|
|
285344
285344
|
}
|
|
285345
285345
|
}
|
|
285346
285346
|
async function loadAndTransform(environment2, id5, url$3, options$1, timestamp, mod2, resolved) {
|
|
285347
|
-
const { config: config$2, pluginContainer, logger:
|
|
285347
|
+
const { config: config$2, pluginContainer, logger: logger14 } = environment2;
|
|
285348
285348
|
const prettyUrl = debugLoad || debugTransform ? prettifyUrl(url$3, config$2.root) : "";
|
|
285349
285349
|
const moduleGraph = environment2.moduleGraph;
|
|
285350
285350
|
if (options$1.allowId && !options$1.allowId(id5)) {
|
|
@@ -285378,7 +285378,7 @@ async function loadAndTransform(environment2, id5, url$3, options$1, timestamp,
|
|
|
285378
285378
|
map$1 = extracted.map;
|
|
285379
285379
|
}
|
|
285380
285380
|
} catch (e$1) {
|
|
285381
|
-
|
|
285381
|
+
logger14.warn(`Failed to load source map for ${file5}.
|
|
285382
285382
|
${e$1}`, { timestamp: true });
|
|
285383
285383
|
}
|
|
285384
285384
|
} else {
|
|
@@ -285423,9 +285423,9 @@ ${e$1}`, { timestamp: true });
|
|
|
285423
285423
|
normalizedMap = null;
|
|
285424
285424
|
if (normalizedMap && "version" in normalizedMap && mod2.file) {
|
|
285425
285425
|
if (normalizedMap.mappings)
|
|
285426
|
-
await injectSourcesContent(normalizedMap, mod2.file,
|
|
285426
|
+
await injectSourcesContent(normalizedMap, mod2.file, logger14);
|
|
285427
285427
|
const sourcemapPath = `${mod2.file}.map`;
|
|
285428
|
-
applySourcemapIgnoreList(normalizedMap, sourcemapPath, config$2.server.sourcemapIgnoreList,
|
|
285428
|
+
applySourcemapIgnoreList(normalizedMap, sourcemapPath, config$2.server.sourcemapIgnoreList, logger14);
|
|
285429
285429
|
if (path16.isAbsolute(mod2.file)) {
|
|
285430
285430
|
let modDirname;
|
|
285431
285431
|
for (let sourcesIndex = 0;sourcesIndex < normalizedMap.sources.length; ++sourcesIndex) {
|
|
@@ -286281,11 +286281,11 @@ function resolveHtmlTransforms(plugins$1) {
|
|
|
286281
286281
|
function headTagInsertCheck(tags3, ctx) {
|
|
286282
286282
|
if (!tags3.length)
|
|
286283
286283
|
return;
|
|
286284
|
-
const { logger:
|
|
286284
|
+
const { logger: logger14 } = ctx.server?.config || {};
|
|
286285
286285
|
const disallowedTags = tags3.filter((tagDescriptor) => !elementsAllowedInHead.has(tagDescriptor.tag));
|
|
286286
286286
|
if (disallowedTags.length) {
|
|
286287
286287
|
const dedupedTags = unique(disallowedTags.map((tagDescriptor) => `<${tagDescriptor.tag}>`));
|
|
286288
|
-
|
|
286288
|
+
logger14?.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`)));
|
|
286289
286289
|
}
|
|
286290
286290
|
}
|
|
286291
286291
|
async function applyHtmlTransforms(html4, hooks, pluginContext, ctx) {
|
|
@@ -287291,7 +287291,7 @@ function createServerCloseFn(server) {
|
|
|
287291
287291
|
function resolvedAllowDir(root3, dir2) {
|
|
287292
287292
|
return normalizePath5(path16.resolve(root3, dir2));
|
|
287293
287293
|
}
|
|
287294
|
-
function resolveServerOptions(root3, raw4,
|
|
287294
|
+
function resolveServerOptions(root3, raw4, logger14) {
|
|
287295
287295
|
const _server = mergeWithDefaults({
|
|
287296
287296
|
...serverConfigDefaults,
|
|
287297
287297
|
host: undefined,
|
|
@@ -287313,7 +287313,7 @@ function resolveServerOptions(root3, raw4, logger13) {
|
|
|
287313
287313
|
const yarnCacheDir = execSync2(`yarn config get ${enableGlobalCache ? "globalFolder" : "cacheFolder"}`, { cwd: cwd2 }).toString().trim();
|
|
287314
287314
|
allowDirs.push(yarnCacheDir);
|
|
287315
287315
|
} catch (e$1) {
|
|
287316
|
-
|
|
287316
|
+
logger14.warn(`Get yarn cache dir error: ${e$1.message}`, { timestamp: true });
|
|
287317
287317
|
}
|
|
287318
287318
|
}
|
|
287319
287319
|
allowDirs = allowDirs.map((i$1) => resolvedAllowDir(root3, i$1));
|
|
@@ -287323,7 +287323,7 @@ function resolveServerOptions(root3, raw4, logger13) {
|
|
|
287323
287323
|
server.fs.allow = allowDirs;
|
|
287324
287324
|
if (server.origin?.endsWith("/")) {
|
|
287325
287325
|
server.origin = server.origin.slice(0, -1);
|
|
287326
|
-
|
|
287326
|
+
logger14.warn(import_picocolors$11.default.yellow(`${import_picocolors$11.default.bold("(!)")} server.origin should not end with "/". Using "${server.origin}" instead.`));
|
|
287327
287327
|
}
|
|
287328
287328
|
if (process.env.__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS && Array.isArray(server.allowedHosts)) {
|
|
287329
287329
|
const additionalHost = process.env.__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS;
|
|
@@ -287358,12 +287358,12 @@ async function restartServer(server) {
|
|
|
287358
287358
|
server.middlewares = middlewares;
|
|
287359
287359
|
newServer._setInternalServer(server);
|
|
287360
287360
|
}
|
|
287361
|
-
const { logger:
|
|
287361
|
+
const { logger: logger14, server: { port: port2, middlewareMode } } = server.config;
|
|
287362
287362
|
if (!middlewareMode)
|
|
287363
287363
|
await server.listen(port2, true);
|
|
287364
287364
|
else
|
|
287365
287365
|
await Promise.all(Object.values(server.environments).map((e$1) => e$1.listen(server)));
|
|
287366
|
-
|
|
287366
|
+
logger14.info("server restarted.", { timestamp: true });
|
|
287367
287367
|
if (shortcutsOptions) {
|
|
287368
287368
|
shortcutsOptions.print = false;
|
|
287369
287369
|
bindCLIShortcuts(server, shortcutsOptions);
|
|
@@ -287377,9 +287377,9 @@ async function restartServerWithUrls(server) {
|
|
|
287377
287377
|
const { port: prevPort, host: prevHost } = server.config.server;
|
|
287378
287378
|
const prevUrls = server.resolvedUrls;
|
|
287379
287379
|
await server.restart();
|
|
287380
|
-
const { logger:
|
|
287380
|
+
const { logger: logger14, server: { port: port2, host } } = server.config;
|
|
287381
287381
|
if ((port2 ?? DEFAULT_DEV_PORT) !== (prevPort ?? DEFAULT_DEV_PORT) || host !== prevHost || diffDnsOrderChange(prevUrls, server.resolvedUrls)) {
|
|
287382
|
-
|
|
287382
|
+
logger14.info("");
|
|
287383
287383
|
server.printUrls();
|
|
287384
287384
|
}
|
|
287385
287385
|
}
|
|
@@ -290314,7 +290314,7 @@ async function transformSugarSS(environment2, id5, code2) {
|
|
|
290314
290314
|
const result2 = await runPostCSS(id5, code2, [], { parser: loadSss(config$2.root) }, undefined, environment2.logger, devSourcemap);
|
|
290315
290315
|
return result2;
|
|
290316
290316
|
}
|
|
290317
|
-
async function runPostCSS(id5, code2, plugins$1, options$1, deps,
|
|
290317
|
+
async function runPostCSS(id5, code2, plugins$1, options$1, deps, logger14, enableSourcemap) {
|
|
290318
290318
|
let postcssResult;
|
|
290319
290319
|
try {
|
|
290320
290320
|
const source = removeDirectQuery(id5);
|
|
@@ -290353,7 +290353,7 @@ ${generateCodeFrame(code2, {
|
|
|
290353
290353
|
line: warning2.endLine,
|
|
290354
290354
|
column: warning2.endColumn - 1
|
|
290355
290355
|
} : undefined)}`;
|
|
290356
|
-
|
|
290356
|
+
logger14.warn(import_picocolors$6.default.yellow(msg));
|
|
290357
290357
|
}
|
|
290358
290358
|
} catch (e$1) {
|
|
290359
290359
|
e$1.message = `[postcss] ${e$1.message}`;
|
|
@@ -291459,12 +291459,12 @@ function areSeparateFolders(a11, b10) {
|
|
|
291459
291459
|
const nb = normalizePath5(b10);
|
|
291460
291460
|
return na2 !== nb && !na2.startsWith(withTrailingSlash(nb)) && !nb.startsWith(withTrailingSlash(na2));
|
|
291461
291461
|
}
|
|
291462
|
-
function resolveBuildEnvironmentOptions(raw4,
|
|
291462
|
+
function resolveBuildEnvironmentOptions(raw4, logger14, consumer) {
|
|
291463
291463
|
const deprecatedPolyfillModulePreload = raw4.polyfillModulePreload;
|
|
291464
291464
|
const { polyfillModulePreload, ...rest } = raw4;
|
|
291465
291465
|
raw4 = rest;
|
|
291466
291466
|
if (deprecatedPolyfillModulePreload !== undefined)
|
|
291467
|
-
|
|
291467
|
+
logger14.warn("polyfillModulePreload is deprecated. Use modulePreload.polyfill instead.");
|
|
291468
291468
|
if (deprecatedPolyfillModulePreload === false && raw4.modulePreload === undefined)
|
|
291469
291469
|
raw4.modulePreload = { polyfill: false };
|
|
291470
291470
|
const merged = mergeWithDefaults({
|
|
@@ -291526,7 +291526,7 @@ function resolveConfigToBuild(inlineConfig = {}, patchConfig, patchPlugins) {
|
|
|
291526
291526
|
function resolveRollupOptions(environment2) {
|
|
291527
291527
|
const { root: root3, packageCache, build: options$1 } = environment2.config;
|
|
291528
291528
|
const libOptions = options$1.lib;
|
|
291529
|
-
const { logger:
|
|
291529
|
+
const { logger: logger14 } = environment2;
|
|
291530
291530
|
const ssr = environment2.config.consumer === "server";
|
|
291531
291531
|
const resolve$4 = (p13) => path16.resolve(root3, p13);
|
|
291532
291532
|
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, file5]) => [alias$2, resolve$4(file5)]))) : typeof options$1.ssr === "string" ? resolve$4(options$1.ssr) : options$1.rollupOptions.input || resolve$4("index.html");
|
|
@@ -291554,11 +291554,11 @@ function resolveRollupOptions(environment2) {
|
|
|
291554
291554
|
const isSsrTargetWebworkerEnvironment = environment2.name === "ssr" && environment2.getTopLevelConfig().ssr?.target === "webworker";
|
|
291555
291555
|
const buildOutputOptions = (output2 = {}) => {
|
|
291556
291556
|
if (output2.output)
|
|
291557
|
-
|
|
291557
|
+
logger14.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.`);
|
|
291558
291558
|
if (output2.file)
|
|
291559
291559
|
throw new Error('Vite does not support "rollupOptions.output.file". Please use "rollupOptions.output.dir" and "rollupOptions.output.entryFileNames" instead.');
|
|
291560
291560
|
if (output2.sourcemap)
|
|
291561
|
-
|
|
291561
|
+
logger14.warnOnce(import_picocolors$4.default.yellow('Vite does not support "rollupOptions.output.sourcemap". Please use "build.sourcemap" instead.'));
|
|
291562
291562
|
const format$3 = output2.format || "es";
|
|
291563
291563
|
const jsExt = ssr && !isSsrTargetWebworkerEnvironment || libOptions ? resolveOutputJsExtension(format$3, findNearestPackageData(root3, packageCache)?.data.type) : "js";
|
|
291564
291564
|
return {
|
|
@@ -291576,7 +291576,7 @@ function resolveRollupOptions(environment2) {
|
|
|
291576
291576
|
...output2
|
|
291577
291577
|
};
|
|
291578
291578
|
};
|
|
291579
|
-
const outputs = resolveBuildOutputs(options$1.rollupOptions.output, libOptions,
|
|
291579
|
+
const outputs = resolveBuildOutputs(options$1.rollupOptions.output, libOptions, logger14);
|
|
291580
291580
|
if (Array.isArray(outputs))
|
|
291581
291581
|
rollupOptions.output = outputs.map(buildOutputOptions);
|
|
291582
291582
|
else
|
|
@@ -291584,19 +291584,19 @@ function resolveRollupOptions(environment2) {
|
|
|
291584
291584
|
return rollupOptions;
|
|
291585
291585
|
}
|
|
291586
291586
|
async function buildEnvironment(environment2) {
|
|
291587
|
-
const { logger:
|
|
291587
|
+
const { logger: logger14, config: config$2 } = environment2;
|
|
291588
291588
|
const { root: root3, build: options$1 } = config$2;
|
|
291589
291589
|
const ssr = config$2.consumer === "server";
|
|
291590
|
-
|
|
291590
|
+
logger14.info(import_picocolors$4.default.cyan(`vite v${VERSION} ${import_picocolors$4.default.green(`building ${ssr ? `SSR bundle ` : ``}for ${environment2.config.mode}...`)}`));
|
|
291591
291591
|
let bundle;
|
|
291592
291592
|
let startTime;
|
|
291593
291593
|
try {
|
|
291594
291594
|
const rollupOptions = resolveRollupOptions(environment2);
|
|
291595
291595
|
if (options$1.watch) {
|
|
291596
|
-
|
|
291596
|
+
logger14.info(import_picocolors$4.default.cyan(`
|
|
291597
291597
|
watching for file changes...`));
|
|
291598
291598
|
const resolvedOutDirs = getResolvedOutDirs(root3, options$1.outDir, options$1.rollupOptions.output);
|
|
291599
|
-
const emptyOutDir = resolveEmptyOutDir(options$1.emptyOutDir, root3, resolvedOutDirs,
|
|
291599
|
+
const emptyOutDir = resolveEmptyOutDir(options$1.emptyOutDir, root3, resolvedOutDirs, logger14);
|
|
291600
291600
|
const resolvedChokidarOptions = resolveChokidarOptions({
|
|
291601
291601
|
...(rollupOptions.watch || {}).chokidar,
|
|
291602
291602
|
...options$1.watch.chokidar
|
|
@@ -291612,16 +291612,16 @@ watching for file changes...`));
|
|
|
291612
291612
|
});
|
|
291613
291613
|
watcher.on("event", (event) => {
|
|
291614
291614
|
if (event.code === "BUNDLE_START")
|
|
291615
|
-
|
|
291615
|
+
logger14.info(import_picocolors$4.default.cyan(`
|
|
291616
291616
|
build started...`));
|
|
291617
291617
|
else if (event.code === "BUNDLE_END") {
|
|
291618
291618
|
event.result.close();
|
|
291619
|
-
|
|
291619
|
+
logger14.info(import_picocolors$4.default.cyan(`built in ${event.duration}ms.`));
|
|
291620
291620
|
} else if (event.code === "ERROR") {
|
|
291621
291621
|
const e$1 = event.error;
|
|
291622
291622
|
enhanceRollupError(e$1);
|
|
291623
291623
|
clearLine();
|
|
291624
|
-
|
|
291624
|
+
logger14.error(e$1.message, { error: e$1 });
|
|
291625
291625
|
}
|
|
291626
291626
|
});
|
|
291627
291627
|
return watcher;
|
|
@@ -291632,13 +291632,13 @@ build started...`));
|
|
|
291632
291632
|
const res = [];
|
|
291633
291633
|
for (const output2 of arraify(rollupOptions.output))
|
|
291634
291634
|
res.push(await bundle[options$1.write ? "write" : "generate"](output2));
|
|
291635
|
-
|
|
291635
|
+
logger14.info(`${import_picocolors$4.default.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`);
|
|
291636
291636
|
return Array.isArray(rollupOptions.output) ? res : res[0];
|
|
291637
291637
|
} catch (e$1) {
|
|
291638
291638
|
enhanceRollupError(e$1);
|
|
291639
291639
|
clearLine();
|
|
291640
291640
|
if (startTime) {
|
|
291641
|
-
|
|
291641
|
+
logger14.error(`${import_picocolors$4.default.red("✗")} Build failed in ${displayTime(Date.now() - startTime)}`);
|
|
291642
291642
|
startTime = undefined;
|
|
291643
291643
|
}
|
|
291644
291644
|
throw e$1;
|
|
@@ -291698,7 +291698,7 @@ function resolveLibFilename(libOptions, format$3, entryName, root3, extension$1,
|
|
|
291698
291698
|
return `${name17}.${extension$1}`;
|
|
291699
291699
|
return `${name17}.${format$3}.${extension$1}`;
|
|
291700
291700
|
}
|
|
291701
|
-
function resolveBuildOutputs(outputs, libOptions,
|
|
291701
|
+
function resolveBuildOutputs(outputs, libOptions, logger14) {
|
|
291702
291702
|
if (libOptions) {
|
|
291703
291703
|
const libHasMultipleEntries = typeof libOptions.entry !== "string" && Object.values(libOptions.entry).length > 1;
|
|
291704
291704
|
const libFormats = libOptions.formats || (libHasMultipleEntries ? ["es", "cjs"] : ["es", "umd"]);
|
|
@@ -291715,7 +291715,7 @@ function resolveBuildOutputs(outputs, libOptions, logger13) {
|
|
|
291715
291715
|
}));
|
|
291716
291716
|
}
|
|
291717
291717
|
if (libOptions.formats)
|
|
291718
|
-
|
|
291718
|
+
logger14.warn(import_picocolors$4.default.yellow('"build.lib.formats" will be ignored because "build.rollupOptions.output" is already an array format.'));
|
|
291719
291719
|
outputs.forEach((output2) => {
|
|
291720
291720
|
if ((output2.format === "umd" || output2.format === "iife") && !output2.name)
|
|
291721
291721
|
throw new Error('Entries in "build.rollupOptions.output" must specify "name" when the format is "umd" or "iife".');
|
|
@@ -292133,7 +292133,7 @@ ${MODULE_RUNNER_SOURCEMAPPING_SOURCE}
|
|
|
292133
292133
|
return result2;
|
|
292134
292134
|
}
|
|
292135
292135
|
function createDepsOptimizer(environment2) {
|
|
292136
|
-
const { logger:
|
|
292136
|
+
const { logger: logger14 } = environment2;
|
|
292137
292137
|
const sessionTimestamp = Date.now().toString();
|
|
292138
292138
|
let debounceProcessingHandle;
|
|
292139
292139
|
let closed = false;
|
|
@@ -292156,14 +292156,14 @@ function createDepsOptimizer(environment2) {
|
|
|
292156
292156
|
let newDepsToLogHandle;
|
|
292157
292157
|
const logNewlyDiscoveredDeps = () => {
|
|
292158
292158
|
if (newDepsToLog.length) {
|
|
292159
|
-
|
|
292159
|
+
logger14.info(import_picocolors$3.default.green(`✨ new dependencies optimized: ${depsLogString(newDepsToLog)}`), { timestamp: true });
|
|
292160
292160
|
newDepsToLog = [];
|
|
292161
292161
|
}
|
|
292162
292162
|
};
|
|
292163
292163
|
let discoveredDepsWhileScanning = [];
|
|
292164
292164
|
const logDiscoveredDepsWhileScanning = () => {
|
|
292165
292165
|
if (discoveredDepsWhileScanning.length) {
|
|
292166
|
-
|
|
292166
|
+
logger14.info(import_picocolors$3.default.green(`✨ discovered while scanning: ${depsLogString(discoveredDepsWhileScanning)}`), { timestamp: true });
|
|
292167
292167
|
discoveredDepsWhileScanning = [];
|
|
292168
292168
|
}
|
|
292169
292169
|
};
|
|
@@ -292243,7 +292243,7 @@ function createDepsOptimizer(environment2) {
|
|
|
292243
292243
|
runOptimizer(result2);
|
|
292244
292244
|
});
|
|
292245
292245
|
} catch (e$1) {
|
|
292246
|
-
|
|
292246
|
+
logger14.error(e$1.stack || e$1.message);
|
|
292247
292247
|
} finally {
|
|
292248
292248
|
resolve$4();
|
|
292249
292249
|
depsOptimizer.scanProcessing = undefined;
|
|
@@ -292340,7 +292340,7 @@ function createDepsOptimizer(environment2) {
|
|
|
292340
292340
|
logNewlyDiscoveredDeps();
|
|
292341
292341
|
if (warnAboutMissedDependencies) {
|
|
292342
292342
|
logDiscoveredDepsWhileScanning();
|
|
292343
|
-
|
|
292343
|
+
logger14.info(import_picocolors$3.default.magenta(`❗ add these dependencies to optimizeDeps.include to speed up cold start`), { timestamp: true });
|
|
292344
292344
|
warnAboutMissedDependencies = false;
|
|
292345
292345
|
}
|
|
292346
292346
|
}, 2 * debounceMs);
|
|
@@ -292358,17 +292358,17 @@ function createDepsOptimizer(environment2) {
|
|
|
292358
292358
|
logNewlyDiscoveredDeps();
|
|
292359
292359
|
if (warnAboutMissedDependencies) {
|
|
292360
292360
|
logDiscoveredDepsWhileScanning();
|
|
292361
|
-
|
|
292361
|
+
logger14.info(import_picocolors$3.default.magenta(`❗ add these dependencies to optimizeDeps.include to avoid a full page reload during cold start`), { timestamp: true });
|
|
292362
292362
|
warnAboutMissedDependencies = false;
|
|
292363
292363
|
}
|
|
292364
292364
|
}
|
|
292365
|
-
|
|
292365
|
+
logger14.info(import_picocolors$3.default.green(`✨ optimized dependencies changed. reloading`), { timestamp: true });
|
|
292366
292366
|
if (needsInteropMismatch.length > 0)
|
|
292367
|
-
|
|
292367
|
+
logger14.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 });
|
|
292368
292368
|
fullReload();
|
|
292369
292369
|
}
|
|
292370
292370
|
} catch (e$1) {
|
|
292371
|
-
|
|
292371
|
+
logger14.error(import_picocolors$3.default.red(`error while updating dependencies:
|
|
292372
292372
|
${e$1.stack}`), {
|
|
292373
292373
|
timestamp: true,
|
|
292374
292374
|
error: e$1
|
|
@@ -292728,7 +292728,7 @@ function resolveDevEnvironmentOptions(dev, environmentName, consumer, preTransfo
|
|
|
292728
292728
|
sourcemapIgnoreList: resolved.sourcemapIgnoreList === false ? () => false : resolved.sourcemapIgnoreList
|
|
292729
292729
|
};
|
|
292730
292730
|
}
|
|
292731
|
-
function resolveEnvironmentOptions(options$1, alias$2, preserveSymlinks, forceOptimizeDeps,
|
|
292731
|
+
function resolveEnvironmentOptions(options$1, alias$2, preserveSymlinks, forceOptimizeDeps, logger14, environmentName, isSsrTargetWebworkerSet, preTransformRequests) {
|
|
292732
292732
|
const isClientEnvironment = environmentName === "client";
|
|
292733
292733
|
const consumer = options$1.consumer ?? (isClientEnvironment ? "client" : "server");
|
|
292734
292734
|
const isSsrTargetWebworkerEnvironment = isSsrTargetWebworkerSet && environmentName === "ssr";
|
|
@@ -292737,10 +292737,10 @@ function resolveEnvironmentOptions(options$1, alias$2, preserveSymlinks, forceOp
|
|
|
292737
292737
|
if (typeof processEnvDefine === "object") {
|
|
292738
292738
|
const pathKey$1 = Object.entries(processEnvDefine).find(([key2, value$1]) => key2.toLowerCase() === "path" && !!value$1)?.[0];
|
|
292739
292739
|
if (pathKey$1)
|
|
292740
|
-
|
|
292740
|
+
logger14.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.`));
|
|
292741
292741
|
}
|
|
292742
292742
|
}
|
|
292743
|
-
const resolve$4 = resolveEnvironmentResolveOptions(options$1.resolve, alias$2, preserveSymlinks,
|
|
292743
|
+
const resolve$4 = resolveEnvironmentResolveOptions(options$1.resolve, alias$2, preserveSymlinks, logger14, consumer, isSsrTargetWebworkerEnvironment);
|
|
292744
292744
|
return {
|
|
292745
292745
|
define: options$1.define,
|
|
292746
292746
|
resolve: resolve$4,
|
|
@@ -292748,7 +292748,7 @@ function resolveEnvironmentOptions(options$1, alias$2, preserveSymlinks, forceOp
|
|
|
292748
292748
|
consumer,
|
|
292749
292749
|
optimizeDeps: resolveDepOptimizationOptions(options$1.optimizeDeps, resolve$4.preserveSymlinks, forceOptimizeDeps, consumer),
|
|
292750
292750
|
dev: resolveDevEnvironmentOptions(options$1.dev, environmentName, consumer, preTransformRequests),
|
|
292751
|
-
build: resolveBuildEnvironmentOptions(options$1.build ?? {},
|
|
292751
|
+
build: resolveBuildEnvironmentOptions(options$1.build ?? {}, logger14, consumer),
|
|
292752
292752
|
plugins: undefined
|
|
292753
292753
|
};
|
|
292754
292754
|
}
|
|
@@ -292764,7 +292764,7 @@ function getDefaultEnvironmentOptions(config$2) {
|
|
|
292764
292764
|
build: config$2.build
|
|
292765
292765
|
};
|
|
292766
292766
|
}
|
|
292767
|
-
function checkBadCharactersInPath(name17, path$13,
|
|
292767
|
+
function checkBadCharactersInPath(name17, path$13, logger14) {
|
|
292768
292768
|
const badChars = [];
|
|
292769
292769
|
if (path$13.includes("#"))
|
|
292770
292770
|
badChars.push("#");
|
|
@@ -292775,10 +292775,10 @@ function checkBadCharactersInPath(name17, path$13, logger13) {
|
|
|
292775
292775
|
if (badChars.length > 0) {
|
|
292776
292776
|
const charString = badChars.map((c10) => `"${c10}"`).join(" and ");
|
|
292777
292777
|
const inflectedChars = badChars.length > 1 ? "characters" : "character";
|
|
292778
|
-
|
|
292778
|
+
logger14.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.`));
|
|
292779
292779
|
}
|
|
292780
292780
|
}
|
|
292781
|
-
function resolveEnvironmentResolveOptions(resolve$4, alias$2, preserveSymlinks,
|
|
292781
|
+
function resolveEnvironmentResolveOptions(resolve$4, alias$2, preserveSymlinks, logger14, consumer, isSsrTargetWebworkerEnvironment) {
|
|
292782
292782
|
const resolvedResolve = mergeWithDefaults({
|
|
292783
292783
|
...configDefaults.resolve,
|
|
292784
292784
|
mainFields: consumer === undefined || consumer === "client" || isSsrTargetWebworkerEnvironment ? DEFAULT_CLIENT_MAIN_FIELDS : DEFAULT_SERVER_MAIN_FIELDS,
|
|
@@ -292788,15 +292788,15 @@ function resolveEnvironmentResolveOptions(resolve$4, alias$2, preserveSymlinks,
|
|
|
292788
292788
|
resolvedResolve.preserveSymlinks = preserveSymlinks;
|
|
292789
292789
|
resolvedResolve.alias = alias$2;
|
|
292790
292790
|
if (resolve$4?.browserField === false && resolvedResolve.mainFields.includes("browser"))
|
|
292791
|
-
|
|
292791
|
+
logger14.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."));
|
|
292792
292792
|
return resolvedResolve;
|
|
292793
292793
|
}
|
|
292794
|
-
function resolveResolveOptions(resolve$4,
|
|
292794
|
+
function resolveResolveOptions(resolve$4, logger14) {
|
|
292795
292795
|
const alias$2 = normalizeAlias(mergeAlias(clientAlias, resolve$4?.alias || configDefaults.resolve.alias));
|
|
292796
292796
|
const preserveSymlinks = resolve$4?.preserveSymlinks ?? configDefaults.resolve.preserveSymlinks;
|
|
292797
292797
|
if (alias$2.some((a11) => a11.find === "/"))
|
|
292798
|
-
|
|
292799
|
-
return resolveEnvironmentResolveOptions(resolve$4, alias$2, preserveSymlinks,
|
|
292798
|
+
logger14.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."));
|
|
292799
|
+
return resolveEnvironmentResolveOptions(resolve$4, alias$2, preserveSymlinks, logger14, undefined);
|
|
292800
292800
|
}
|
|
292801
292801
|
function resolveDepOptimizationOptions(optimizeDeps$1, preserveSymlinks, forceOptimizeDeps, consumer) {
|
|
292802
292802
|
return mergeWithDefaults({
|
|
@@ -292868,12 +292868,12 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
292868
292868
|
client: {},
|
|
292869
292869
|
...config$2.environments
|
|
292870
292870
|
};
|
|
292871
|
-
const
|
|
292871
|
+
const logger14 = createLogger(config$2.logLevel, {
|
|
292872
292872
|
allowClearScreen: config$2.clearScreen,
|
|
292873
292873
|
customLogger: config$2.customLogger
|
|
292874
292874
|
});
|
|
292875
292875
|
const resolvedRoot = normalizePath5(config$2.root ? path16.resolve(config$2.root) : process.cwd());
|
|
292876
|
-
checkBadCharactersInPath("The project root", resolvedRoot,
|
|
292876
|
+
checkBadCharactersInPath("The project root", resolvedRoot, logger14);
|
|
292877
292877
|
const configEnvironmentsClient = config$2.environments.client;
|
|
292878
292878
|
configEnvironmentsClient.dev ??= {};
|
|
292879
292879
|
const deprecatedSsrOptimizeDepsConfig = config$2.ssr?.optimizeDeps ?? {};
|
|
@@ -292923,17 +292923,17 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
292923
292923
|
};
|
|
292924
292924
|
for (const name17 of Object.keys(config$2.environments))
|
|
292925
292925
|
config$2.environments[name17] = mergeConfig(name17 === "client" ? defaultClientEnvironmentOptions : defaultNonClientEnvironmentOptions, config$2.environments[name17]);
|
|
292926
|
-
await runConfigEnvironmentHook(config$2.environments, userPlugins,
|
|
292926
|
+
await runConfigEnvironmentHook(config$2.environments, userPlugins, logger14, configEnv, config$2.ssr?.target === "webworker");
|
|
292927
292927
|
config$2.resolve ??= {};
|
|
292928
292928
|
config$2.resolve.conditions = config$2.environments.client.resolve?.conditions;
|
|
292929
292929
|
config$2.resolve.mainFields = config$2.environments.client.resolve?.mainFields;
|
|
292930
|
-
const resolvedDefaultResolve = resolveResolveOptions(config$2.resolve,
|
|
292930
|
+
const resolvedDefaultResolve = resolveResolveOptions(config$2.resolve, logger14);
|
|
292931
292931
|
const resolvedEnvironments = {};
|
|
292932
292932
|
for (const environmentName of Object.keys(config$2.environments))
|
|
292933
|
-
resolvedEnvironments[environmentName] = resolveEnvironmentOptions(config$2.environments[environmentName], resolvedDefaultResolve.alias, resolvedDefaultResolve.preserveSymlinks, inlineConfig.forceOptimizeDeps,
|
|
292933
|
+
resolvedEnvironments[environmentName] = resolveEnvironmentOptions(config$2.environments[environmentName], resolvedDefaultResolve.alias, resolvedDefaultResolve.preserveSymlinks, inlineConfig.forceOptimizeDeps, logger14, environmentName, config$2.ssr?.target === "webworker", config$2.server?.preTransformRequests);
|
|
292934
292934
|
const backwardCompatibleOptimizeDeps = resolvedEnvironments.client.optimizeDeps;
|
|
292935
292935
|
const resolvedDevEnvironmentOptions = resolveDevEnvironmentOptions(config$2.dev, undefined, undefined);
|
|
292936
|
-
const resolvedBuildOptions = resolveBuildEnvironmentOptions(config$2.build ?? {},
|
|
292936
|
+
const resolvedBuildOptions = resolveBuildEnvironmentOptions(config$2.build ?? {}, logger14, undefined);
|
|
292937
292937
|
const patchedConfigSsr = {
|
|
292938
292938
|
...config$2.ssr,
|
|
292939
292939
|
external: resolvedEnvironments.ssr?.resolve.external,
|
|
@@ -292955,27 +292955,27 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
292955
292955
|
if (userNodeEnv === "development")
|
|
292956
292956
|
process.env.NODE_ENV = "development";
|
|
292957
292957
|
else
|
|
292958
|
-
|
|
292958
|
+
logger14.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.`);
|
|
292959
292959
|
const isProduction = false;
|
|
292960
292960
|
const relativeBaseShortcut = config$2.base === "" || config$2.base === "./";
|
|
292961
|
-
const resolvedBase = relativeBaseShortcut ? !isBuild || config$2.build?.ssr ? "/" : "./" : resolveBaseUrl(config$2.base, isBuild,
|
|
292961
|
+
const resolvedBase = relativeBaseShortcut ? !isBuild || config$2.build?.ssr ? "/" : "./" : resolveBaseUrl(config$2.base, isBuild, logger14);
|
|
292962
292962
|
const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
|
|
292963
292963
|
const cacheDir = normalizePath5(config$2.cacheDir ? path16.resolve(resolvedRoot, config$2.cacheDir) : pkgDir ? path16.join(pkgDir, `node_modules/.vite`) : path16.join(resolvedRoot, `.vite`));
|
|
292964
292964
|
const assetsFilter = config$2.assetsInclude && (!Array.isArray(config$2.assetsInclude) || config$2.assetsInclude.length) ? createFilter3(config$2.assetsInclude) : () => false;
|
|
292965
292965
|
const { publicDir } = config$2;
|
|
292966
292966
|
const resolvedPublicDir = publicDir !== false && publicDir !== "" ? normalizePath5(path16.resolve(resolvedRoot, typeof publicDir === "string" ? publicDir : configDefaults.publicDir)) : "";
|
|
292967
|
-
const server = resolveServerOptions(resolvedRoot, config$2.server,
|
|
292967
|
+
const server = resolveServerOptions(resolvedRoot, config$2.server, logger14);
|
|
292968
292968
|
const builder = resolveBuilderOptions(config$2.builder);
|
|
292969
292969
|
const BASE_URL = resolvedBase;
|
|
292970
292970
|
const resolvedConfigContext = new BasicMinimalPluginContext({
|
|
292971
292971
|
...basePluginContextMeta,
|
|
292972
292972
|
watchMode: command === "serve" && !isPreview || command === "build" && !!resolvedBuildOptions.watch
|
|
292973
|
-
},
|
|
292973
|
+
}, logger14);
|
|
292974
292974
|
let resolved;
|
|
292975
292975
|
let createUserWorkerPlugins = config$2.worker?.plugins;
|
|
292976
292976
|
if (Array.isArray(createUserWorkerPlugins)) {
|
|
292977
292977
|
createUserWorkerPlugins = () => config$2.worker?.plugins;
|
|
292978
|
-
|
|
292978
|
+
logger14.warn(import_picocolors2.default.yellow(`worker.plugins is now a function that returns an array of plugins. Please update your Vite config accordingly.
|
|
292979
292979
|
`));
|
|
292980
292980
|
}
|
|
292981
292981
|
const createWorkerPlugins = async function(bundleChain) {
|
|
@@ -293055,7 +293055,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
293055
293055
|
assetsInclude(file5) {
|
|
293056
293056
|
return DEFAULT_ASSETS_RE.test(file5) || assetsFilter(file5);
|
|
293057
293057
|
},
|
|
293058
|
-
logger:
|
|
293058
|
+
logger: logger14,
|
|
293059
293059
|
packageCache,
|
|
293060
293060
|
worker: resolvedWorkerOptions,
|
|
293061
293061
|
appType: config$2.appType ?? "spa",
|
|
@@ -293146,14 +293146,14 @@ assetFileNames isn't equal for every build.rollupOptions.output. A single patter
|
|
|
293146
293146
|
`));
|
|
293147
293147
|
return resolved;
|
|
293148
293148
|
}
|
|
293149
|
-
function resolveBaseUrl(base2 = configDefaults.base, isBuild,
|
|
293149
|
+
function resolveBaseUrl(base2 = configDefaults.base, isBuild, logger14) {
|
|
293150
293150
|
if (base2[0] === ".") {
|
|
293151
|
-
|
|
293151
|
+
logger14.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.`)));
|
|
293152
293152
|
return "/";
|
|
293153
293153
|
}
|
|
293154
293154
|
const isExternal$1 = isExternalUrl(base2);
|
|
293155
293155
|
if (!isExternal$1 && base2[0] !== "/")
|
|
293156
|
-
|
|
293156
|
+
logger14.warn(import_picocolors2.default.yellow(import_picocolors2.default.bold(`(!) "base" option should start with a slash.`)));
|
|
293157
293157
|
if (!isBuild || !isExternal$1) {
|
|
293158
293158
|
base2 = new URL(base2, "http://vite.dev").pathname;
|
|
293159
293159
|
if (base2[0] !== "/")
|
|
@@ -293220,9 +293220,9 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
|
293220
293220
|
dependencies
|
|
293221
293221
|
};
|
|
293222
293222
|
} catch (e$1) {
|
|
293223
|
-
const
|
|
293224
|
-
checkBadCharactersInPath("The config path", resolvedPath,
|
|
293225
|
-
|
|
293223
|
+
const logger14 = createLogger(logLevel2, { customLogger });
|
|
293224
|
+
checkBadCharactersInPath("The config path", resolvedPath, logger14);
|
|
293225
|
+
logger14.error(import_picocolors2.default.red(`failed to load config from ${resolvedPath}`), { error: e$1 });
|
|
293226
293226
|
throw e$1;
|
|
293227
293227
|
}
|
|
293228
293228
|
}
|
|
@@ -293399,8 +293399,8 @@ async function runConfigHook(config$2, plugins$1, configEnv) {
|
|
|
293399
293399
|
}
|
|
293400
293400
|
return conf;
|
|
293401
293401
|
}
|
|
293402
|
-
async function runConfigEnvironmentHook(environments, plugins$1,
|
|
293403
|
-
const context15 = new BasicMinimalPluginContext(basePluginContextMeta,
|
|
293402
|
+
async function runConfigEnvironmentHook(environments, plugins$1, logger14, configEnv, isSsrTargetWebworkerSet) {
|
|
293403
|
+
const context15 = new BasicMinimalPluginContext(basePluginContextMeta, logger14);
|
|
293404
293404
|
const environmentNames = Object.keys(environments);
|
|
293405
293405
|
for (const p13 of getSortedPluginsByHook("configEnvironment", plugins$1)) {
|
|
293406
293406
|
const hook = p13.configEnvironment;
|
|
@@ -343800,29 +343800,13 @@ Use the gh command via the executeCommand tool for ALL GitHub-related tasks incl
|
|
|
343800
343800
|
|
|
343801
343801
|
IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
|
|
343802
343802
|
|
|
343803
|
-
1.
|
|
343803
|
+
1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel using the executeCommand tool, in order to understand the current state of the branch since it diverged from the main branch:
|
|
343804
343804
|
- Run a git status command to see all untracked files
|
|
343805
343805
|
- Run a git diff command to see both staged and unstaged changes that will be committed
|
|
343806
343806
|
- Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
|
|
343807
|
-
- Run a git log command and \`git diff
|
|
343808
|
-
|
|
343809
|
-
|
|
343810
|
-
|
|
343811
|
-
- List the commits since diverging from the main branch
|
|
343812
|
-
- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)
|
|
343813
|
-
- Brainstorm the purpose or motivation behind these changes
|
|
343814
|
-
- Assess the impact of these changes on the overall project
|
|
343815
|
-
- Do not use tools to explore code, beyond what is available in the git context
|
|
343816
|
-
- Check for any sensitive information that shouldn't be committed
|
|
343817
|
-
- Draft a concise (1-2 bullet points) pull request summary that focuses on the "why" rather than the "what"
|
|
343818
|
-
- Ensure the summary accurately reflects all changes since diverging from the main branch
|
|
343819
|
-
- Ensure your language is clear, concise, and to the point
|
|
343820
|
-
- Ensure the summary accurately reflects the changes and their purpose (ie. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.)
|
|
343821
|
-
- Ensure the summary is not generic (avoid words like "Update" or "Fix" without context)
|
|
343822
|
-
- Review the draft summary to ensure it accurately reflects the changes and their purpose
|
|
343823
|
-
- Note unlike creating a git message, you don't need to include the Co-Authored-By line in PR body
|
|
343824
|
-
|
|
343825
|
-
3. Use batchCall to run the following commands in parallel:
|
|
343807
|
+
- Run a git log command and \`git diff [base-branch]...HEAD\` to understand the full commit history for the current branch (from the time it diverged from the base branch)
|
|
343808
|
+
2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary
|
|
343809
|
+
3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:
|
|
343826
343810
|
- Create new branch if needed
|
|
343827
343811
|
- Push to remote with -u flag if needed
|
|
343828
343812
|
- Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.
|
|
@@ -343844,7 +343828,9 @@ Important:
|
|
|
343844
343828
|
- Return the PR URL when you're done, so the user can see it
|
|
343845
343829
|
|
|
343846
343830
|
# Other common operations
|
|
343847
|
-
|
|
343831
|
+
1. View comments on a Github PR, you should run following commands
|
|
343832
|
+
- gh api repos/foo/bar/pulls/123/comments
|
|
343833
|
+
- gh pr view --comments
|
|
343848
343834
|
`.trim(),
|
|
343849
343835
|
inputSchema: exports_external2.object({
|
|
343850
343836
|
command: exports_external2.string().describe("The CLI command to execute. This should be valid for the current operating system."),
|
|
@@ -347679,7 +347665,7 @@ async function renewCredentials2(credentials) {
|
|
|
347679
347665
|
async function fetchUserInfo2(_credentials) {
|
|
347680
347666
|
return {
|
|
347681
347667
|
email: "",
|
|
347682
|
-
name: "
|
|
347668
|
+
name: "Logged-in"
|
|
347683
347669
|
};
|
|
347684
347670
|
}
|
|
347685
347671
|
function generatePKCEParams2() {
|
|
@@ -352310,7 +352296,7 @@ var {
|
|
|
352310
352296
|
// package.json
|
|
352311
352297
|
var package_default = {
|
|
352312
352298
|
name: "@getpochi/cli",
|
|
352313
|
-
version: "0.5.
|
|
352299
|
+
version: "0.5.26",
|
|
352314
352300
|
type: "module",
|
|
352315
352301
|
bin: {
|
|
352316
352302
|
pochi: "src/cli.ts"
|
|
@@ -353555,15 +353541,17 @@ async function selectVendor() {
|
|
|
353555
353541
|
if (vendor3.authenticated) {
|
|
353556
353542
|
try {
|
|
353557
353543
|
const userInfo = await vendor3.getUserInfo();
|
|
353558
|
-
|
|
353544
|
+
const name17 = userInfo?.name || "Unknown User";
|
|
353545
|
+
const email3 = userInfo?.email || "";
|
|
353546
|
+
description = email3 ? `${source_default2.bold(name17)} (${email3})` : source_default2.bold(name17);
|
|
353559
353547
|
} catch {
|
|
353560
|
-
description = "
|
|
353548
|
+
description = source_default2.bold("Unknown User");
|
|
353561
353549
|
}
|
|
353562
353550
|
} else {
|
|
353563
353551
|
description = "Not logged in";
|
|
353564
353552
|
}
|
|
353565
353553
|
return {
|
|
353566
|
-
name: `${vendorId
|
|
353554
|
+
name: `${vendorId} ${source_default2.white("-")} ${vendor3.authenticated ? source_default2.green(description) : source_default2.gray(description)}`,
|
|
353567
353555
|
value: vendorId,
|
|
353568
353556
|
description: `
|
|
353569
353557
|
${source_default2.gray("Current selection:")} ${source_default2.gray(description)}`
|
|
@@ -353595,8 +353583,11 @@ async function confirmVendorSelection(vendorId) {
|
|
|
353595
353583
|
if (vendor3.authenticated) {
|
|
353596
353584
|
try {
|
|
353597
353585
|
const userInfo = await vendor3.getUserInfo();
|
|
353586
|
+
const name17 = userInfo?.name || "Unknown User";
|
|
353587
|
+
const email3 = userInfo?.email || "";
|
|
353588
|
+
const userDisplay = email3 ? `${source_default2.bold(name17)} (${email3})` : source_default2.bold(name17);
|
|
353598
353589
|
const confirm = await esm_default3({
|
|
353599
|
-
message: `You're already logged in to ${vendorId} as ${
|
|
353590
|
+
message: `You're already logged in to ${vendorId} as ${source_default2.green(userDisplay)}. Do you want to re-authenticate?`,
|
|
353600
353591
|
choices: [
|
|
353601
353592
|
{ name: "No, use existing authentication", value: false },
|
|
353602
353593
|
{ name: "Yes, re-authenticate", value: true }
|
|
@@ -353615,8 +353606,6 @@ function registerAuthCommand(program3) {
|
|
|
353615
353606
|
const vendors = getVendors();
|
|
353616
353607
|
const authCommand = program3.command("auth").description("Manage authentication for different AI vendors.").addHelpCommand(true);
|
|
353617
353608
|
authCommand.command("status", { isDefault: true }).description("Check authentication status for all supported vendors.").action(async () => {
|
|
353618
|
-
console.log(`Checking authentication status...
|
|
353619
|
-
`);
|
|
353620
353609
|
for (const [name17, auth] of Object.entries(vendors)) {
|
|
353621
353610
|
console.log(`${name17}:`, auth.authenticated ? renderUser(await auth.getUserInfo()) : source_default2.gray("Not logged in"));
|
|
353622
353611
|
}
|
|
@@ -353674,13 +353663,16 @@ function registerAuthCommand(program3) {
|
|
|
353674
353663
|
const choices = await Promise.all(authenticatedVendors.map(async ([vendorId, vendor3]) => {
|
|
353675
353664
|
try {
|
|
353676
353665
|
const userInfo = await vendor3.getUserInfo();
|
|
353666
|
+
const name17 = userInfo?.name || "Unknown User";
|
|
353667
|
+
const email3 = userInfo?.email || "";
|
|
353668
|
+
const userDisplay = email3 ? `${source_default2.bold(name17)} (${email3})` : source_default2.bold(name17);
|
|
353677
353669
|
return {
|
|
353678
|
-
name: `${vendorId}
|
|
353670
|
+
name: `${vendorId} ${source_default2.white("-")} ${source_default2.green(userDisplay)}`,
|
|
353679
353671
|
value: vendorId
|
|
353680
353672
|
};
|
|
353681
353673
|
} catch {
|
|
353682
353674
|
return {
|
|
353683
|
-
name: `${vendorId} - authenticated user`,
|
|
353675
|
+
name: `${vendorId} ${source_default2.white("-")} ${source_default2.green("authenticated user")}`,
|
|
353684
353676
|
value: vendorId
|
|
353685
353677
|
};
|
|
353686
353678
|
}
|
|
@@ -353703,12 +353695,14 @@ function registerAuthCommand(program3) {
|
|
|
353703
353695
|
});
|
|
353704
353696
|
}
|
|
353705
353697
|
function renderUser(user) {
|
|
353706
|
-
|
|
353707
|
-
|
|
353698
|
+
if (!user)
|
|
353699
|
+
return source_default2.gray("Not logged in");
|
|
353700
|
+
const name17 = user.name || "Unknown User";
|
|
353701
|
+
const email3 = user.email;
|
|
353708
353702
|
if (email3 && email3.trim() !== "") {
|
|
353709
|
-
return `${name17} (${email3})`;
|
|
353703
|
+
return `${source_default2.bold(name17)} (${email3})`;
|
|
353710
353704
|
}
|
|
353711
|
-
return name17;
|
|
353705
|
+
return source_default2.bold(name17);
|
|
353712
353706
|
}
|
|
353713
353707
|
// src/lib/find-ripgrep.ts
|
|
353714
353708
|
import { execSync } from "node:child_process";
|
|
@@ -364005,6 +363999,23 @@ async function loadAgents(workingDirectory) {
|
|
|
364005
363999
|
}
|
|
364006
364000
|
}
|
|
364007
364001
|
|
|
364002
|
+
// src/lib/store-utils.ts
|
|
364003
|
+
var logger11 = getLogger("Shutdown");
|
|
364004
|
+
async function shutdownStoreAndExit(store) {
|
|
364005
|
+
try {
|
|
364006
|
+
await Promise.race([
|
|
364007
|
+
store.shutdownPromise(),
|
|
364008
|
+
new Promise((_2, reject) => setTimeout(() => {
|
|
364009
|
+
reject(new Error("Store shutdown timed out"));
|
|
364010
|
+
}, 5000))
|
|
364011
|
+
]);
|
|
364012
|
+
process.exit(0);
|
|
364013
|
+
} catch (error40) {
|
|
364014
|
+
logger11.warn("Store shutdown failed", error40);
|
|
364015
|
+
process.exit(1);
|
|
364016
|
+
}
|
|
364017
|
+
}
|
|
364018
|
+
|
|
364008
364019
|
// src/lib/workflow-loader.ts
|
|
364009
364020
|
import * as fs6 from "node:fs/promises";
|
|
364010
364021
|
import * as path9 from "node:path";
|
|
@@ -387500,6 +387511,23 @@ class Chat extends AbstractChat {
|
|
|
387500
387511
|
return this.state;
|
|
387501
387512
|
}
|
|
387502
387513
|
}
|
|
387514
|
+
// src/lib/store-utils.ts
|
|
387515
|
+
var logger14 = getLogger("Shutdown");
|
|
387516
|
+
async function shutdownStoreAndExit2(store) {
|
|
387517
|
+
try {
|
|
387518
|
+
await Promise.race([
|
|
387519
|
+
store.shutdownPromise(),
|
|
387520
|
+
new Promise((_8, reject3) => setTimeout(() => {
|
|
387521
|
+
reject3(new Error("Store shutdown timed out"));
|
|
387522
|
+
}, 5000))
|
|
387523
|
+
]);
|
|
387524
|
+
process.exit(0);
|
|
387525
|
+
} catch (error44) {
|
|
387526
|
+
logger14.warn("Store shutdown failed", error44);
|
|
387527
|
+
process.exit(1);
|
|
387528
|
+
}
|
|
387529
|
+
}
|
|
387530
|
+
|
|
387503
387531
|
// src/task/list.ts
|
|
387504
387532
|
function registerTaskListCommand(taskCommand) {
|
|
387505
387533
|
taskCommand.command("list", { isDefault: true }).description("List all recent tasks, showing their status and IDs.").option("-n, --limit <number>", "The maximum number of tasks to display.", "100").action(async (options4) => {
|
|
@@ -387548,7 +387576,7 @@ ${formatTaskDescription(task, false)}`);
|
|
|
387548
387576
|
return taskCommand.error(`Failed to list tasks: ${error44 instanceof Error ? error44.message : "Unknown error"}`);
|
|
387549
387577
|
}
|
|
387550
387578
|
} finally {
|
|
387551
|
-
await store
|
|
387579
|
+
await shutdownStoreAndExit2(store);
|
|
387552
387580
|
}
|
|
387553
387581
|
});
|
|
387554
387582
|
}
|
|
@@ -387633,7 +387661,7 @@ function registerTaskShareCommand(taskCommand) {
|
|
|
387633
387661
|
} else {
|
|
387634
387662
|
console.log(source_default2.red("❌ No share URL found for this task"));
|
|
387635
387663
|
}
|
|
387636
|
-
await store
|
|
387664
|
+
await shutdownStoreAndExit2(store);
|
|
387637
387665
|
});
|
|
387638
387666
|
}
|
|
387639
387667
|
|
|
@@ -387716,12 +387744,12 @@ function toTaskError(error44) {
|
|
|
387716
387744
|
}
|
|
387717
387745
|
|
|
387718
387746
|
// ../livekit/src/chat/llm/generate-task-title.ts
|
|
387719
|
-
var
|
|
387747
|
+
var logger15 = getLogger("generateTaskTitle");
|
|
387720
387748
|
async function generateTaskTitle(options4) {
|
|
387721
387749
|
const { title } = options4;
|
|
387722
387750
|
const newTitle = await generateTaskTitleImpl(options4);
|
|
387723
387751
|
if (newTitle !== undefined) {
|
|
387724
|
-
|
|
387752
|
+
logger15.debug(`Generating task title, old: ${title}, new: ${newTitle}`);
|
|
387725
387753
|
}
|
|
387726
387754
|
return newTitle;
|
|
387727
387755
|
}
|
|
@@ -387748,7 +387776,7 @@ async function generateTaskTitleImpl({
|
|
|
387748
387776
|
return title2;
|
|
387749
387777
|
}
|
|
387750
387778
|
} catch (err2) {
|
|
387751
|
-
|
|
387779
|
+
logger15.warn("Failed to generate title", err2);
|
|
387752
387780
|
}
|
|
387753
387781
|
}
|
|
387754
387782
|
if (title === null) {
|
|
@@ -387794,7 +387822,7 @@ async function generateTitle2(model3, inputMessages, abortSignal) {
|
|
|
387794
387822
|
}
|
|
387795
387823
|
|
|
387796
387824
|
// ../livekit/src/chat/background-job/manager.ts
|
|
387797
|
-
var
|
|
387825
|
+
var logger16 = getLogger("BackgroundJobManager");
|
|
387798
387826
|
|
|
387799
387827
|
class BackgroundJobManager {
|
|
387800
387828
|
jobs = Promise.resolve();
|
|
@@ -387808,7 +387836,7 @@ class BackgroundJobManager {
|
|
|
387808
387836
|
}
|
|
387809
387837
|
this.pendingJobs.delete(nextJob.id);
|
|
387810
387838
|
return nextJob.process().catch((error44) => {
|
|
387811
|
-
|
|
387839
|
+
logger16.error(`Failed to process job for task ${nextJob.id}`, error44);
|
|
387812
387840
|
});
|
|
387813
387841
|
});
|
|
387814
387842
|
job.waitUntil?.(this.jobs);
|
|
@@ -387817,7 +387845,7 @@ class BackgroundJobManager {
|
|
|
387817
387845
|
var backgroundJobManager = new BackgroundJobManager;
|
|
387818
387846
|
|
|
387819
387847
|
// ../livekit/src/chat/background-job/generate-title.ts
|
|
387820
|
-
var
|
|
387848
|
+
var logger17 = getLogger("GenerateTitleManager");
|
|
387821
387849
|
function scheduleGenerateTitleJob(job) {
|
|
387822
387850
|
backgroundJobManager.push({
|
|
387823
387851
|
id: `generate-title-${job.taskId}`,
|
|
@@ -387833,7 +387861,7 @@ async function process15({
|
|
|
387833
387861
|
}) {
|
|
387834
387862
|
const task = store.query(makeTaskQuery(taskId));
|
|
387835
387863
|
if (!task) {
|
|
387836
|
-
|
|
387864
|
+
logger17.warn(`Task not found for title generation: ${taskId}`);
|
|
387837
387865
|
return;
|
|
387838
387866
|
}
|
|
387839
387867
|
const newTitle = await generateTaskTitle({
|
|
@@ -387850,7 +387878,7 @@ async function process15({
|
|
|
387850
387878
|
}
|
|
387851
387879
|
}
|
|
387852
387880
|
// ../livekit/src/chat/llm/repair-tool-call.ts
|
|
387853
|
-
var
|
|
387881
|
+
var logger18 = getLogger("RepairToolCall");
|
|
387854
387882
|
var makeRepairToolCall = (model3) => async ({ toolCall, inputSchema, error: error44 }) => {
|
|
387855
387883
|
if (NoSuchToolError.isInstance(error44)) {
|
|
387856
387884
|
return null;
|
|
@@ -387894,11 +387922,11 @@ var makeRepairToolCall = (model3) => async ({ toolCall, inputSchema, error: erro
|
|
|
387894
387922
|
maxRetries: 0
|
|
387895
387923
|
});
|
|
387896
387924
|
const input2 = await result2.text;
|
|
387897
|
-
|
|
387925
|
+
logger18.debug("Repairing tool call:", toolCall.toolName, input2);
|
|
387898
387926
|
return { ...toolCall, input: input2 };
|
|
387899
387927
|
};
|
|
387900
387928
|
// ../livekit/src/chat/llm/compact-task.ts
|
|
387901
|
-
var
|
|
387929
|
+
var logger19 = getLogger("compactTask");
|
|
387902
387930
|
async function compactTask({
|
|
387903
387931
|
model: model3,
|
|
387904
387932
|
messages: messages2,
|
|
@@ -387920,7 +387948,7 @@ async function compactTask({
|
|
|
387920
387948
|
}
|
|
387921
387949
|
return text12;
|
|
387922
387950
|
} catch (err2) {
|
|
387923
|
-
|
|
387951
|
+
logger19.warn("Failed to create summary", err2);
|
|
387924
387952
|
}
|
|
387925
387953
|
}
|
|
387926
387954
|
async function createSummary(model3, abortSignal, inputMessages) {
|
|
@@ -389840,7 +389868,7 @@ function createOpenAICompatible(options4) {
|
|
|
389840
389868
|
}
|
|
389841
389869
|
|
|
389842
389870
|
// ../livekit/src/chat/models/openai.ts
|
|
389843
|
-
var
|
|
389871
|
+
var logger20 = getLogger("openai");
|
|
389844
389872
|
var OpenAIRequestParamsSchema = exports_external.object({
|
|
389845
389873
|
max_tokens: exports_external.number().positive().optional(),
|
|
389846
389874
|
max_completion_tokens: exports_external.number().positive().optional()
|
|
@@ -389889,7 +389917,7 @@ function overrideMaxOutputToken(body3) {
|
|
|
389889
389917
|
const json9 = JSON.parse(body3);
|
|
389890
389918
|
const result2 = OpenAIRequestParamsSchema.safeParse(json9);
|
|
389891
389919
|
if (!result2.success) {
|
|
389892
|
-
|
|
389920
|
+
logger20.error("OpenAI request body validation failed:", result2.error);
|
|
389893
389921
|
return;
|
|
389894
389922
|
}
|
|
389895
389923
|
const parsed = result2.data;
|
|
@@ -389898,7 +389926,7 @@ function overrideMaxOutputToken(body3) {
|
|
|
389898
389926
|
}
|
|
389899
389927
|
return JSON.stringify(parsed);
|
|
389900
389928
|
} catch (error44) {
|
|
389901
|
-
|
|
389929
|
+
logger20.error("Failed to parse OpenAI request body:", error44);
|
|
389902
389930
|
}
|
|
389903
389931
|
return;
|
|
389904
389932
|
}
|
|
@@ -390048,7 +390076,7 @@ function estimateTotalTokens(messages2) {
|
|
|
390048
390076
|
}
|
|
390049
390077
|
|
|
390050
390078
|
// ../livekit/src/chat/live-chat-kit.ts
|
|
390051
|
-
var
|
|
390079
|
+
var logger21 = getLogger("LiveChatKit");
|
|
390052
390080
|
|
|
390053
390081
|
class LiveChatKit {
|
|
390054
390082
|
taskId;
|
|
@@ -390104,7 +390132,7 @@ class LiveChatKit {
|
|
|
390104
390132
|
inline: true
|
|
390105
390133
|
});
|
|
390106
390134
|
} catch (err2) {
|
|
390107
|
-
|
|
390135
|
+
logger21.error("Failed to compact task", err2);
|
|
390108
390136
|
throw err2;
|
|
390109
390137
|
}
|
|
390110
390138
|
}
|
|
@@ -390224,7 +390252,7 @@ class LiveChatKit {
|
|
|
390224
390252
|
}));
|
|
390225
390253
|
};
|
|
390226
390254
|
onError = (error44) => {
|
|
390227
|
-
|
|
390255
|
+
logger21.error("onError", error44);
|
|
390228
390256
|
const lastMessage = this.chat.messages.at(-1) || null;
|
|
390229
390257
|
this.store.commit(events.chatStreamFailed({
|
|
390230
390258
|
id: this.taskId,
|
|
@@ -390317,7 +390345,7 @@ import * as nodePath from "node:path";
|
|
|
390317
390345
|
|
|
390318
390346
|
// ../common/src/diff-utils.ts
|
|
390319
390347
|
var import_fast_levenshtein = __toESM(require_levenshtein(), 1);
|
|
390320
|
-
var
|
|
390348
|
+
var logger22 = getLogger("diffUtils");
|
|
390321
390349
|
function normalize6(content3) {
|
|
390322
390350
|
return content3.replace(/\r\n/g, `
|
|
390323
390351
|
`).trimEnd();
|
|
@@ -390330,7 +390358,7 @@ class DiffError extends Error {
|
|
|
390330
390358
|
}
|
|
390331
390359
|
}
|
|
390332
390360
|
async function parseDiffAndApply(fileContent, searchContent, replaceContent, expectedReplacements = 1) {
|
|
390333
|
-
|
|
390361
|
+
logger22.trace(`Applying diff with expectedReplacements: ${expectedReplacements}`);
|
|
390334
390362
|
const isCRLF = fileContent.includes(`\r
|
|
390335
390363
|
`);
|
|
390336
390364
|
const normalizedFileContent = normalize6(fileContent);
|
|
@@ -390347,11 +390375,11 @@ async function parseDiffAndApply(fileContent, searchContent, replaceContent, exp
|
|
|
390347
390375
|
const matches2 = searchContentExact(normalizedFileContent, normalizedSearchContent);
|
|
390348
390376
|
if (matches2.length < expectedReplacements) {
|
|
390349
390377
|
matches2.push(...searchContentWithLineTrimmed(normalizedFileContent, normalizedSearchContent));
|
|
390350
|
-
|
|
390378
|
+
logger22.trace(`Found ${matches2.length} matches after line trimming search strategy`);
|
|
390351
390379
|
}
|
|
390352
390380
|
if (matches2.length < expectedReplacements) {
|
|
390353
390381
|
matches2.push(...searchContentByBlockAnchor(normalizedFileContent, normalizedSearchContent));
|
|
390354
|
-
|
|
390382
|
+
logger22.trace(`Found ${matches2.length} matches after block anchor search strategy`);
|
|
390355
390383
|
}
|
|
390356
390384
|
if (matches2.length === 0) {
|
|
390357
390385
|
throw new DiffError("Search content does not match the file content. Try to reread the file for the latest content.");
|
|
@@ -390360,7 +390388,7 @@ async function parseDiffAndApply(fileContent, searchContent, replaceContent, exp
|
|
|
390360
390388
|
throw new DiffError(`Expected ${expectedReplacements} occurrences but found ${matches2.length}. Please verify the search content and expectedReplacements parameter.`);
|
|
390361
390389
|
}
|
|
390362
390390
|
const result2 = replaceMatches(normalizedFileContent, matches2, replaceContent);
|
|
390363
|
-
|
|
390391
|
+
logger22.trace("Successfully applied diff");
|
|
390364
390392
|
if (isCRLF) {
|
|
390365
390393
|
return result2.replace(/\n/g, `\r
|
|
390366
390394
|
`);
|
|
@@ -390714,11 +390742,11 @@ var readFile13 = (context15) => async ({ path: path24, startLine, endLine }) =>
|
|
|
390714
390742
|
|
|
390715
390743
|
// src/tools/search-files.ts
|
|
390716
390744
|
import * as fs14 from "node:fs";
|
|
390717
|
-
var
|
|
390745
|
+
var logger23 = getLogger("searchFiles");
|
|
390718
390746
|
var searchFiles2 = (context15) => async ({ path: path24, regex: regex3, filePattern }, { abortSignal }) => {
|
|
390719
390747
|
const rgPath = context15.rg;
|
|
390720
390748
|
if (!rgPath || !fs14.existsSync(rgPath)) {
|
|
390721
|
-
|
|
390749
|
+
logger23.error("Ripgrep not found at path", rgPath);
|
|
390722
390750
|
throw new Error(`Ripgrep not found at path: ${rgPath}`);
|
|
390723
390751
|
}
|
|
390724
390752
|
return await searchFilesWithRipgrep(path24, regex3, rgPath, context15.cwd, filePattern, abortSignal);
|
|
@@ -390789,7 +390817,7 @@ function toErrorString(e11) {
|
|
|
390789
390817
|
}
|
|
390790
390818
|
|
|
390791
390819
|
// src/task-runner.ts
|
|
390792
|
-
var
|
|
390820
|
+
var logger24 = getLogger("TaskRunner");
|
|
390793
390821
|
|
|
390794
390822
|
class TaskRunner {
|
|
390795
390823
|
toolCallOptions;
|
|
@@ -390854,9 +390882,9 @@ class TaskRunner {
|
|
|
390854
390882
|
return this.chatKit.task?.shareId;
|
|
390855
390883
|
}
|
|
390856
390884
|
async run() {
|
|
390857
|
-
|
|
390885
|
+
logger24.debug("Starting TaskRunner...");
|
|
390858
390886
|
try {
|
|
390859
|
-
|
|
390887
|
+
logger24.trace("Start step loop.");
|
|
390860
390888
|
this.stepCount.reset();
|
|
390861
390889
|
while (true) {
|
|
390862
390890
|
const stepResult = await this.step();
|
|
@@ -390871,7 +390899,7 @@ class TaskRunner {
|
|
|
390871
390899
|
}
|
|
390872
390900
|
} catch (e11) {
|
|
390873
390901
|
const error44 = toError2(e11);
|
|
390874
|
-
|
|
390902
|
+
logger24.trace("Failed:", error44);
|
|
390875
390903
|
}
|
|
390876
390904
|
}
|
|
390877
390905
|
async step() {
|
|
@@ -390909,24 +390937,24 @@ class TaskRunner {
|
|
|
390909
390937
|
throw new Error("Task is not loaded");
|
|
390910
390938
|
}
|
|
390911
390939
|
if ((task.status === "completed" || task.status === "pending-input") && isResultMessage(message)) {
|
|
390912
|
-
|
|
390940
|
+
logger24.trace("Task is completed or pending input, no more steps to process.");
|
|
390913
390941
|
return "finished";
|
|
390914
390942
|
}
|
|
390915
390943
|
if (task.status === "failed") {
|
|
390916
390944
|
if (task.error?.kind === "APICallError" && !task.error.isRetryable) {
|
|
390917
390945
|
return "finished";
|
|
390918
390946
|
}
|
|
390919
|
-
|
|
390947
|
+
logger24.error("Task is failed, trying to resend last message to resume it.", task.error);
|
|
390920
390948
|
return "retry";
|
|
390921
390949
|
}
|
|
390922
390950
|
if (message.role !== "assistant") {
|
|
390923
|
-
|
|
390951
|
+
logger24.trace("Last message is not a assistant message, resending it to resume the task.");
|
|
390924
390952
|
return "retry";
|
|
390925
390953
|
}
|
|
390926
390954
|
if (isAssistantMessageWithEmptyParts(message) || isAssistantMessageWithPartialToolCalls(message) || isAssistantMessageWithOutputError(message) || lastAssistantMessageIsCompleteWithToolCalls({
|
|
390927
390955
|
messages: this.chat.messages
|
|
390928
390956
|
})) {
|
|
390929
|
-
|
|
390957
|
+
logger24.trace("Last message is assistant with empty parts or partial/completed tool calls, resending it to resume the task.");
|
|
390930
390958
|
const processed = prepareLastMessageForRetry(message);
|
|
390931
390959
|
if (processed) {
|
|
390932
390960
|
this.chat.appendOrReplaceMessage(processed);
|
|
@@ -390934,28 +390962,28 @@ class TaskRunner {
|
|
|
390934
390962
|
return "retry";
|
|
390935
390963
|
}
|
|
390936
390964
|
if (isAssistantMessageWithNoToolCalls(message)) {
|
|
390937
|
-
|
|
390965
|
+
logger24.trace("Last message is assistant with no tool calls, sending a new user reminder.");
|
|
390938
390966
|
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."));
|
|
390939
390967
|
this.chat.appendOrReplaceMessage(message2);
|
|
390940
390968
|
return "next";
|
|
390941
390969
|
}
|
|
390942
390970
|
}
|
|
390943
390971
|
async processToolCalls(message) {
|
|
390944
|
-
|
|
390972
|
+
logger24.trace("Processing tool calls in the last message.");
|
|
390945
390973
|
for (const toolCall of message.parts.filter(isToolUIPart)) {
|
|
390946
390974
|
if (toolCall.state !== "input-available")
|
|
390947
390975
|
continue;
|
|
390948
390976
|
const toolName = getToolName(toolCall);
|
|
390949
|
-
|
|
390977
|
+
logger24.trace(`Found tool call: ${toolName} with args: ${JSON.stringify(toolCall.input)}`);
|
|
390950
390978
|
const toolResult = await executeToolCall(toolCall, this.toolCallOptions);
|
|
390951
390979
|
this.chatKit.chat.addToolResult({
|
|
390952
390980
|
tool: toolName,
|
|
390953
390981
|
toolCallId: toolCall.toolCallId,
|
|
390954
390982
|
output: toolResult
|
|
390955
390983
|
});
|
|
390956
|
-
|
|
390984
|
+
logger24.trace(`Tool call result: ${JSON.stringify(toolResult)}`);
|
|
390957
390985
|
}
|
|
390958
|
-
|
|
390986
|
+
logger24.trace("All tool calls processed in the last message.");
|
|
390959
390987
|
return "next";
|
|
390960
390988
|
}
|
|
390961
390989
|
}
|
|
@@ -390983,48 +391011,6 @@ function toError2(e11) {
|
|
|
390983
391011
|
}
|
|
390984
391012
|
return new Error(JSON.stringify(e11));
|
|
390985
391013
|
}
|
|
390986
|
-
// package.json
|
|
390987
|
-
var package_default2 = {
|
|
390988
|
-
name: "@getpochi/cli",
|
|
390989
|
-
version: "0.5.24",
|
|
390990
|
-
type: "module",
|
|
390991
|
-
bin: {
|
|
390992
|
-
pochi: "src/cli.ts"
|
|
390993
|
-
},
|
|
390994
|
-
files: ["dist/**", "README.md", "../../LICENSE"],
|
|
390995
|
-
scripts: {
|
|
390996
|
-
start: "bun run src/cli.ts",
|
|
390997
|
-
tsc: "tsc",
|
|
390998
|
-
test: "bun vitest --run",
|
|
390999
|
-
build: "./scripts/build-cli.sh",
|
|
391000
|
-
"build:all": "./scripts/build-platform-binary.sh",
|
|
391001
|
-
"build:node": "TARGET=node bun run build",
|
|
391002
|
-
release: "bunx bumpp --tag=cli@%s"
|
|
391003
|
-
},
|
|
391004
|
-
devDependencies: {
|
|
391005
|
-
"@getpochi/tools": "workspace:*",
|
|
391006
|
-
"@types/semver": "^7.5.8",
|
|
391007
|
-
"@commander-js/extra-typings": "^14.0.0",
|
|
391008
|
-
"@getpochi/common": "workspace:*",
|
|
391009
|
-
"@getpochi/livekit": "workspace:*",
|
|
391010
|
-
"@getpochi/vendor-claude-code": "workspace:*",
|
|
391011
|
-
"@getpochi/vendor-gemini-cli": "workspace:*",
|
|
391012
|
-
"@getpochi/vendor-pochi": "workspace:*",
|
|
391013
|
-
"@livestore/adapter-node": "catalog:",
|
|
391014
|
-
"@livestore/livestore": "catalog:",
|
|
391015
|
-
"@livestore/utils": "catalog:",
|
|
391016
|
-
"@livestore/wa-sqlite": "catalog:",
|
|
391017
|
-
"@livestore/sync-cf": "catalog:",
|
|
391018
|
-
"@preact/signals-core": "^1.6.2",
|
|
391019
|
-
ai: "catalog:",
|
|
391020
|
-
chalk: "^5.3.0",
|
|
391021
|
-
commander: "^14.0.0",
|
|
391022
|
-
listr2: "^9.0.3",
|
|
391023
|
-
ora: "^8.2.0",
|
|
391024
|
-
semver: "^7.6.3",
|
|
391025
|
-
"@inquirer/select": "^4.3.2"
|
|
391026
|
-
}
|
|
391027
|
-
};
|
|
391028
391014
|
|
|
391029
391015
|
// src/upgrade/binary-installer.ts
|
|
391030
391016
|
import { execSync as execSync3 } from "node:child_process";
|
|
@@ -391035,8 +391021,7 @@ import {
|
|
|
391035
391021
|
mkdirSync,
|
|
391036
391022
|
readdirSync as readdirSync2,
|
|
391037
391023
|
rmSync,
|
|
391038
|
-
statSync as statSync3
|
|
391039
|
-
symlinkSync
|
|
391024
|
+
statSync as statSync3
|
|
391040
391025
|
} from "node:fs";
|
|
391041
391026
|
import { homedir as homedir5, tmpdir as tmpdir3 } from "node:os";
|
|
391042
391027
|
import { extname as extname4, join as join22 } from "node:path";
|
|
@@ -391072,10 +391057,6 @@ function getPlatformBinaryName() {
|
|
|
391072
391057
|
const extension2 = process.platform === "win32" ? ".zip" : ".tar.gz";
|
|
391073
391058
|
return `pochi-${platformName}-${archName}${extension2}`;
|
|
391074
391059
|
}
|
|
391075
|
-
function getBinaryFileName(version5) {
|
|
391076
|
-
const extension2 = process.platform === "win32" ? ".exe" : "";
|
|
391077
|
-
return `pochi-${version5}${extension2}`;
|
|
391078
|
-
}
|
|
391079
391060
|
function getLatestBinaryFileName() {
|
|
391080
391061
|
const extension2 = process.platform === "win32" ? ".exe" : "";
|
|
391081
391062
|
return `pochi${extension2}`;
|
|
@@ -391184,11 +391165,9 @@ async function downloadAndInstall(release2) {
|
|
|
391184
391165
|
console.log(`⬇️ Downloading ${asset.name}...`);
|
|
391185
391166
|
const version5 = extractVersionFromTag(release2.tag_name);
|
|
391186
391167
|
const binDir = getPochiDir();
|
|
391187
|
-
const versionedBinaryName = getBinaryFileName(version5);
|
|
391188
391168
|
const latestBinaryName = getLatestBinaryFileName();
|
|
391189
|
-
const versionedBinaryPath = join22(binDir, versionedBinaryName);
|
|
391190
391169
|
const latestBinaryPath = join22(binDir, latestBinaryName);
|
|
391191
|
-
console.log(`⚙️ Installing to: ${
|
|
391170
|
+
console.log(`⚙️ Installing to: ${latestBinaryPath}`);
|
|
391192
391171
|
const tempDir = join22(tmpdir3(), `pochi-upgrade-${Date.now()}`);
|
|
391193
391172
|
mkdirSync(tempDir, { recursive: true });
|
|
391194
391173
|
const archivePath = join22(tempDir, asset.name);
|
|
@@ -391202,28 +391181,16 @@ async function downloadAndInstall(release2) {
|
|
|
391202
391181
|
}
|
|
391203
391182
|
const extractedBinaryPath = await extractArchive(archivePath, tempDir);
|
|
391204
391183
|
console.log(`\uD83D\uDD0D Found binary: ${extractedBinaryPath}`);
|
|
391205
|
-
copyFileSync(extractedBinaryPath, versionedBinaryPath);
|
|
391206
|
-
if (process.platform !== "win32") {
|
|
391207
|
-
chmodSync(versionedBinaryPath, 493);
|
|
391208
|
-
}
|
|
391209
391184
|
if (existsSync7(latestBinaryPath)) {
|
|
391210
391185
|
rmSync(latestBinaryPath);
|
|
391211
391186
|
}
|
|
391212
|
-
|
|
391213
|
-
|
|
391214
|
-
|
|
391215
|
-
try {
|
|
391216
|
-
symlinkSync(versionedBinaryName, latestBinaryPath);
|
|
391217
|
-
} catch (error44) {
|
|
391218
|
-
execSync3(`ln -s "${versionedBinaryName}" "${latestBinaryPath}"`, {
|
|
391219
|
-
cwd: binDir
|
|
391220
|
-
});
|
|
391221
|
-
}
|
|
391187
|
+
copyFileSync(extractedBinaryPath, latestBinaryPath);
|
|
391188
|
+
if (process.platform !== "win32") {
|
|
391189
|
+
chmodSync(latestBinaryPath, 493);
|
|
391222
391190
|
}
|
|
391223
391191
|
rmSync(tempDir, { recursive: true, force: true });
|
|
391224
391192
|
console.log(source_default2.green(`✅ Successfully installed Pochi v${version5}`));
|
|
391225
|
-
console.log(source_default2.cyan(`\uD83D\uDCCD Installed to: ${
|
|
391226
|
-
console.log(source_default2.cyan(`\uD83D\uDD17 Latest symlink: ${latestBinaryPath}`));
|
|
391193
|
+
console.log(source_default2.cyan(`\uD83D\uDCCD Installed to: ${latestBinaryPath}`));
|
|
391227
391194
|
console.log();
|
|
391228
391195
|
console.log(source_default2.yellow("To use the new version:"));
|
|
391229
391196
|
console.log(source_default2.white(` ${latestBinaryPath} --version`));
|
|
@@ -391237,6 +391204,48 @@ async function downloadAndInstall(release2) {
|
|
|
391237
391204
|
console.error(source_default2.red("Failed to install update:"), error44);
|
|
391238
391205
|
}
|
|
391239
391206
|
}
|
|
391207
|
+
// package.json
|
|
391208
|
+
var package_default2 = {
|
|
391209
|
+
name: "@getpochi/cli",
|
|
391210
|
+
version: "0.5.26",
|
|
391211
|
+
type: "module",
|
|
391212
|
+
bin: {
|
|
391213
|
+
pochi: "src/cli.ts"
|
|
391214
|
+
},
|
|
391215
|
+
files: ["dist/**", "README.md", "../../LICENSE"],
|
|
391216
|
+
scripts: {
|
|
391217
|
+
start: "bun run src/cli.ts",
|
|
391218
|
+
tsc: "tsc",
|
|
391219
|
+
test: "bun vitest --run",
|
|
391220
|
+
build: "./scripts/build-cli.sh",
|
|
391221
|
+
"build:all": "./scripts/build-platform-binary.sh",
|
|
391222
|
+
"build:node": "TARGET=node bun run build",
|
|
391223
|
+
release: "bunx bumpp --tag=cli@%s"
|
|
391224
|
+
},
|
|
391225
|
+
devDependencies: {
|
|
391226
|
+
"@getpochi/tools": "workspace:*",
|
|
391227
|
+
"@types/semver": "^7.5.8",
|
|
391228
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
391229
|
+
"@getpochi/common": "workspace:*",
|
|
391230
|
+
"@getpochi/livekit": "workspace:*",
|
|
391231
|
+
"@getpochi/vendor-claude-code": "workspace:*",
|
|
391232
|
+
"@getpochi/vendor-gemini-cli": "workspace:*",
|
|
391233
|
+
"@getpochi/vendor-pochi": "workspace:*",
|
|
391234
|
+
"@livestore/adapter-node": "catalog:",
|
|
391235
|
+
"@livestore/livestore": "catalog:",
|
|
391236
|
+
"@livestore/utils": "catalog:",
|
|
391237
|
+
"@livestore/wa-sqlite": "catalog:",
|
|
391238
|
+
"@livestore/sync-cf": "catalog:",
|
|
391239
|
+
"@preact/signals-core": "^1.6.2",
|
|
391240
|
+
ai: "catalog:",
|
|
391241
|
+
chalk: "^5.3.0",
|
|
391242
|
+
commander: "^14.0.0",
|
|
391243
|
+
listr2: "^9.0.3",
|
|
391244
|
+
ora: "^8.2.0",
|
|
391245
|
+
semver: "^7.6.3",
|
|
391246
|
+
"@inquirer/select": "^4.3.2"
|
|
391247
|
+
}
|
|
391248
|
+
};
|
|
391240
391249
|
|
|
391241
391250
|
// src/upgrade/release-fetcher.ts
|
|
391242
391251
|
var GITHUB_REPO = "TabbyML/pochi";
|
|
@@ -391259,17 +391268,47 @@ async function fetchLatestCliRelease() {
|
|
|
391259
391268
|
return cliReleases[0];
|
|
391260
391269
|
}
|
|
391261
391270
|
|
|
391271
|
+
// src/upgrade/version-check.ts
|
|
391272
|
+
async function returnVersionInfo(options4) {
|
|
391273
|
+
const { timeoutMs } = options4 ?? {};
|
|
391274
|
+
const latestReleasePromise = fetchLatestCliRelease();
|
|
391275
|
+
const latestRelease = await (timeoutMs != null ? Promise.race([
|
|
391276
|
+
latestReleasePromise,
|
|
391277
|
+
new Promise((_8, reject3) => setTimeout(() => reject3(new Error("version check timeout")), timeoutMs))
|
|
391278
|
+
]) : latestReleasePromise);
|
|
391279
|
+
const latestVersion = extractVersionFromTag(latestRelease.tag_name);
|
|
391280
|
+
return {
|
|
391281
|
+
updateAvailable: isNewerVersion(latestVersion, package_default2.version),
|
|
391282
|
+
currentVersion: package_default2.version,
|
|
391283
|
+
latestVersion,
|
|
391284
|
+
latestRelease
|
|
391285
|
+
};
|
|
391286
|
+
}
|
|
391287
|
+
async function checkForUpdates() {
|
|
391288
|
+
const { updateAvailable, currentVersion, latestVersion } = await returnVersionInfo({ timeoutMs: 300 });
|
|
391289
|
+
const header = `
|
|
391290
|
+
${source_default2.bold("Pochi")} ${source_default2.white(currentVersion)}`;
|
|
391291
|
+
if (updateAvailable) {
|
|
391292
|
+
console.log(`${header} ${source_default2.dim("(update available")} ${source_default2.green(latestVersion)}${source_default2.dim(")")}`);
|
|
391293
|
+
const columns = process.stdout.columns || 80;
|
|
391294
|
+
const width = Math.max(Math.min(columns, 100), 20);
|
|
391295
|
+
console.log(source_default2.yellow("─".repeat(width)));
|
|
391296
|
+
}
|
|
391297
|
+
}
|
|
391298
|
+
|
|
391262
391299
|
// src/upgrade/cmd.ts
|
|
391263
391300
|
function registerUpgradeCommand(program5) {
|
|
391264
391301
|
program5.command("upgrade").description("Check for new releases and upgrade the Pochi CLI to the latest version.").action(async () => {
|
|
391265
391302
|
console.log("Checking for updates...");
|
|
391266
391303
|
try {
|
|
391267
|
-
const
|
|
391268
|
-
|
|
391269
|
-
|
|
391304
|
+
const {
|
|
391305
|
+
updateAvailable,
|
|
391306
|
+
latestVersion,
|
|
391307
|
+
latestRelease,
|
|
391308
|
+
currentVersion
|
|
391309
|
+
} = await returnVersionInfo({ timeoutMs: null });
|
|
391270
391310
|
console.log(`Current version: ${currentVersion}`);
|
|
391271
|
-
|
|
391272
|
-
if (isNewerVersion(latestVersion, currentVersion)) {
|
|
391311
|
+
if (updateAvailable) {
|
|
391273
391312
|
console.log(source_default2.green(`A new version (${latestVersion}) is available!`));
|
|
391274
391313
|
await downloadAndInstall(latestRelease);
|
|
391275
391314
|
} else {
|
|
@@ -391281,8 +391320,8 @@ function registerUpgradeCommand(program5) {
|
|
|
391281
391320
|
});
|
|
391282
391321
|
}
|
|
391283
391322
|
// src/cli.ts
|
|
391284
|
-
var
|
|
391285
|
-
|
|
391323
|
+
var logger25 = getLogger("Pochi");
|
|
391324
|
+
logger25.debug(`pochi v${package_default.version}`);
|
|
391286
391325
|
var parsePositiveInt = (input2) => {
|
|
391287
391326
|
if (!input2) {
|
|
391288
391327
|
return program5.error("error: Option must be a positive integer");
|
|
@@ -391319,14 +391358,14 @@ var program5 = new Command().name("pochi").description(`${source_default.bold("P
|
|
|
391319
391358
|
});
|
|
391320
391359
|
const renderer = new OutputRenderer(runner.state);
|
|
391321
391360
|
await runner.run();
|
|
391322
|
-
renderer.shutdown();
|
|
391323
391361
|
const shareId = runner.shareId;
|
|
391324
391362
|
if (shareId) {
|
|
391325
391363
|
const shareUrl = source_default.underline(`https://app.getpochi.com/share/${shareId}`);
|
|
391326
391364
|
console.log(`
|
|
391327
391365
|
${source_default.bold("Task link: ")} ${shareUrl}`);
|
|
391328
391366
|
}
|
|
391329
|
-
|
|
391367
|
+
renderer.shutdown();
|
|
391368
|
+
await shutdownStoreAndExit(store);
|
|
391330
391369
|
});
|
|
391331
391370
|
var otherOptionsGroup = "Others:";
|
|
391332
391371
|
program5.optionsGroup(otherOptionsGroup).version(package_default.version, "-V, --version", "Print the version string.").addHelpOption(new Option2("-h, --help", "Print this help message.").helpGroup(otherOptionsGroup)).configureHelp({
|
|
@@ -391334,6 +391373,11 @@ program5.optionsGroup(otherOptionsGroup).version(package_default.version, "-V, -
|
|
|
391334
391373
|
}).showHelpAfterError().showSuggestionAfterError().configureOutput({
|
|
391335
391374
|
outputError: (str, write5) => write5(source_default.red(str))
|
|
391336
391375
|
});
|
|
391376
|
+
program5.hook("preAction", async () => {
|
|
391377
|
+
try {
|
|
391378
|
+
await checkForUpdates();
|
|
391379
|
+
} catch {}
|
|
391380
|
+
});
|
|
391337
391381
|
registerAuthCommand(program5);
|
|
391338
391382
|
registerModelCommand(program5);
|
|
391339
391383
|
registerMcpCommand(program5);
|