@getpochi/cli 0.5.25 → 0.5.27
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 +235 -197
- 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;
|
|
@@ -352296,7 +352296,7 @@ var {
|
|
|
352296
352296
|
// package.json
|
|
352297
352297
|
var package_default = {
|
|
352298
352298
|
name: "@getpochi/cli",
|
|
352299
|
-
version: "0.5.
|
|
352299
|
+
version: "0.5.27",
|
|
352300
352300
|
type: "module",
|
|
352301
352301
|
bin: {
|
|
352302
352302
|
pochi: "src/cli.ts"
|
|
@@ -363999,6 +363999,23 @@ async function loadAgents(workingDirectory) {
|
|
|
363999
363999
|
}
|
|
364000
364000
|
}
|
|
364001
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
|
+
|
|
364002
364019
|
// src/lib/workflow-loader.ts
|
|
364003
364020
|
import * as fs6 from "node:fs/promises";
|
|
364004
364021
|
import * as path9 from "node:path";
|
|
@@ -387494,6 +387511,23 @@ class Chat extends AbstractChat {
|
|
|
387494
387511
|
return this.state;
|
|
387495
387512
|
}
|
|
387496
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
|
+
|
|
387497
387531
|
// src/task/list.ts
|
|
387498
387532
|
function registerTaskListCommand(taskCommand) {
|
|
387499
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) => {
|
|
@@ -387542,7 +387576,7 @@ ${formatTaskDescription(task, false)}`);
|
|
|
387542
387576
|
return taskCommand.error(`Failed to list tasks: ${error44 instanceof Error ? error44.message : "Unknown error"}`);
|
|
387543
387577
|
}
|
|
387544
387578
|
} finally {
|
|
387545
|
-
await store
|
|
387579
|
+
await shutdownStoreAndExit2(store);
|
|
387546
387580
|
}
|
|
387547
387581
|
});
|
|
387548
387582
|
}
|
|
@@ -387627,7 +387661,7 @@ function registerTaskShareCommand(taskCommand) {
|
|
|
387627
387661
|
} else {
|
|
387628
387662
|
console.log(source_default2.red("❌ No share URL found for this task"));
|
|
387629
387663
|
}
|
|
387630
|
-
await store
|
|
387664
|
+
await shutdownStoreAndExit2(store);
|
|
387631
387665
|
});
|
|
387632
387666
|
}
|
|
387633
387667
|
|
|
@@ -387710,12 +387744,12 @@ function toTaskError(error44) {
|
|
|
387710
387744
|
}
|
|
387711
387745
|
|
|
387712
387746
|
// ../livekit/src/chat/llm/generate-task-title.ts
|
|
387713
|
-
var
|
|
387747
|
+
var logger15 = getLogger("generateTaskTitle");
|
|
387714
387748
|
async function generateTaskTitle(options4) {
|
|
387715
387749
|
const { title } = options4;
|
|
387716
387750
|
const newTitle = await generateTaskTitleImpl(options4);
|
|
387717
387751
|
if (newTitle !== undefined) {
|
|
387718
|
-
|
|
387752
|
+
logger15.debug(`Generating task title, old: ${title}, new: ${newTitle}`);
|
|
387719
387753
|
}
|
|
387720
387754
|
return newTitle;
|
|
387721
387755
|
}
|
|
@@ -387742,7 +387776,7 @@ async function generateTaskTitleImpl({
|
|
|
387742
387776
|
return title2;
|
|
387743
387777
|
}
|
|
387744
387778
|
} catch (err2) {
|
|
387745
|
-
|
|
387779
|
+
logger15.warn("Failed to generate title", err2);
|
|
387746
387780
|
}
|
|
387747
387781
|
}
|
|
387748
387782
|
if (title === null) {
|
|
@@ -387788,7 +387822,7 @@ async function generateTitle2(model3, inputMessages, abortSignal) {
|
|
|
387788
387822
|
}
|
|
387789
387823
|
|
|
387790
387824
|
// ../livekit/src/chat/background-job/manager.ts
|
|
387791
|
-
var
|
|
387825
|
+
var logger16 = getLogger("BackgroundJobManager");
|
|
387792
387826
|
|
|
387793
387827
|
class BackgroundJobManager {
|
|
387794
387828
|
jobs = Promise.resolve();
|
|
@@ -387802,7 +387836,7 @@ class BackgroundJobManager {
|
|
|
387802
387836
|
}
|
|
387803
387837
|
this.pendingJobs.delete(nextJob.id);
|
|
387804
387838
|
return nextJob.process().catch((error44) => {
|
|
387805
|
-
|
|
387839
|
+
logger16.error(`Failed to process job for task ${nextJob.id}`, error44);
|
|
387806
387840
|
});
|
|
387807
387841
|
});
|
|
387808
387842
|
job.waitUntil?.(this.jobs);
|
|
@@ -387811,7 +387845,7 @@ class BackgroundJobManager {
|
|
|
387811
387845
|
var backgroundJobManager = new BackgroundJobManager;
|
|
387812
387846
|
|
|
387813
387847
|
// ../livekit/src/chat/background-job/generate-title.ts
|
|
387814
|
-
var
|
|
387848
|
+
var logger17 = getLogger("GenerateTitleManager");
|
|
387815
387849
|
function scheduleGenerateTitleJob(job) {
|
|
387816
387850
|
backgroundJobManager.push({
|
|
387817
387851
|
id: `generate-title-${job.taskId}`,
|
|
@@ -387827,7 +387861,7 @@ async function process15({
|
|
|
387827
387861
|
}) {
|
|
387828
387862
|
const task = store.query(makeTaskQuery(taskId));
|
|
387829
387863
|
if (!task) {
|
|
387830
|
-
|
|
387864
|
+
logger17.warn(`Task not found for title generation: ${taskId}`);
|
|
387831
387865
|
return;
|
|
387832
387866
|
}
|
|
387833
387867
|
const newTitle = await generateTaskTitle({
|
|
@@ -387844,7 +387878,7 @@ async function process15({
|
|
|
387844
387878
|
}
|
|
387845
387879
|
}
|
|
387846
387880
|
// ../livekit/src/chat/llm/repair-tool-call.ts
|
|
387847
|
-
var
|
|
387881
|
+
var logger18 = getLogger("RepairToolCall");
|
|
387848
387882
|
var makeRepairToolCall = (model3) => async ({ toolCall, inputSchema, error: error44 }) => {
|
|
387849
387883
|
if (NoSuchToolError.isInstance(error44)) {
|
|
387850
387884
|
return null;
|
|
@@ -387888,11 +387922,11 @@ var makeRepairToolCall = (model3) => async ({ toolCall, inputSchema, error: erro
|
|
|
387888
387922
|
maxRetries: 0
|
|
387889
387923
|
});
|
|
387890
387924
|
const input2 = await result2.text;
|
|
387891
|
-
|
|
387925
|
+
logger18.debug("Repairing tool call:", toolCall.toolName, input2);
|
|
387892
387926
|
return { ...toolCall, input: input2 };
|
|
387893
387927
|
};
|
|
387894
387928
|
// ../livekit/src/chat/llm/compact-task.ts
|
|
387895
|
-
var
|
|
387929
|
+
var logger19 = getLogger("compactTask");
|
|
387896
387930
|
async function compactTask({
|
|
387897
387931
|
model: model3,
|
|
387898
387932
|
messages: messages2,
|
|
@@ -387914,7 +387948,7 @@ async function compactTask({
|
|
|
387914
387948
|
}
|
|
387915
387949
|
return text12;
|
|
387916
387950
|
} catch (err2) {
|
|
387917
|
-
|
|
387951
|
+
logger19.warn("Failed to create summary", err2);
|
|
387918
387952
|
}
|
|
387919
387953
|
}
|
|
387920
387954
|
async function createSummary(model3, abortSignal, inputMessages) {
|
|
@@ -388551,20 +388585,7 @@ function createAiGatewayModel(llm) {
|
|
|
388551
388585
|
});
|
|
388552
388586
|
}
|
|
388553
388587
|
|
|
388554
|
-
// ../
|
|
388555
|
-
function createGoogleVertexTuningModel(llm) {
|
|
388556
|
-
const vertexModel = createVertexModel(llm.vertex, llm.modelId);
|
|
388557
|
-
return wrapLanguageModel({
|
|
388558
|
-
model: vertexModel,
|
|
388559
|
-
middleware: {
|
|
388560
|
-
middlewareVersion: "v2",
|
|
388561
|
-
async transformParams({ params: params2 }) {
|
|
388562
|
-
params2.maxOutputTokens = llm.maxOutputTokens;
|
|
388563
|
-
return params2;
|
|
388564
|
-
}
|
|
388565
|
-
}
|
|
388566
|
-
});
|
|
388567
|
-
}
|
|
388588
|
+
// ../common/src/google-vertex-utils.ts
|
|
388568
388589
|
function createPatchedFetchForFinetune(accessToken) {
|
|
388569
388590
|
function patchString(str) {
|
|
388570
388591
|
return str.replace("/publishers/google/models", "/endpoints");
|
|
@@ -388596,7 +388617,7 @@ function createPatchedFetchForFinetune(accessToken) {
|
|
|
388596
388617
|
};
|
|
388597
388618
|
}
|
|
388598
388619
|
function createVertexModel(vertex2, modelId) {
|
|
388599
|
-
const getBaseURL2 = (location3, projectId) => `https
|
|
388620
|
+
const getBaseURL2 = (location3, projectId) => `https://${location3}-aiplatform.googleapis.com/v1/projects/${projectId}/locations/${location3}/publishers/google`;
|
|
388600
388621
|
if ("serviceAccountKey" in vertex2) {
|
|
388601
388622
|
const service_account_key = JSON.parse(vertex2.serviceAccountKey);
|
|
388602
388623
|
const location3 = vertex2.location;
|
|
@@ -388625,6 +388646,21 @@ function createVertexModel(vertex2, modelId) {
|
|
|
388625
388646
|
return;
|
|
388626
388647
|
}
|
|
388627
388648
|
|
|
388649
|
+
// ../livekit/src/chat/models/google-vertex-tuning.ts
|
|
388650
|
+
function createGoogleVertexTuningModel(llm) {
|
|
388651
|
+
const vertexModel = createVertexModel(llm.vertex, llm.modelId);
|
|
388652
|
+
return wrapLanguageModel({
|
|
388653
|
+
model: vertexModel,
|
|
388654
|
+
middleware: {
|
|
388655
|
+
middlewareVersion: "v2",
|
|
388656
|
+
async transformParams({ params: params2 }) {
|
|
388657
|
+
params2.maxOutputTokens = llm.maxOutputTokens;
|
|
388658
|
+
return params2;
|
|
388659
|
+
}
|
|
388660
|
+
}
|
|
388661
|
+
});
|
|
388662
|
+
}
|
|
388663
|
+
|
|
388628
388664
|
// ../../node_modules/@ai-sdk/openai-compatible/dist/index.mjs
|
|
388629
388665
|
function getOpenAIMetadata(message) {
|
|
388630
388666
|
var _a21, _b9;
|
|
@@ -389834,7 +389870,7 @@ function createOpenAICompatible(options4) {
|
|
|
389834
389870
|
}
|
|
389835
389871
|
|
|
389836
389872
|
// ../livekit/src/chat/models/openai.ts
|
|
389837
|
-
var
|
|
389873
|
+
var logger20 = getLogger("openai");
|
|
389838
389874
|
var OpenAIRequestParamsSchema = exports_external.object({
|
|
389839
389875
|
max_tokens: exports_external.number().positive().optional(),
|
|
389840
389876
|
max_completion_tokens: exports_external.number().positive().optional()
|
|
@@ -389883,7 +389919,7 @@ function overrideMaxOutputToken(body3) {
|
|
|
389883
389919
|
const json9 = JSON.parse(body3);
|
|
389884
389920
|
const result2 = OpenAIRequestParamsSchema.safeParse(json9);
|
|
389885
389921
|
if (!result2.success) {
|
|
389886
|
-
|
|
389922
|
+
logger20.error("OpenAI request body validation failed:", result2.error);
|
|
389887
389923
|
return;
|
|
389888
389924
|
}
|
|
389889
389925
|
const parsed = result2.data;
|
|
@@ -389892,7 +389928,7 @@ function overrideMaxOutputToken(body3) {
|
|
|
389892
389928
|
}
|
|
389893
389929
|
return JSON.stringify(parsed);
|
|
389894
389930
|
} catch (error44) {
|
|
389895
|
-
|
|
389931
|
+
logger20.error("Failed to parse OpenAI request body:", error44);
|
|
389896
389932
|
}
|
|
389897
389933
|
return;
|
|
389898
389934
|
}
|
|
@@ -390042,7 +390078,7 @@ function estimateTotalTokens(messages2) {
|
|
|
390042
390078
|
}
|
|
390043
390079
|
|
|
390044
390080
|
// ../livekit/src/chat/live-chat-kit.ts
|
|
390045
|
-
var
|
|
390081
|
+
var logger21 = getLogger("LiveChatKit");
|
|
390046
390082
|
|
|
390047
390083
|
class LiveChatKit {
|
|
390048
390084
|
taskId;
|
|
@@ -390098,7 +390134,7 @@ class LiveChatKit {
|
|
|
390098
390134
|
inline: true
|
|
390099
390135
|
});
|
|
390100
390136
|
} catch (err2) {
|
|
390101
|
-
|
|
390137
|
+
logger21.error("Failed to compact task", err2);
|
|
390102
390138
|
throw err2;
|
|
390103
390139
|
}
|
|
390104
390140
|
}
|
|
@@ -390218,7 +390254,7 @@ class LiveChatKit {
|
|
|
390218
390254
|
}));
|
|
390219
390255
|
};
|
|
390220
390256
|
onError = (error44) => {
|
|
390221
|
-
|
|
390257
|
+
logger21.error("onError", error44);
|
|
390222
390258
|
const lastMessage = this.chat.messages.at(-1) || null;
|
|
390223
390259
|
this.store.commit(events.chatStreamFailed({
|
|
390224
390260
|
id: this.taskId,
|
|
@@ -390311,7 +390347,7 @@ import * as nodePath from "node:path";
|
|
|
390311
390347
|
|
|
390312
390348
|
// ../common/src/diff-utils.ts
|
|
390313
390349
|
var import_fast_levenshtein = __toESM(require_levenshtein(), 1);
|
|
390314
|
-
var
|
|
390350
|
+
var logger22 = getLogger("diffUtils");
|
|
390315
390351
|
function normalize6(content3) {
|
|
390316
390352
|
return content3.replace(/\r\n/g, `
|
|
390317
390353
|
`).trimEnd();
|
|
@@ -390324,7 +390360,7 @@ class DiffError extends Error {
|
|
|
390324
390360
|
}
|
|
390325
390361
|
}
|
|
390326
390362
|
async function parseDiffAndApply(fileContent, searchContent, replaceContent, expectedReplacements = 1) {
|
|
390327
|
-
|
|
390363
|
+
logger22.trace(`Applying diff with expectedReplacements: ${expectedReplacements}`);
|
|
390328
390364
|
const isCRLF = fileContent.includes(`\r
|
|
390329
390365
|
`);
|
|
390330
390366
|
const normalizedFileContent = normalize6(fileContent);
|
|
@@ -390341,11 +390377,11 @@ async function parseDiffAndApply(fileContent, searchContent, replaceContent, exp
|
|
|
390341
390377
|
const matches2 = searchContentExact(normalizedFileContent, normalizedSearchContent);
|
|
390342
390378
|
if (matches2.length < expectedReplacements) {
|
|
390343
390379
|
matches2.push(...searchContentWithLineTrimmed(normalizedFileContent, normalizedSearchContent));
|
|
390344
|
-
|
|
390380
|
+
logger22.trace(`Found ${matches2.length} matches after line trimming search strategy`);
|
|
390345
390381
|
}
|
|
390346
390382
|
if (matches2.length < expectedReplacements) {
|
|
390347
390383
|
matches2.push(...searchContentByBlockAnchor(normalizedFileContent, normalizedSearchContent));
|
|
390348
|
-
|
|
390384
|
+
logger22.trace(`Found ${matches2.length} matches after block anchor search strategy`);
|
|
390349
390385
|
}
|
|
390350
390386
|
if (matches2.length === 0) {
|
|
390351
390387
|
throw new DiffError("Search content does not match the file content. Try to reread the file for the latest content.");
|
|
@@ -390354,7 +390390,7 @@ async function parseDiffAndApply(fileContent, searchContent, replaceContent, exp
|
|
|
390354
390390
|
throw new DiffError(`Expected ${expectedReplacements} occurrences but found ${matches2.length}. Please verify the search content and expectedReplacements parameter.`);
|
|
390355
390391
|
}
|
|
390356
390392
|
const result2 = replaceMatches(normalizedFileContent, matches2, replaceContent);
|
|
390357
|
-
|
|
390393
|
+
logger22.trace("Successfully applied diff");
|
|
390358
390394
|
if (isCRLF) {
|
|
390359
390395
|
return result2.replace(/\n/g, `\r
|
|
390360
390396
|
`);
|
|
@@ -390708,11 +390744,11 @@ var readFile13 = (context15) => async ({ path: path24, startLine, endLine }) =>
|
|
|
390708
390744
|
|
|
390709
390745
|
// src/tools/search-files.ts
|
|
390710
390746
|
import * as fs14 from "node:fs";
|
|
390711
|
-
var
|
|
390747
|
+
var logger23 = getLogger("searchFiles");
|
|
390712
390748
|
var searchFiles2 = (context15) => async ({ path: path24, regex: regex3, filePattern }, { abortSignal }) => {
|
|
390713
390749
|
const rgPath = context15.rg;
|
|
390714
390750
|
if (!rgPath || !fs14.existsSync(rgPath)) {
|
|
390715
|
-
|
|
390751
|
+
logger23.error("Ripgrep not found at path", rgPath);
|
|
390716
390752
|
throw new Error(`Ripgrep not found at path: ${rgPath}`);
|
|
390717
390753
|
}
|
|
390718
390754
|
return await searchFilesWithRipgrep(path24, regex3, rgPath, context15.cwd, filePattern, abortSignal);
|
|
@@ -390783,7 +390819,7 @@ function toErrorString(e11) {
|
|
|
390783
390819
|
}
|
|
390784
390820
|
|
|
390785
390821
|
// src/task-runner.ts
|
|
390786
|
-
var
|
|
390822
|
+
var logger24 = getLogger("TaskRunner");
|
|
390787
390823
|
|
|
390788
390824
|
class TaskRunner {
|
|
390789
390825
|
toolCallOptions;
|
|
@@ -390848,9 +390884,9 @@ class TaskRunner {
|
|
|
390848
390884
|
return this.chatKit.task?.shareId;
|
|
390849
390885
|
}
|
|
390850
390886
|
async run() {
|
|
390851
|
-
|
|
390887
|
+
logger24.debug("Starting TaskRunner...");
|
|
390852
390888
|
try {
|
|
390853
|
-
|
|
390889
|
+
logger24.trace("Start step loop.");
|
|
390854
390890
|
this.stepCount.reset();
|
|
390855
390891
|
while (true) {
|
|
390856
390892
|
const stepResult = await this.step();
|
|
@@ -390865,7 +390901,7 @@ class TaskRunner {
|
|
|
390865
390901
|
}
|
|
390866
390902
|
} catch (e11) {
|
|
390867
390903
|
const error44 = toError2(e11);
|
|
390868
|
-
|
|
390904
|
+
logger24.trace("Failed:", error44);
|
|
390869
390905
|
}
|
|
390870
390906
|
}
|
|
390871
390907
|
async step() {
|
|
@@ -390903,24 +390939,24 @@ class TaskRunner {
|
|
|
390903
390939
|
throw new Error("Task is not loaded");
|
|
390904
390940
|
}
|
|
390905
390941
|
if ((task.status === "completed" || task.status === "pending-input") && isResultMessage(message)) {
|
|
390906
|
-
|
|
390942
|
+
logger24.trace("Task is completed or pending input, no more steps to process.");
|
|
390907
390943
|
return "finished";
|
|
390908
390944
|
}
|
|
390909
390945
|
if (task.status === "failed") {
|
|
390910
390946
|
if (task.error?.kind === "APICallError" && !task.error.isRetryable) {
|
|
390911
390947
|
return "finished";
|
|
390912
390948
|
}
|
|
390913
|
-
|
|
390949
|
+
logger24.error("Task is failed, trying to resend last message to resume it.", task.error);
|
|
390914
390950
|
return "retry";
|
|
390915
390951
|
}
|
|
390916
390952
|
if (message.role !== "assistant") {
|
|
390917
|
-
|
|
390953
|
+
logger24.trace("Last message is not a assistant message, resending it to resume the task.");
|
|
390918
390954
|
return "retry";
|
|
390919
390955
|
}
|
|
390920
390956
|
if (isAssistantMessageWithEmptyParts(message) || isAssistantMessageWithPartialToolCalls(message) || isAssistantMessageWithOutputError(message) || lastAssistantMessageIsCompleteWithToolCalls({
|
|
390921
390957
|
messages: this.chat.messages
|
|
390922
390958
|
})) {
|
|
390923
|
-
|
|
390959
|
+
logger24.trace("Last message is assistant with empty parts or partial/completed tool calls, resending it to resume the task.");
|
|
390924
390960
|
const processed = prepareLastMessageForRetry(message);
|
|
390925
390961
|
if (processed) {
|
|
390926
390962
|
this.chat.appendOrReplaceMessage(processed);
|
|
@@ -390928,28 +390964,28 @@ class TaskRunner {
|
|
|
390928
390964
|
return "retry";
|
|
390929
390965
|
}
|
|
390930
390966
|
if (isAssistantMessageWithNoToolCalls(message)) {
|
|
390931
|
-
|
|
390967
|
+
logger24.trace("Last message is assistant with no tool calls, sending a new user reminder.");
|
|
390932
390968
|
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."));
|
|
390933
390969
|
this.chat.appendOrReplaceMessage(message2);
|
|
390934
390970
|
return "next";
|
|
390935
390971
|
}
|
|
390936
390972
|
}
|
|
390937
390973
|
async processToolCalls(message) {
|
|
390938
|
-
|
|
390974
|
+
logger24.trace("Processing tool calls in the last message.");
|
|
390939
390975
|
for (const toolCall of message.parts.filter(isToolUIPart)) {
|
|
390940
390976
|
if (toolCall.state !== "input-available")
|
|
390941
390977
|
continue;
|
|
390942
390978
|
const toolName = getToolName(toolCall);
|
|
390943
|
-
|
|
390979
|
+
logger24.trace(`Found tool call: ${toolName} with args: ${JSON.stringify(toolCall.input)}`);
|
|
390944
390980
|
const toolResult = await executeToolCall(toolCall, this.toolCallOptions);
|
|
390945
390981
|
this.chatKit.chat.addToolResult({
|
|
390946
390982
|
tool: toolName,
|
|
390947
390983
|
toolCallId: toolCall.toolCallId,
|
|
390948
390984
|
output: toolResult
|
|
390949
390985
|
});
|
|
390950
|
-
|
|
390986
|
+
logger24.trace(`Tool call result: ${JSON.stringify(toolResult)}`);
|
|
390951
390987
|
}
|
|
390952
|
-
|
|
390988
|
+
logger24.trace("All tool calls processed in the last message.");
|
|
390953
390989
|
return "next";
|
|
390954
390990
|
}
|
|
390955
390991
|
}
|
|
@@ -391118,7 +391154,7 @@ ${contents}`);
|
|
|
391118
391154
|
}
|
|
391119
391155
|
return extractedBinary;
|
|
391120
391156
|
}
|
|
391121
|
-
async function downloadAndInstall(release2) {
|
|
391157
|
+
async function downloadAndInstall(program5, release2) {
|
|
391122
391158
|
try {
|
|
391123
391159
|
const binaryName = getPlatformBinaryName();
|
|
391124
391160
|
const asset = release2.assets.find((asset2) => {
|
|
@@ -391167,13 +391203,14 @@ async function downloadAndInstall(release2) {
|
|
|
391167
391203
|
console.log(source_default2.gray("Or create an alias:"));
|
|
391168
391204
|
console.log(source_default2.white(` alias pochi="${latestBinaryPath}"`));
|
|
391169
391205
|
} catch (error44) {
|
|
391170
|
-
|
|
391206
|
+
const message = error44 instanceof Error ? error44.message : String(error44);
|
|
391207
|
+
program5.error(`Failed to install update: ${message}`);
|
|
391171
391208
|
}
|
|
391172
391209
|
}
|
|
391173
391210
|
// package.json
|
|
391174
391211
|
var package_default2 = {
|
|
391175
391212
|
name: "@getpochi/cli",
|
|
391176
|
-
version: "0.5.
|
|
391213
|
+
version: "0.5.27",
|
|
391177
391214
|
type: "module",
|
|
391178
391215
|
bin: {
|
|
391179
391216
|
pochi: "src/cli.ts"
|
|
@@ -391276,25 +391313,26 @@ function registerUpgradeCommand(program5) {
|
|
|
391276
391313
|
console.log(`Current version: ${currentVersion}`);
|
|
391277
391314
|
if (updateAvailable) {
|
|
391278
391315
|
console.log(source_default2.green(`A new version (${latestVersion}) is available!`));
|
|
391279
|
-
await downloadAndInstall(latestRelease);
|
|
391316
|
+
await downloadAndInstall(program5, latestRelease);
|
|
391280
391317
|
} else {
|
|
391281
391318
|
console.log(source_default2.green("You are already on the latest version."));
|
|
391282
391319
|
}
|
|
391283
391320
|
} catch (error44) {
|
|
391284
|
-
|
|
391321
|
+
const message = error44 instanceof Error ? error44.message : String(error44);
|
|
391322
|
+
return program5.error(`Failed to check for updates: ${message}`);
|
|
391285
391323
|
}
|
|
391286
391324
|
});
|
|
391287
391325
|
}
|
|
391288
391326
|
// src/cli.ts
|
|
391289
|
-
var
|
|
391290
|
-
|
|
391327
|
+
var logger25 = getLogger("Pochi");
|
|
391328
|
+
logger25.debug(`pochi v${package_default.version}`);
|
|
391291
391329
|
var parsePositiveInt = (input2) => {
|
|
391292
391330
|
if (!input2) {
|
|
391293
|
-
return program5.error("
|
|
391331
|
+
return program5.error("The value for this option must be a positive integer.");
|
|
391294
391332
|
}
|
|
391295
391333
|
const result2 = Number.parseInt(input2);
|
|
391296
391334
|
if (Number.isNaN(result2) || result2 <= 0) {
|
|
391297
|
-
return program5.error("
|
|
391335
|
+
return program5.error("The value for this option must be a positive integer.");
|
|
391298
391336
|
}
|
|
391299
391337
|
return result2;
|
|
391300
391338
|
};
|
|
@@ -391304,7 +391342,7 @@ var program5 = new Command().name("pochi").description(`${source_default.bold("P
|
|
|
391304
391342
|
const llm = await createLLMConfig(program5, options4);
|
|
391305
391343
|
const rg2 = findRipgrep();
|
|
391306
391344
|
if (!rg2) {
|
|
391307
|
-
return program5.error("ripgrep is
|
|
391345
|
+
return program5.error("ripgrep is not installed or not found in your $PATH. Please install it to continue.");
|
|
391308
391346
|
}
|
|
391309
391347
|
const onSubTaskCreated = (runner2) => {
|
|
391310
391348
|
renderer.renderSubTask(runner2);
|
|
@@ -391324,14 +391362,14 @@ var program5 = new Command().name("pochi").description(`${source_default.bold("P
|
|
|
391324
391362
|
});
|
|
391325
391363
|
const renderer = new OutputRenderer(runner.state);
|
|
391326
391364
|
await runner.run();
|
|
391327
|
-
renderer.shutdown();
|
|
391328
391365
|
const shareId = runner.shareId;
|
|
391329
391366
|
if (shareId) {
|
|
391330
391367
|
const shareUrl = source_default.underline(`https://app.getpochi.com/share/${shareId}`);
|
|
391331
391368
|
console.log(`
|
|
391332
391369
|
${source_default.bold("Task link: ")} ${shareUrl}`);
|
|
391333
391370
|
}
|
|
391334
|
-
|
|
391371
|
+
renderer.shutdown();
|
|
391372
|
+
await shutdownStoreAndExit(store);
|
|
391335
391373
|
});
|
|
391336
391374
|
var otherOptionsGroup = "Others:";
|
|
391337
391375
|
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({
|
|
@@ -391364,7 +391402,7 @@ async function parseTaskInput(options4, program6) {
|
|
|
391364
391402
|
}
|
|
391365
391403
|
}
|
|
391366
391404
|
if (!prompt) {
|
|
391367
|
-
return program6.error("
|
|
391405
|
+
return program6.error("A prompt is required. Please provide one using the --prompt option or by piping input.");
|
|
391368
391406
|
}
|
|
391369
391407
|
if (containsWorkflowReference(prompt)) {
|
|
391370
391408
|
const { prompt: updatedPrompt } = await replaceWorkflowReferences(prompt, process.cwd());
|
|
@@ -391375,7 +391413,7 @@ async function parseTaskInput(options4, program6) {
|
|
|
391375
391413
|
async function createLLMConfig(program6, options4) {
|
|
391376
391414
|
const llm = await createLLMConfigWithVendors(program6, options4) || await createLLMConfigWithPochi(options4) || await createLLMConfigWithProviders(program6, options4);
|
|
391377
391415
|
if (!llm) {
|
|
391378
|
-
return program6.error(`Model ${options4.model} not found
|
|
391416
|
+
return program6.error(`Model '${options4.model}' not found. Please check your configuration or run 'pochi model list' to see available models.`);
|
|
391379
391417
|
}
|
|
391380
391418
|
return llm;
|
|
391381
391419
|
}
|
|
@@ -391389,7 +391427,7 @@ async function createLLMConfigWithVendors(program6, options4) {
|
|
|
391389
391427
|
const models = await vendors[vendorId].fetchModels();
|
|
391390
391428
|
const options5 = models[modelId];
|
|
391391
391429
|
if (!options5) {
|
|
391392
|
-
return program6.error(`Model ${modelId} not found
|
|
391430
|
+
return program6.error(`Model '${modelId}' not found. Please run 'pochi model' to see available models.`);
|
|
391393
391431
|
}
|
|
391394
391432
|
return {
|
|
391395
391433
|
type: "vendor",
|
|
@@ -391430,7 +391468,7 @@ async function createLLMConfigWithProviders(program6, options4) {
|
|
|
391430
391468
|
if (!modelProvider)
|
|
391431
391469
|
return;
|
|
391432
391470
|
if (!modelSetting) {
|
|
391433
|
-
return program6.error(`Model ${options4.model} not found
|
|
391471
|
+
return program6.error(`Model '${options4.model}' not found. Please check your configuration or run 'pochi model' to see available models.`);
|
|
391434
391472
|
}
|
|
391435
391473
|
if (modelProvider.kind === undefined || modelProvider.kind === "openai") {
|
|
391436
391474
|
return {
|