@caplets/core 0.28.1 → 0.29.1
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.d.ts +3 -0
- package/dist/{completion-D9253pYs.js → completion-CcNgCYzl.js} +1 -1
- package/dist/config/paths.d.ts +6 -0
- package/dist/config.d.ts +1 -1
- package/dist/daemon/validation.d.ts +4 -0
- package/dist/index.js +1954 -32
- package/dist/native.js +1 -1
- package/dist/{service-B6YvNthO.js → service-DxPo2KUs.js} +112 -30
- package/dist/update-check/control.d.ts +5 -0
- package/dist/update-check/eligibility.d.ts +14 -0
- package/dist/update-check/index.d.ts +8 -0
- package/dist/update-check/notice.d.ts +13 -0
- package/dist/update-check/refresh.d.ts +9 -0
- package/dist/update-check/registry.d.ts +12 -0
- package/dist/update-check/state.d.ts +58 -0
- package/dist/update-check/version.d.ts +14 -0
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __commonJSMin } from "./rolldown-runtime-CE-6LUnI.js";
|
|
2
|
+
import { $ as redactCodeModeLogText, $n as isJSONRPCRequest, $t as readTokenBundle, A as resolveRemoteMode, At as loadProjectConfig, Bn as ListResourceTemplatesRequestSchema, Bt as discoverCapletFiles, C as CapletsCloudClient, Cn as toJsonSchemaCompat, Ct as ServerRegistry, D as normalizeRemoteProfileHostUrl, Dn as CreateMessageResultSchema, Dt as loadConfigWithSources, E as isCapletsCloudUrl, En as CompleteRequestSchema, Et as loadConfig, F as resolveCapletsServer, Fn as InitializeRequestSchema, Ft as FileVaultStore, G as runCodeMode, Gn as McpError, Gt as markdownStructuredContent, H as codeModeRunInputSchema, Hn as ListRootsResultSchema, Ht as loadCapletFilesFromMap, I as nativeCapletPromptGuidance, In as InitializedNotificationSchema, It as VAULT_MAX_VALUE_BYTES, J as diagnoseCodeModeTypeScript, Jn as SetLevelRequestSchema, Jt as runOAuthFlow, K as CodeModeSessionManager, Kn as ReadResourceRequestSchema, Kt as refreshOAuthTokenBundle, L as nativeCapletToolDescription, Ln as JSONRPCMessageSchema, Lt as validateVaultKeyName, M as controlUrlForBase, Mn as EmptyResultSchema, Mt as vaultBootstrapResolver, N as isLoopbackHost, Nn as ErrorCode, Nt as vaultResolverForAuthDir, O as resolveCapletsRemote, On as CreateMessageResultWithToolsSchema, Ot as loadGlobalConfig, P as parseServerBaseUrl, Pn as GetPromptRequestSchema, Pt as vaultStoreForAuthDir, Q as CodeModeLogStore, Qn as isJSONRPCErrorResponse, Qt as isTokenBundleExpired, R as nativeCapletToolName, Rn as LATEST_PROTOCOL_VERSION, Rt as decryptVaultValue, S as buildProjectSyncManifest, Sn as mergeCapabilities, St as handleServerTool, T as hostedCloudWorkspaceFromRemoteUrl, Tn as CallToolResultSchema, Tt as GoogleDiscoveryManager, U as codeModeRunParamsSchema, Un as ListToolsRequestSchema, Ut as hasRenderableStructuredContent, Vn as ListResourcesRequestSchema, Vt as validateCapletFile, W as emptyCodeModeRunMeta, Wn as LoggingLevelSchema, Wt as markdownCallToolResultContent, X as listCodeModeCallableCaplets, Xn as assertCompleteRequestResourceTemplate, Xt as startOAuthFlow, Y as createCodeModeCapletsApi, Yn as assertCompleteRequestPrompt, Yt as startGenericOAuthFlow, Z as CodeModeJournalStore, Zn as isInitializeRequest, Zt as deleteTokenBundle, _ as attachErrorResponse, _n as serializeMessage, _t as rotateTelemetryIdentity, a as CloudAuthStore, an as defaultCacheBaseDir, ar as isSchemaOptional, at as version, b as invokeAttachExport, bn as AjvJsonSchemaValidator, bt as findProjectRoot, c as redactedCloudAuthStatus, cn as defaultStateBaseDir, cr as objectFromShape, ct as buildProductTelemetryEvent, d as projectBindingError, dn as defaultUpdateCheckStateDir, dt as maybePrintTelemetryNotice, en as DEFAULT_AUTH_DIR, er as isJSONRPCResultResponse, et as codeModeDeclarationHash, f as projectBindingRecovery, fn as resolveCapletsRoot, ft as resolveTelemetryState, g as CAPLETS_ATTACH_SESSION_HEADER, gn as ReadBuffer, gt as readTelemetryNotice, hn as resolveProjectConfigPath, ht as readTelemetryIdentity, i as createRemoteProfileStore, in as DEFAULT_UPDATE_CHECK_STATE_DIR, ir as getSchemaDescription, it as CapletsEngine, j as appendBasePath, jn as ElicitResultSchema, jt as parseConfig, k as resolveHostedCloudRemote, kn as CreateTaskResultSchema, kt as loadLocalOverlayConfigWithSources, l as PROJECT_BINDING_ERROR_CODES, ln as defaultTelemetryStateDir, lr as safeParse, lt as buildReliabilityTelemetryEvent, mn as resolveProjectCapletsRoot, mt as readTelemetryDeliveryHealth, n as resolveRemoteSelection, nn as DEFAULT_OBSERVED_OUTPUT_SHAPE_CACHE_DIR, nr as getObjectShape, nt as generateCodeModeRunToolDescription, o as cloudAuthPath, on as defaultConfigBaseDir, or as isZ4Schema, ot as createTelemetryDispatcher, p as CloudAuthClient, pn as resolveConfigPath, pt as deleteTelemetryIdentity, q as QuickJsCodeModeSandbox, qn as SUPPORTED_PROTOCOL_VERSIONS, qt as runGenericOAuthFlow, r as cloudCredentialsFromRemoteProfile, rn as DEFAULT_UPDATE_CHECK_CACHE_DIR, rr as getParseErrorMessage, rt as minifyCodeModeDeclarationText, s as migrateCredentials, sn as defaultConfigPath, sr as normalizeObjectSchema, st as TelemetryDebugSink, t as createNativeCapletsService, tr as getLiteralValue, tt as generateCodeModeDeclarations, u as ProjectBindingError, un as defaultUpdateCheckCacheDir, ur as safeParseAsync, ut as durationBucket, v as buildAttachProjection, vn as assertClientRequestTaskCapability, vt as resolveExposure, wn as CallToolRequestSchema, wt as capabilityDescription, x as invokeNativeAttachExport, xn as Protocol, xt as fingerprintProjectRoot, y as buildNativeAttachProjection, yn as assertToolsCallTaskCapability, yt as decodeDirectResourceUri, zn as ListPromptsRequestSchema, zt as encryptVaultValue } from "./service-DxPo2KUs.js";
|
|
2
3
|
import { _ as record, b as unknown, d as literal, m as object, n as ZodOptional, o as array, p as number, r as _enum, s as boolean, v as string, x as url } from "./schemas-BoqMu4MG.js";
|
|
3
4
|
import { a as SERVER_ID_PATTERN, d as CapletsError, m as toSafeError, p as redactSecrets$1, u as CAPLETS_ERROR_CODES } from "./validation-CWzd2gtn.js";
|
|
4
5
|
import { generatedToolInputSchema, generatedToolInputSchemaForCaplet } from "./generated-tool-input-schema.js";
|
|
5
6
|
import { f as observedOutputShapeKey, i as observeOutputShape, u as FileObservedOutputShapeStore } from "./observed-output-shapes-DuP7mJQf.js";
|
|
6
|
-
import { a as formatCapletList, c as resolveCliConfigPaths, l as cliCommands$1, n as completionScript, o as formatConfigPaths, s as listCaplets, t as completeCliWords, u as completionShells } from "./completion-
|
|
7
|
+
import { a as formatCapletList, c as resolveCliConfigPaths, l as cliCommands$1, n as completionScript, o as formatConfigPaths, s as listCaplets, t as completeCliWords, u as completionShells } from "./completion-CcNgCYzl.js";
|
|
7
8
|
import { n as normalizeCapletSourcePath, t as FilesystemCapletSource } from "./filesystem-Kkg32TOJ.js";
|
|
8
9
|
import { parseConfig as parseConfig$1 } from "./config-runtime.js";
|
|
9
10
|
import fs, { accessSync, chmodSync, closeSync, constants, copyFileSync, cpSync, existsSync, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, watch, writeFileSync, writeSync } from "node:fs";
|
|
@@ -5895,7 +5896,7 @@ function daemonHostPath(path) {
|
|
|
5895
5896
|
//#endregion
|
|
5896
5897
|
//#region src/daemon/config.ts
|
|
5897
5898
|
function readDaemonConfig(paths) {
|
|
5898
|
-
return readJson(paths.configFile);
|
|
5899
|
+
return readJson$1(paths.configFile);
|
|
5899
5900
|
}
|
|
5900
5901
|
function writeDaemonConfig(paths, config) {
|
|
5901
5902
|
writeJson(paths.configFile, config);
|
|
@@ -5932,7 +5933,7 @@ function mergeDaemonEnv(existing, install) {
|
|
|
5932
5933
|
function validateEnvName(value) {
|
|
5933
5934
|
if (!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(value)) throw new CapletsError("REQUEST_INVALID", `Invalid environment variable name: ${value}`);
|
|
5934
5935
|
}
|
|
5935
|
-
function readJson(path) {
|
|
5936
|
+
function readJson$1(path) {
|
|
5936
5937
|
const hostPath = daemonHostPath(path);
|
|
5937
5938
|
try {
|
|
5938
5939
|
return JSON.parse(readFileSync(hostPath, "utf8"));
|
|
@@ -6103,11 +6104,7 @@ function shellQuote(value) {
|
|
|
6103
6104
|
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
6104
6105
|
}
|
|
6105
6106
|
function serviceCommand(config) {
|
|
6106
|
-
const direct = [
|
|
6107
|
-
process.execPath,
|
|
6108
|
-
config.command.executable,
|
|
6109
|
-
...config.command.args
|
|
6110
|
-
];
|
|
6107
|
+
const direct = [config.command.executable, ...config.command.args];
|
|
6111
6108
|
if (!config.command.shell) return {
|
|
6112
6109
|
executable: direct[0],
|
|
6113
6110
|
args: direct.slice(1),
|
|
@@ -7050,6 +7047,15 @@ function nonEmpty$2(value, label) {
|
|
|
7050
7047
|
return trimmed;
|
|
7051
7048
|
}
|
|
7052
7049
|
//#endregion
|
|
7050
|
+
//#region src/update-check/control.ts
|
|
7051
|
+
const DISABLE_UPDATE_CHECK_ENV = "CAPLETS_DISABLE_UPDATE_CHECK";
|
|
7052
|
+
function isUpdateCheckDisabled(env = process.env) {
|
|
7053
|
+
return env["CAPLETS_DISABLE_UPDATE_CHECK"] === "1" || env["CAPLETS_DISABLE_UPDATE_CHECK"] === "true";
|
|
7054
|
+
}
|
|
7055
|
+
function isUpdateNoticeStderrOptIn(env = process.env) {
|
|
7056
|
+
return env["CAPLETS_UPDATE_NOTICE_STDERR"] === "1" || env["CAPLETS_UPDATE_NOTICE_STDERR"] === "true";
|
|
7057
|
+
}
|
|
7058
|
+
//#endregion
|
|
7053
7059
|
//#region src/daemon/env.ts
|
|
7054
7060
|
function resolveDaemonShell(options) {
|
|
7055
7061
|
const platform = options.platform ?? process.platform;
|
|
@@ -7139,20 +7145,26 @@ function daemonServeArgs(options) {
|
|
|
7139
7145
|
}
|
|
7140
7146
|
function buildDaemonCommandPlan(options) {
|
|
7141
7147
|
const platform = options.operation.platform ?? process.platform;
|
|
7142
|
-
const
|
|
7143
|
-
|
|
7148
|
+
const command = resolveDaemonCommand({
|
|
7149
|
+
env: options.operation.env ?? process.env,
|
|
7150
|
+
platform,
|
|
7151
|
+
scriptPath: process.argv[1],
|
|
7152
|
+
serveArgs: daemonServeArgs(options.serve)
|
|
7153
|
+
});
|
|
7144
7154
|
const workingDirectory = options.operation.home ?? homedir();
|
|
7155
|
+
const serviceEnv = daemonServiceEnv({
|
|
7156
|
+
explicitEnv: options.explicitEnv ?? {},
|
|
7157
|
+
operation: options.operation,
|
|
7158
|
+
platform,
|
|
7159
|
+
serve: options.serve,
|
|
7160
|
+
workingDirectory
|
|
7161
|
+
});
|
|
7162
|
+
if (command.pathEnv && serviceEnv.PATH === void 0 && serviceEnv.Path === void 0 && serviceEnv.path === void 0) serviceEnv.PATH = command.pathEnv;
|
|
7145
7163
|
const base = {
|
|
7146
|
-
executable,
|
|
7147
|
-
args,
|
|
7164
|
+
executable: command.executable,
|
|
7165
|
+
args: command.args,
|
|
7148
7166
|
workingDirectory,
|
|
7149
|
-
env:
|
|
7150
|
-
explicitEnv: options.explicitEnv ?? {},
|
|
7151
|
-
operation: options.operation,
|
|
7152
|
-
platform,
|
|
7153
|
-
serve: options.serve,
|
|
7154
|
-
workingDirectory
|
|
7155
|
-
}),
|
|
7167
|
+
env: serviceEnv,
|
|
7156
7168
|
inheritEnv: options.inheritEnv ?? false,
|
|
7157
7169
|
stdoutLog: options.paths.stdoutLog,
|
|
7158
7170
|
stderrLog: options.paths.stderrLog
|
|
@@ -7173,6 +7185,7 @@ function daemonServiceEnv(options) {
|
|
|
7173
7185
|
...options.explicitEnv
|
|
7174
7186
|
};
|
|
7175
7187
|
if (options.serve.publicOrigin && serviceEnv.CAPLETS_SERVER_URL === void 0) serviceEnv.CAPLETS_SERVER_URL = options.serve.publicOrigin;
|
|
7188
|
+
serviceEnv[DISABLE_UPDATE_CHECK_ENV] = "1";
|
|
7176
7189
|
return serviceEnv;
|
|
7177
7190
|
}
|
|
7178
7191
|
function configSelectionEnv(env, home, platform) {
|
|
@@ -7195,7 +7208,20 @@ function configSelectionEnvKeys(platform) {
|
|
|
7195
7208
|
"XDG_CACHE_HOME"
|
|
7196
7209
|
];
|
|
7197
7210
|
}
|
|
7198
|
-
function
|
|
7211
|
+
function resolveDaemonCommand(options) {
|
|
7212
|
+
const stableCommand = resolvePathCommand("caplets", options.env, options.platform);
|
|
7213
|
+
if (stableCommand) return {
|
|
7214
|
+
executable: stableCommand,
|
|
7215
|
+
args: options.serveArgs,
|
|
7216
|
+
pathEnv: pathEnvValue(options.env)
|
|
7217
|
+
};
|
|
7218
|
+
const script = resolveDaemonCliScript(options.scriptPath);
|
|
7219
|
+
return {
|
|
7220
|
+
executable: process.execPath,
|
|
7221
|
+
args: [script, ...options.serveArgs]
|
|
7222
|
+
};
|
|
7223
|
+
}
|
|
7224
|
+
function resolveDaemonCliScript(scriptPath) {
|
|
7199
7225
|
if (!scriptPath) throw new CapletsError("REQUEST_INVALID", "Cannot install the daemon because the Caplets CLI path could not be resolved.");
|
|
7200
7226
|
const executable = isAbsolute(scriptPath) ? scriptPath : resolve(scriptPath);
|
|
7201
7227
|
if (!existsSync(executable)) throw new CapletsError("REQUEST_INVALID", `Cannot install the daemon because the Caplets CLI path does not exist: ${executable}`);
|
|
@@ -7203,6 +7229,48 @@ function resolveDaemonExecutable(scriptPath) {
|
|
|
7203
7229
|
if (isTransientRunnerPath(executable) || isTransientRunnerPath(realExecutable)) throw new CapletsError("REQUEST_INVALID", "Cannot install the daemon from a temporary runner such as npx or pnpm dlx. Install caplets first, then rerun caplets daemon install.");
|
|
7204
7230
|
return executable;
|
|
7205
7231
|
}
|
|
7232
|
+
function resolvePathCommand(command, env, platform) {
|
|
7233
|
+
const path = pathEnvValue(env);
|
|
7234
|
+
if (!path) return void 0;
|
|
7235
|
+
const delimiter = platform === "win32" ? ";" : ":";
|
|
7236
|
+
for (const entry of path.split(delimiter)) {
|
|
7237
|
+
const directory = entry.trim();
|
|
7238
|
+
if (!directory) continue;
|
|
7239
|
+
for (const candidate of pathCommandCandidates(directory, command, env, platform)) {
|
|
7240
|
+
if (!isRunnableCommand(candidate, platform)) continue;
|
|
7241
|
+
const realCandidate = safeRealpath(candidate);
|
|
7242
|
+
if (isTransientRunnerPath(candidate) || isTransientRunnerPath(realCandidate)) throw new CapletsError("REQUEST_INVALID", "Cannot install the daemon from a temporary runner such as npx or pnpm dlx. Install caplets first, then rerun caplets daemon install.");
|
|
7243
|
+
return candidate;
|
|
7244
|
+
}
|
|
7245
|
+
}
|
|
7246
|
+
}
|
|
7247
|
+
function pathCommandCandidates(directory, command, env, platform) {
|
|
7248
|
+
const resolved = isAbsolute(directory) ? directory : resolve(directory);
|
|
7249
|
+
if (platform !== "win32") return [resolve(resolved, command)];
|
|
7250
|
+
const lower = command.toLocaleLowerCase();
|
|
7251
|
+
if (/\.[^.\\/]+$/u.test(lower)) return [resolve(resolved, command)];
|
|
7252
|
+
return (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").map((value) => value.trim()).filter(Boolean).map((extension) => resolve(resolved, `${command}${extension}`));
|
|
7253
|
+
}
|
|
7254
|
+
function pathEnvValue(env) {
|
|
7255
|
+
return env.PATH ?? env.Path ?? env.path;
|
|
7256
|
+
}
|
|
7257
|
+
function isRunnableCommand(path, platform) {
|
|
7258
|
+
try {
|
|
7259
|
+
if (!statSync(path).isFile()) return false;
|
|
7260
|
+
if (platform === "win32") return true;
|
|
7261
|
+
accessSync(path, constants.X_OK);
|
|
7262
|
+
return true;
|
|
7263
|
+
} catch {
|
|
7264
|
+
return false;
|
|
7265
|
+
}
|
|
7266
|
+
}
|
|
7267
|
+
function safeRealpath(path) {
|
|
7268
|
+
try {
|
|
7269
|
+
return realpathSync(path);
|
|
7270
|
+
} catch {
|
|
7271
|
+
return path;
|
|
7272
|
+
}
|
|
7273
|
+
}
|
|
7206
7274
|
function isTransientRunnerPath(path) {
|
|
7207
7275
|
const normalized = path.replaceAll("\\", "/");
|
|
7208
7276
|
return /(?:^|\/)_npx(?:\/|$)/u.test(normalized) || /(?:^|\/)dlx-[^/]+(?:\/|$)/u.test(normalized);
|
|
@@ -12837,11 +12905,28 @@ function healthUrl(config, port = config.serve.port) {
|
|
|
12837
12905
|
}
|
|
12838
12906
|
function validationSpawnCommand(config) {
|
|
12839
12907
|
const planned = serviceCommand(config);
|
|
12908
|
+
if (isWindowsCommandShim(planned.executable)) {
|
|
12909
|
+
const shell = {
|
|
12910
|
+
executable: "cmd.exe",
|
|
12911
|
+
args: [
|
|
12912
|
+
"/d",
|
|
12913
|
+
"/s",
|
|
12914
|
+
"/c"
|
|
12915
|
+
]
|
|
12916
|
+
};
|
|
12917
|
+
return {
|
|
12918
|
+
command: shell.executable,
|
|
12919
|
+
args: [...shell.args, shellCommandLine(shell, [planned.executable, ...planned.args])]
|
|
12920
|
+
};
|
|
12921
|
+
}
|
|
12840
12922
|
return {
|
|
12841
12923
|
command: planned.executable,
|
|
12842
12924
|
args: planned.args
|
|
12843
12925
|
};
|
|
12844
12926
|
}
|
|
12927
|
+
function isWindowsCommandShim(path) {
|
|
12928
|
+
return /\.(?:bat|cmd)$/iu.test(path);
|
|
12929
|
+
}
|
|
12845
12930
|
async function sleep$2(ms) {
|
|
12846
12931
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
12847
12932
|
}
|
|
@@ -13366,9 +13451,10 @@ async function doctorJsonReport(options = {}) {
|
|
|
13366
13451
|
authMode: remoteLogin.authenticated ? remoteLogin.kind === "cloud" ? "hosted_cloud" : "self_hosted_remote" : remote.configured || remoteLogin.configured ? "remote_login_required" : "unconfigured",
|
|
13367
13452
|
selectedWorkspace: remoteLogin.selectedWorkspace ?? remote.workspace ?? null,
|
|
13368
13453
|
webSocketUrl: remote.webSocketUrl,
|
|
13454
|
+
sessionSupport: remoteLogin.kind === "self-hosted" ? "unsupported" : "unknown",
|
|
13369
13455
|
lease: null,
|
|
13370
13456
|
lastUpgradeError: null,
|
|
13371
|
-
recoveryCommand:
|
|
13457
|
+
recoveryCommand: projectBindingRecovery$1(remoteLogin, remote)
|
|
13372
13458
|
},
|
|
13373
13459
|
sync: {
|
|
13374
13460
|
state: options.syncStatus?.state ?? "idle",
|
|
@@ -13409,6 +13495,7 @@ async function formatDoctorReport(options = {}) {
|
|
|
13409
13495
|
` Auth mode: ${report.projectBinding.authMode}`,
|
|
13410
13496
|
` Selected Workspace: ${report.projectBinding.selectedWorkspace ?? "none"}`,
|
|
13411
13497
|
` Binding Session: ${report.projectBinding.state}`,
|
|
13498
|
+
...report.projectBinding.sessionSupport !== "unknown" ? [` Session support: ${report.projectBinding.sessionSupport}`] : [],
|
|
13412
13499
|
` Recovery: ${report.projectBinding.recoveryCommand}`,
|
|
13413
13500
|
"",
|
|
13414
13501
|
"Project sync",
|
|
@@ -13483,6 +13570,11 @@ function vaultIssueFromWarning(message, path) {
|
|
|
13483
13570
|
recoveryCommand
|
|
13484
13571
|
};
|
|
13485
13572
|
}
|
|
13573
|
+
function projectBindingRecovery$1(remoteLogin, remote) {
|
|
13574
|
+
if (remoteLogin.authenticated) return remoteLogin.kind === "self-hosted" ? "Self-hosted Project Binding sessions are not implemented by this runtime." : "caplets attach --once";
|
|
13575
|
+
if (remote.configured || remoteLogin.configured) return `caplets remote login ${remoteLogin.hostUrl ?? "<url>"}`;
|
|
13576
|
+
return "caplets remote login <url>";
|
|
13577
|
+
}
|
|
13486
13578
|
async function resolveDaemonSection(env, options) {
|
|
13487
13579
|
try {
|
|
13488
13580
|
const status = await daemonStatus({
|
|
@@ -15406,9 +15498,1813 @@ function nativeAttachSession(service) {
|
|
|
15406
15498
|
};
|
|
15407
15499
|
}
|
|
15408
15500
|
//#endregion
|
|
15501
|
+
//#region src/update-check/eligibility.ts
|
|
15502
|
+
function classifyUpdateNoticeEligibility(input) {
|
|
15503
|
+
const env = input.env ?? process.env;
|
|
15504
|
+
const args = input.args;
|
|
15505
|
+
const command = args[0] ?? "";
|
|
15506
|
+
const optedIn = isUpdateNoticeStderrOptIn(env);
|
|
15507
|
+
if (isUpdateCheckDisabled(env)) return {
|
|
15508
|
+
eligible: false,
|
|
15509
|
+
reason: "disabled"
|
|
15510
|
+
};
|
|
15511
|
+
if (args.length === 0) return {
|
|
15512
|
+
eligible: false,
|
|
15513
|
+
reason: "no_args"
|
|
15514
|
+
};
|
|
15515
|
+
if (isHelpOrVersion(args)) return {
|
|
15516
|
+
eligible: false,
|
|
15517
|
+
reason: "help_or_version"
|
|
15518
|
+
};
|
|
15519
|
+
if (command === "completion" || command === "__complete") return {
|
|
15520
|
+
eligible: false,
|
|
15521
|
+
reason: "completion"
|
|
15522
|
+
};
|
|
15523
|
+
if (isOutputProduct(args)) return {
|
|
15524
|
+
eligible: false,
|
|
15525
|
+
reason: "output_product"
|
|
15526
|
+
};
|
|
15527
|
+
if (command === "daemon") return {
|
|
15528
|
+
eligible: false,
|
|
15529
|
+
reason: "daemon"
|
|
15530
|
+
};
|
|
15531
|
+
if (command === "code-mode") return {
|
|
15532
|
+
eligible: false,
|
|
15533
|
+
reason: "code_mode"
|
|
15534
|
+
};
|
|
15535
|
+
if (isCi(env) && !optedIn) return {
|
|
15536
|
+
eligible: false,
|
|
15537
|
+
reason: "ci"
|
|
15538
|
+
};
|
|
15539
|
+
if (!input.stderrIsTTY && !optedIn) return {
|
|
15540
|
+
eligible: false,
|
|
15541
|
+
reason: "noninteractive"
|
|
15542
|
+
};
|
|
15543
|
+
if (command === "attach") return optedIn ? {
|
|
15544
|
+
eligible: true,
|
|
15545
|
+
command
|
|
15546
|
+
} : {
|
|
15547
|
+
eligible: false,
|
|
15548
|
+
reason: "stdio"
|
|
15549
|
+
};
|
|
15550
|
+
if (command === "serve") {
|
|
15551
|
+
const transport = optionValue(args, "--transport");
|
|
15552
|
+
const daemonSubcommand = args[1] && !args[1].startsWith("-") ? args[1] : void 0;
|
|
15553
|
+
if (daemonSubcommand === "start" || daemonSubcommand === "enable") return {
|
|
15554
|
+
eligible: false,
|
|
15555
|
+
reason: "daemon"
|
|
15556
|
+
};
|
|
15557
|
+
if (transport === "http" || transport === "sse") return {
|
|
15558
|
+
eligible: true,
|
|
15559
|
+
command
|
|
15560
|
+
};
|
|
15561
|
+
return optedIn ? {
|
|
15562
|
+
eligible: true,
|
|
15563
|
+
command
|
|
15564
|
+
} : {
|
|
15565
|
+
eligible: false,
|
|
15566
|
+
reason: "stdio"
|
|
15567
|
+
};
|
|
15568
|
+
}
|
|
15569
|
+
return {
|
|
15570
|
+
eligible: true,
|
|
15571
|
+
command
|
|
15572
|
+
};
|
|
15573
|
+
}
|
|
15574
|
+
function isHelpOrVersion(args) {
|
|
15575
|
+
return args.some((arg) => arg === "--help" || arg === "-h" || arg === "--version" || arg === "-V");
|
|
15576
|
+
}
|
|
15577
|
+
function isOutputProduct(args) {
|
|
15578
|
+
if (args.some((arg) => arg === "--json" || arg.toLowerCase() === "--format=json")) return true;
|
|
15579
|
+
if (optionValue(args, "--format")?.toLowerCase() === "json") return true;
|
|
15580
|
+
if (args[0] === "config" && (args[1] === "path" || args[1] === "paths")) return true;
|
|
15581
|
+
if (args[0] === "telemetry" && args[1] === "debug") return true;
|
|
15582
|
+
return false;
|
|
15583
|
+
}
|
|
15584
|
+
function isCi(env) {
|
|
15585
|
+
return isTruthyEnv(env.CI) || isTruthyEnv(env.GITHUB_ACTIONS) || isTruthyEnv(env.BUILDKITE);
|
|
15586
|
+
}
|
|
15587
|
+
function isTruthyEnv(value) {
|
|
15588
|
+
return value === "1" || value === "true";
|
|
15589
|
+
}
|
|
15590
|
+
function optionValue(args, name) {
|
|
15591
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
15592
|
+
const arg = args[index];
|
|
15593
|
+
if (arg === name) return args[index + 1];
|
|
15594
|
+
if (arg?.startsWith(`${name}=`)) return arg.slice(name.length + 1);
|
|
15595
|
+
}
|
|
15596
|
+
}
|
|
15597
|
+
//#endregion
|
|
15598
|
+
//#region src/update-check/state.ts
|
|
15599
|
+
const UPDATE_CHECK_PACKAGE_NAME = "caplets";
|
|
15600
|
+
const UPDATE_CHECK_REGISTRY_URL = "https://registry.npmjs.org/caplets";
|
|
15601
|
+
const UPDATE_CHECK_ACCEPT_HEADER = "application/vnd.npm.install-v1+json";
|
|
15602
|
+
const UPDATE_CHECK_CACHE_TTL_MS = 1440 * 60 * 1e3;
|
|
15603
|
+
const UPDATE_CHECK_MAX_STALE_MS = 10080 * 60 * 1e3;
|
|
15604
|
+
const UPDATE_CHECK_NEGATIVE_TTL_MS = 3600 * 1e3;
|
|
15605
|
+
const UPDATE_CHECK_MAX_RESPONSE_BYTES = 1024 * 1024;
|
|
15606
|
+
function updateCheckCacheDir(options = {}) {
|
|
15607
|
+
return options.cacheDir ?? DEFAULT_UPDATE_CHECK_CACHE_DIR;
|
|
15608
|
+
}
|
|
15609
|
+
function updateCheckStateDir(options = {}) {
|
|
15610
|
+
return options.stateDir ?? DEFAULT_UPDATE_CHECK_STATE_DIR;
|
|
15611
|
+
}
|
|
15612
|
+
function updateMetadataCachePath(options = {}) {
|
|
15613
|
+
return join(updateCheckCacheDir(options), "metadata.json");
|
|
15614
|
+
}
|
|
15615
|
+
function updateRefreshLockPath(options = {}) {
|
|
15616
|
+
return join(updateCheckCacheDir(options), "refresh.lock");
|
|
15617
|
+
}
|
|
15618
|
+
function updateNoticeStatePath(options = {}) {
|
|
15619
|
+
return join(updateCheckStateDir(options), "notice.json");
|
|
15620
|
+
}
|
|
15621
|
+
function readUpdateMetadataCache(options = {}) {
|
|
15622
|
+
const now = options.now ?? Date.now();
|
|
15623
|
+
const parsed = readJson(updateMetadataCachePath(options));
|
|
15624
|
+
if (!parsed) return void 0;
|
|
15625
|
+
if (parsed.status === "positive" && isPackageMetadata(parsed.metadata)) return {
|
|
15626
|
+
...parsed,
|
|
15627
|
+
fresh: now <= parsed.expiresAt,
|
|
15628
|
+
usable: now <= parsed.staleUntil
|
|
15629
|
+
};
|
|
15630
|
+
if (parsed.status === "negative" && typeof parsed.reason === "string") return {
|
|
15631
|
+
...parsed,
|
|
15632
|
+
fresh: now <= parsed.expiresAt,
|
|
15633
|
+
usable: now <= parsed.expiresAt
|
|
15634
|
+
};
|
|
15635
|
+
}
|
|
15636
|
+
function writeUpdateMetadataCache(entry, options = {}) {
|
|
15637
|
+
return writePrivateJson(updateMetadataCachePath(options), entry);
|
|
15638
|
+
}
|
|
15639
|
+
function readUpdateNoticeState(options = {}) {
|
|
15640
|
+
const parsed = readJson(updateNoticeStatePath(options));
|
|
15641
|
+
if (!parsed?.shown || typeof parsed.shown !== "object" || Array.isArray(parsed.shown)) return { shown: {} };
|
|
15642
|
+
const shown = {};
|
|
15643
|
+
for (const [version, value] of Object.entries(parsed.shown)) if (typeof version === "string" && value && typeof value === "object" && !Array.isArray(value) && typeof value.shownAt === "number") shown[version] = { shownAt: value.shownAt };
|
|
15644
|
+
return { shown };
|
|
15645
|
+
}
|
|
15646
|
+
function shouldShowUpdateNotice(version, options = {}) {
|
|
15647
|
+
const now = options.now ?? Date.now();
|
|
15648
|
+
const shownAt = readUpdateNoticeState(options).shown[version]?.shownAt;
|
|
15649
|
+
return shownAt === void 0 || now - shownAt >= 6048e5;
|
|
15650
|
+
}
|
|
15651
|
+
function recordUpdateNoticeShown(version, options = {}) {
|
|
15652
|
+
const now = options.now ?? Date.now();
|
|
15653
|
+
const state = readUpdateNoticeState(options);
|
|
15654
|
+
state.shown[version] = { shownAt: now };
|
|
15655
|
+
return writePrivateJson(updateNoticeStatePath(options), state);
|
|
15656
|
+
}
|
|
15657
|
+
function acquireUpdateRefreshLock(options = {}) {
|
|
15658
|
+
const now = options.now ?? Date.now();
|
|
15659
|
+
const path = updateRefreshLockPath(options);
|
|
15660
|
+
if (createUpdateRefreshLock(path, now)) return true;
|
|
15661
|
+
const existing = readJson(path);
|
|
15662
|
+
if (typeof existing?.lockedAt === "number" && now - existing.lockedAt < 6e4) return false;
|
|
15663
|
+
if (!existing && !existsSync(path)) return false;
|
|
15664
|
+
try {
|
|
15665
|
+
rmSync(path, { force: true });
|
|
15666
|
+
} catch {
|
|
15667
|
+
return false;
|
|
15668
|
+
}
|
|
15669
|
+
return createUpdateRefreshLock(path, now);
|
|
15670
|
+
}
|
|
15671
|
+
function releaseUpdateRefreshLock(options = {}) {
|
|
15672
|
+
try {
|
|
15673
|
+
rmSync(updateRefreshLockPath(options), { force: true });
|
|
15674
|
+
} catch {}
|
|
15675
|
+
}
|
|
15676
|
+
function writePrivateJson(path, value) {
|
|
15677
|
+
try {
|
|
15678
|
+
mkdirSync(dirname(path), {
|
|
15679
|
+
recursive: true,
|
|
15680
|
+
mode: 448
|
|
15681
|
+
});
|
|
15682
|
+
const tmp = `${path}.${process.pid}.${randomUUID()}.tmp`;
|
|
15683
|
+
writeFileSync(tmp, `${JSON.stringify(value, null, 2)}\n`, { mode: 384 });
|
|
15684
|
+
renameSync(tmp, path);
|
|
15685
|
+
return true;
|
|
15686
|
+
} catch {
|
|
15687
|
+
return false;
|
|
15688
|
+
}
|
|
15689
|
+
}
|
|
15690
|
+
function createUpdateRefreshLock(path, now) {
|
|
15691
|
+
let fd;
|
|
15692
|
+
try {
|
|
15693
|
+
mkdirSync(dirname(path), {
|
|
15694
|
+
recursive: true,
|
|
15695
|
+
mode: 448
|
|
15696
|
+
});
|
|
15697
|
+
fd = openSync(path, "wx", 384);
|
|
15698
|
+
writeFileSync(fd, `${JSON.stringify({ lockedAt: now }, null, 2)}\n`);
|
|
15699
|
+
return true;
|
|
15700
|
+
} catch {
|
|
15701
|
+
return false;
|
|
15702
|
+
} finally {
|
|
15703
|
+
if (fd !== void 0) try {
|
|
15704
|
+
closeSync(fd);
|
|
15705
|
+
} catch {}
|
|
15706
|
+
}
|
|
15707
|
+
}
|
|
15708
|
+
function readJson(path) {
|
|
15709
|
+
if (!existsSync(path)) return void 0;
|
|
15710
|
+
try {
|
|
15711
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
15712
|
+
} catch {
|
|
15713
|
+
return;
|
|
15714
|
+
}
|
|
15715
|
+
}
|
|
15716
|
+
function isPackageMetadata(value) {
|
|
15717
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value) && value.packageName === "caplets" && typeof value.distTags === "object" && !Array.isArray(value.distTags) && Array.isArray(value.versions);
|
|
15718
|
+
}
|
|
15719
|
+
//#endregion
|
|
15720
|
+
//#region src/update-check/registry.ts
|
|
15721
|
+
var UpdateRegistryError = class extends Error {
|
|
15722
|
+
reason;
|
|
15723
|
+
constructor(message, reason) {
|
|
15724
|
+
super(message);
|
|
15725
|
+
this.reason = reason;
|
|
15726
|
+
this.name = "UpdateRegistryError";
|
|
15727
|
+
}
|
|
15728
|
+
};
|
|
15729
|
+
async function fetchPublicCapletsMetadata(options) {
|
|
15730
|
+
const fetcher = options.fetcher ?? fetch;
|
|
15731
|
+
const controller = new AbortController();
|
|
15732
|
+
const timeout = setTimeout(() => controller.abort(), options.timeoutMs);
|
|
15733
|
+
const abort = () => controller.abort();
|
|
15734
|
+
if (options.signal?.aborted) abort();
|
|
15735
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
15736
|
+
try {
|
|
15737
|
+
const response = await fetcher(UPDATE_CHECK_REGISTRY_URL, {
|
|
15738
|
+
headers: { accept: UPDATE_CHECK_ACCEPT_HEADER },
|
|
15739
|
+
signal: controller.signal,
|
|
15740
|
+
redirect: "error"
|
|
15741
|
+
});
|
|
15742
|
+
if (!response.ok) throw new UpdateRegistryError(`registry responded with ${response.status}`, "http");
|
|
15743
|
+
const text = await readBoundedText(response, options.maxResponseBytes);
|
|
15744
|
+
return parsePackageMetadata(JSON.parse(text));
|
|
15745
|
+
} catch (error) {
|
|
15746
|
+
if (error instanceof UpdateRegistryError) throw error;
|
|
15747
|
+
if (error instanceof DOMException && error.name === "AbortError") throw new UpdateRegistryError("registry refresh timed out", "timeout");
|
|
15748
|
+
if (error instanceof SyntaxError) throw new UpdateRegistryError("registry response was not valid JSON", "invalid");
|
|
15749
|
+
throw new UpdateRegistryError("registry refresh failed", "network");
|
|
15750
|
+
} finally {
|
|
15751
|
+
clearTimeout(timeout);
|
|
15752
|
+
options.signal?.removeEventListener("abort", abort);
|
|
15753
|
+
}
|
|
15754
|
+
}
|
|
15755
|
+
function parsePackageMetadata(value) {
|
|
15756
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new UpdateRegistryError("registry metadata was not an object", "invalid");
|
|
15757
|
+
const record = value;
|
|
15758
|
+
if (record.name !== "caplets") throw new UpdateRegistryError("registry metadata package did not match caplets", "invalid");
|
|
15759
|
+
if (!record["dist-tags"] || typeof record["dist-tags"] !== "object") throw new UpdateRegistryError("registry metadata did not include dist-tags", "invalid");
|
|
15760
|
+
const distTags = Object.fromEntries(Object.entries(record["dist-tags"]).filter((entry) => typeof entry[1] === "string"));
|
|
15761
|
+
if (typeof distTags.latest !== "string") throw new UpdateRegistryError("registry metadata did not include dist-tags.latest", "invalid");
|
|
15762
|
+
if (!record.versions || typeof record.versions !== "object" || Array.isArray(record.versions)) throw new UpdateRegistryError("registry metadata did not include versions", "invalid");
|
|
15763
|
+
const versions = Object.keys(record.versions);
|
|
15764
|
+
if (versions.length === 0) throw new UpdateRegistryError("registry metadata included no versions", "invalid");
|
|
15765
|
+
return {
|
|
15766
|
+
packageName: UPDATE_CHECK_PACKAGE_NAME,
|
|
15767
|
+
distTags,
|
|
15768
|
+
versions
|
|
15769
|
+
};
|
|
15770
|
+
}
|
|
15771
|
+
async function readBoundedText(response, maxBytes = UPDATE_CHECK_MAX_RESPONSE_BYTES) {
|
|
15772
|
+
const contentLength = response.headers.get("content-length");
|
|
15773
|
+
const contentLengthNum = Number(contentLength);
|
|
15774
|
+
if (contentLength && Number.isFinite(contentLengthNum) && contentLengthNum > maxBytes) throw new UpdateRegistryError("registry response was too large", "too_large");
|
|
15775
|
+
if (!response.body) {
|
|
15776
|
+
const text = await response.text();
|
|
15777
|
+
if (new TextEncoder().encode(text).byteLength > maxBytes) throw new UpdateRegistryError("registry response was too large", "too_large");
|
|
15778
|
+
return text;
|
|
15779
|
+
}
|
|
15780
|
+
const reader = response.body.getReader();
|
|
15781
|
+
const chunks = [];
|
|
15782
|
+
let total = 0;
|
|
15783
|
+
while (true) {
|
|
15784
|
+
const { value, done } = await reader.read();
|
|
15785
|
+
if (done) break;
|
|
15786
|
+
if (value) {
|
|
15787
|
+
total += value.byteLength;
|
|
15788
|
+
if (total > maxBytes) {
|
|
15789
|
+
await reader.cancel().catch(() => void 0);
|
|
15790
|
+
throw new UpdateRegistryError("registry response was too large", "too_large");
|
|
15791
|
+
}
|
|
15792
|
+
chunks.push(value);
|
|
15793
|
+
}
|
|
15794
|
+
}
|
|
15795
|
+
const bytes = new Uint8Array(total);
|
|
15796
|
+
let offset = 0;
|
|
15797
|
+
for (const chunk of chunks) {
|
|
15798
|
+
bytes.set(chunk, offset);
|
|
15799
|
+
offset += chunk.byteLength;
|
|
15800
|
+
}
|
|
15801
|
+
return new TextDecoder().decode(bytes);
|
|
15802
|
+
}
|
|
15803
|
+
//#endregion
|
|
15804
|
+
//#region src/update-check/refresh.ts
|
|
15805
|
+
async function refreshUpdateMetadata(options = {}) {
|
|
15806
|
+
const now = options.now ?? Date.now();
|
|
15807
|
+
if (!acquireUpdateRefreshLock({
|
|
15808
|
+
...options,
|
|
15809
|
+
now
|
|
15810
|
+
})) return "skipped";
|
|
15811
|
+
try {
|
|
15812
|
+
const metadata = await fetchPublicCapletsMetadata({
|
|
15813
|
+
fetcher: options.fetcher,
|
|
15814
|
+
signal: options.signal,
|
|
15815
|
+
timeoutMs: options.timeoutMs ?? 250,
|
|
15816
|
+
maxResponseBytes: options.maxResponseBytes ?? 1048576
|
|
15817
|
+
});
|
|
15818
|
+
writeUpdateMetadataCache({
|
|
15819
|
+
status: "positive",
|
|
15820
|
+
fetchedAt: now,
|
|
15821
|
+
expiresAt: now + UPDATE_CHECK_CACHE_TTL_MS,
|
|
15822
|
+
staleUntil: now + UPDATE_CHECK_CACHE_TTL_MS + UPDATE_CHECK_MAX_STALE_MS,
|
|
15823
|
+
source: UPDATE_CHECK_REGISTRY_URL,
|
|
15824
|
+
metadata
|
|
15825
|
+
}, options);
|
|
15826
|
+
return "refreshed";
|
|
15827
|
+
} catch (error) {
|
|
15828
|
+
const existing = readUpdateMetadataCache({
|
|
15829
|
+
...options,
|
|
15830
|
+
now
|
|
15831
|
+
});
|
|
15832
|
+
if (existing?.status === "positive" && existing.usable) return "failed";
|
|
15833
|
+
writeUpdateMetadataCache({
|
|
15834
|
+
status: "negative",
|
|
15835
|
+
fetchedAt: now,
|
|
15836
|
+
expiresAt: now + UPDATE_CHECK_NEGATIVE_TTL_MS,
|
|
15837
|
+
reason: error instanceof UpdateRegistryError ? error.reason : "error"
|
|
15838
|
+
}, options);
|
|
15839
|
+
return "failed";
|
|
15840
|
+
} finally {
|
|
15841
|
+
releaseUpdateRefreshLock(options);
|
|
15842
|
+
}
|
|
15843
|
+
}
|
|
15844
|
+
//#endregion
|
|
15845
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
|
|
15846
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15847
|
+
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
15848
|
+
const MAX_LENGTH = 256;
|
|
15849
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
15850
|
+
module.exports = {
|
|
15851
|
+
MAX_LENGTH,
|
|
15852
|
+
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
15853
|
+
MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
|
|
15854
|
+
MAX_SAFE_INTEGER,
|
|
15855
|
+
RELEASE_TYPES: [
|
|
15856
|
+
"major",
|
|
15857
|
+
"premajor",
|
|
15858
|
+
"minor",
|
|
15859
|
+
"preminor",
|
|
15860
|
+
"patch",
|
|
15861
|
+
"prepatch",
|
|
15862
|
+
"prerelease"
|
|
15863
|
+
],
|
|
15864
|
+
SEMVER_SPEC_VERSION,
|
|
15865
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
15866
|
+
FLAG_LOOSE: 2
|
|
15867
|
+
};
|
|
15868
|
+
}));
|
|
15869
|
+
//#endregion
|
|
15870
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js
|
|
15871
|
+
var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15872
|
+
module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
15873
|
+
}));
|
|
15874
|
+
//#endregion
|
|
15875
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js
|
|
15876
|
+
var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15877
|
+
const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
|
|
15878
|
+
const debug = require_debug();
|
|
15879
|
+
exports = module.exports = {};
|
|
15880
|
+
const re = exports.re = [];
|
|
15881
|
+
const safeRe = exports.safeRe = [];
|
|
15882
|
+
const src = exports.src = [];
|
|
15883
|
+
const safeSrc = exports.safeSrc = [];
|
|
15884
|
+
const t = exports.t = {};
|
|
15885
|
+
let R = 0;
|
|
15886
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
15887
|
+
const safeRegexReplacements = [
|
|
15888
|
+
["\\s", 1],
|
|
15889
|
+
["\\d", MAX_LENGTH],
|
|
15890
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
15891
|
+
];
|
|
15892
|
+
const makeSafeRegex = (value) => {
|
|
15893
|
+
for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
15894
|
+
return value;
|
|
15895
|
+
};
|
|
15896
|
+
const createToken = (name, value, isGlobal) => {
|
|
15897
|
+
const safe = makeSafeRegex(value);
|
|
15898
|
+
const index = R++;
|
|
15899
|
+
debug(name, index, value);
|
|
15900
|
+
t[name] = index;
|
|
15901
|
+
src[index] = value;
|
|
15902
|
+
safeSrc[index] = safe;
|
|
15903
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
15904
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
15905
|
+
};
|
|
15906
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
15907
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
15908
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
15909
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
15910
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
15911
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
15912
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
15913
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
15914
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
15915
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
15916
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
15917
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
15918
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
15919
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
15920
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
15921
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
15922
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
15923
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
15924
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
15925
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
15926
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
15927
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
15928
|
+
createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
15929
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
15930
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
15931
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
15932
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
15933
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
15934
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
15935
|
+
exports.tildeTrimReplace = "$1~";
|
|
15936
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
15937
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
15938
|
+
createToken("LONECARET", "(?:\\^)");
|
|
15939
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
15940
|
+
exports.caretTrimReplace = "$1^";
|
|
15941
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
15942
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
15943
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
15944
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
15945
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
15946
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
15947
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
15948
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
15949
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
15950
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
15951
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
15952
|
+
}));
|
|
15953
|
+
//#endregion
|
|
15954
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js
|
|
15955
|
+
var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15956
|
+
const looseOption = Object.freeze({ loose: true });
|
|
15957
|
+
const emptyOpts = Object.freeze({});
|
|
15958
|
+
const parseOptions = (options) => {
|
|
15959
|
+
if (!options) return emptyOpts;
|
|
15960
|
+
if (typeof options !== "object") return looseOption;
|
|
15961
|
+
return options;
|
|
15962
|
+
};
|
|
15963
|
+
module.exports = parseOptions;
|
|
15964
|
+
}));
|
|
15965
|
+
//#endregion
|
|
15966
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js
|
|
15967
|
+
var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15968
|
+
const numeric = /^[0-9]+$/;
|
|
15969
|
+
const compareIdentifiers = (a, b) => {
|
|
15970
|
+
if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
|
|
15971
|
+
const anum = numeric.test(a);
|
|
15972
|
+
const bnum = numeric.test(b);
|
|
15973
|
+
if (anum && bnum) {
|
|
15974
|
+
a = +a;
|
|
15975
|
+
b = +b;
|
|
15976
|
+
}
|
|
15977
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
15978
|
+
};
|
|
15979
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
15980
|
+
module.exports = {
|
|
15981
|
+
compareIdentifiers,
|
|
15982
|
+
rcompareIdentifiers
|
|
15983
|
+
};
|
|
15984
|
+
}));
|
|
15985
|
+
//#endregion
|
|
15986
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js
|
|
15987
|
+
var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15988
|
+
const debug = require_debug();
|
|
15989
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
15990
|
+
const { safeRe: re, t } = require_re();
|
|
15991
|
+
const parseOptions = require_parse_options();
|
|
15992
|
+
const { compareIdentifiers } = require_identifiers();
|
|
15993
|
+
const isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
15994
|
+
const identifiers = identifier.split(".");
|
|
15995
|
+
if (identifiers.length > prerelease.length) return false;
|
|
15996
|
+
for (let i = 0; i < identifiers.length; i++) if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) return false;
|
|
15997
|
+
return true;
|
|
15998
|
+
};
|
|
15999
|
+
module.exports = class SemVer {
|
|
16000
|
+
constructor(version, options) {
|
|
16001
|
+
options = parseOptions(options);
|
|
16002
|
+
if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
16003
|
+
else version = version.version;
|
|
16004
|
+
else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
16005
|
+
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
16006
|
+
debug("SemVer", version, options);
|
|
16007
|
+
this.options = options;
|
|
16008
|
+
this.loose = !!options.loose;
|
|
16009
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
16010
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
16011
|
+
if (!m) throw new TypeError(`Invalid Version: ${version}`);
|
|
16012
|
+
this.raw = version;
|
|
16013
|
+
this.major = +m[1];
|
|
16014
|
+
this.minor = +m[2];
|
|
16015
|
+
this.patch = +m[3];
|
|
16016
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
|
|
16017
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
|
|
16018
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
|
|
16019
|
+
if (!m[4]) this.prerelease = [];
|
|
16020
|
+
else this.prerelease = m[4].split(".").map((id) => {
|
|
16021
|
+
if (/^[0-9]+$/.test(id)) {
|
|
16022
|
+
const num = +id;
|
|
16023
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
|
|
16024
|
+
}
|
|
16025
|
+
return id;
|
|
16026
|
+
});
|
|
16027
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
16028
|
+
this.format();
|
|
16029
|
+
}
|
|
16030
|
+
format() {
|
|
16031
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
16032
|
+
if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
|
|
16033
|
+
return this.version;
|
|
16034
|
+
}
|
|
16035
|
+
toString() {
|
|
16036
|
+
return this.version;
|
|
16037
|
+
}
|
|
16038
|
+
compare(other) {
|
|
16039
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
16040
|
+
if (!(other instanceof SemVer)) {
|
|
16041
|
+
if (typeof other === "string" && other === this.version) return 0;
|
|
16042
|
+
other = new SemVer(other, this.options);
|
|
16043
|
+
}
|
|
16044
|
+
if (other.version === this.version) return 0;
|
|
16045
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
16046
|
+
}
|
|
16047
|
+
compareMain(other) {
|
|
16048
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
16049
|
+
if (this.major < other.major) return -1;
|
|
16050
|
+
if (this.major > other.major) return 1;
|
|
16051
|
+
if (this.minor < other.minor) return -1;
|
|
16052
|
+
if (this.minor > other.minor) return 1;
|
|
16053
|
+
if (this.patch < other.patch) return -1;
|
|
16054
|
+
if (this.patch > other.patch) return 1;
|
|
16055
|
+
return 0;
|
|
16056
|
+
}
|
|
16057
|
+
comparePre(other) {
|
|
16058
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
16059
|
+
if (this.prerelease.length && !other.prerelease.length) return -1;
|
|
16060
|
+
else if (!this.prerelease.length && other.prerelease.length) return 1;
|
|
16061
|
+
else if (!this.prerelease.length && !other.prerelease.length) return 0;
|
|
16062
|
+
let i = 0;
|
|
16063
|
+
do {
|
|
16064
|
+
const a = this.prerelease[i];
|
|
16065
|
+
const b = other.prerelease[i];
|
|
16066
|
+
debug("prerelease compare", i, a, b);
|
|
16067
|
+
if (a === void 0 && b === void 0) return 0;
|
|
16068
|
+
else if (b === void 0) return 1;
|
|
16069
|
+
else if (a === void 0) return -1;
|
|
16070
|
+
else if (a === b) continue;
|
|
16071
|
+
else return compareIdentifiers(a, b);
|
|
16072
|
+
} while (++i);
|
|
16073
|
+
}
|
|
16074
|
+
compareBuild(other) {
|
|
16075
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
16076
|
+
let i = 0;
|
|
16077
|
+
do {
|
|
16078
|
+
const a = this.build[i];
|
|
16079
|
+
const b = other.build[i];
|
|
16080
|
+
debug("build compare", i, a, b);
|
|
16081
|
+
if (a === void 0 && b === void 0) return 0;
|
|
16082
|
+
else if (b === void 0) return 1;
|
|
16083
|
+
else if (a === void 0) return -1;
|
|
16084
|
+
else if (a === b) continue;
|
|
16085
|
+
else return compareIdentifiers(a, b);
|
|
16086
|
+
} while (++i);
|
|
16087
|
+
}
|
|
16088
|
+
inc(release, identifier, identifierBase) {
|
|
16089
|
+
if (release.startsWith("pre")) {
|
|
16090
|
+
if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
|
|
16091
|
+
if (identifier) {
|
|
16092
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
16093
|
+
if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
|
|
16094
|
+
}
|
|
16095
|
+
}
|
|
16096
|
+
switch (release) {
|
|
16097
|
+
case "premajor":
|
|
16098
|
+
this.prerelease.length = 0;
|
|
16099
|
+
this.patch = 0;
|
|
16100
|
+
this.minor = 0;
|
|
16101
|
+
this.major++;
|
|
16102
|
+
this.inc("pre", identifier, identifierBase);
|
|
16103
|
+
break;
|
|
16104
|
+
case "preminor":
|
|
16105
|
+
this.prerelease.length = 0;
|
|
16106
|
+
this.patch = 0;
|
|
16107
|
+
this.minor++;
|
|
16108
|
+
this.inc("pre", identifier, identifierBase);
|
|
16109
|
+
break;
|
|
16110
|
+
case "prepatch":
|
|
16111
|
+
this.prerelease.length = 0;
|
|
16112
|
+
this.inc("patch", identifier, identifierBase);
|
|
16113
|
+
this.inc("pre", identifier, identifierBase);
|
|
16114
|
+
break;
|
|
16115
|
+
case "prerelease":
|
|
16116
|
+
if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
|
|
16117
|
+
this.inc("pre", identifier, identifierBase);
|
|
16118
|
+
break;
|
|
16119
|
+
case "release":
|
|
16120
|
+
if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
|
|
16121
|
+
this.prerelease.length = 0;
|
|
16122
|
+
break;
|
|
16123
|
+
case "major":
|
|
16124
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
|
|
16125
|
+
this.minor = 0;
|
|
16126
|
+
this.patch = 0;
|
|
16127
|
+
this.prerelease = [];
|
|
16128
|
+
break;
|
|
16129
|
+
case "minor":
|
|
16130
|
+
if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
|
|
16131
|
+
this.patch = 0;
|
|
16132
|
+
this.prerelease = [];
|
|
16133
|
+
break;
|
|
16134
|
+
case "patch":
|
|
16135
|
+
if (this.prerelease.length === 0) this.patch++;
|
|
16136
|
+
this.prerelease = [];
|
|
16137
|
+
break;
|
|
16138
|
+
case "pre": {
|
|
16139
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
16140
|
+
if (this.prerelease.length === 0) this.prerelease = [base];
|
|
16141
|
+
else {
|
|
16142
|
+
let i = this.prerelease.length;
|
|
16143
|
+
while (--i >= 0) if (typeof this.prerelease[i] === "number") {
|
|
16144
|
+
this.prerelease[i]++;
|
|
16145
|
+
i = -2;
|
|
16146
|
+
}
|
|
16147
|
+
if (i === -1) {
|
|
16148
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
|
|
16149
|
+
this.prerelease.push(base);
|
|
16150
|
+
}
|
|
16151
|
+
}
|
|
16152
|
+
if (identifier) {
|
|
16153
|
+
let prerelease = [identifier, base];
|
|
16154
|
+
if (identifierBase === false) prerelease = [identifier];
|
|
16155
|
+
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
16156
|
+
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
16157
|
+
if (isNaN(prereleaseBase)) this.prerelease = prerelease;
|
|
16158
|
+
} else this.prerelease = prerelease;
|
|
16159
|
+
}
|
|
16160
|
+
break;
|
|
16161
|
+
}
|
|
16162
|
+
default: throw new Error(`invalid increment argument: ${release}`);
|
|
16163
|
+
}
|
|
16164
|
+
this.raw = this.format();
|
|
16165
|
+
if (this.build.length) this.raw += `+${this.build.join(".")}`;
|
|
16166
|
+
return this;
|
|
16167
|
+
}
|
|
16168
|
+
};
|
|
16169
|
+
}));
|
|
16170
|
+
//#endregion
|
|
16171
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js
|
|
16172
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16173
|
+
const SemVer = require_semver$1();
|
|
16174
|
+
const parse = (version, options, throwErrors = false) => {
|
|
16175
|
+
if (version instanceof SemVer) return version;
|
|
16176
|
+
try {
|
|
16177
|
+
return new SemVer(version, options);
|
|
16178
|
+
} catch (er) {
|
|
16179
|
+
if (!throwErrors) return null;
|
|
16180
|
+
throw er;
|
|
16181
|
+
}
|
|
16182
|
+
};
|
|
16183
|
+
module.exports = parse;
|
|
16184
|
+
}));
|
|
16185
|
+
//#endregion
|
|
16186
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js
|
|
16187
|
+
var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16188
|
+
const parse = require_parse();
|
|
16189
|
+
const valid = (version, options) => {
|
|
16190
|
+
const v = parse(version, options);
|
|
16191
|
+
return v ? v.version : null;
|
|
16192
|
+
};
|
|
16193
|
+
module.exports = valid;
|
|
16194
|
+
}));
|
|
16195
|
+
//#endregion
|
|
16196
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/clean.js
|
|
16197
|
+
var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16198
|
+
const parse = require_parse();
|
|
16199
|
+
const clean = (version, options) => {
|
|
16200
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
16201
|
+
return s ? s.version : null;
|
|
16202
|
+
};
|
|
16203
|
+
module.exports = clean;
|
|
16204
|
+
}));
|
|
16205
|
+
//#endregion
|
|
16206
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/inc.js
|
|
16207
|
+
var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16208
|
+
const SemVer = require_semver$1();
|
|
16209
|
+
const inc = (version, release, options, identifier, identifierBase) => {
|
|
16210
|
+
if (typeof options === "string") {
|
|
16211
|
+
identifierBase = identifier;
|
|
16212
|
+
identifier = options;
|
|
16213
|
+
options = void 0;
|
|
16214
|
+
}
|
|
16215
|
+
try {
|
|
16216
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
16217
|
+
} catch (er) {
|
|
16218
|
+
return null;
|
|
16219
|
+
}
|
|
16220
|
+
};
|
|
16221
|
+
module.exports = inc;
|
|
16222
|
+
}));
|
|
16223
|
+
//#endregion
|
|
16224
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/diff.js
|
|
16225
|
+
var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16226
|
+
const parse = require_parse();
|
|
16227
|
+
const diff = (version1, version2) => {
|
|
16228
|
+
const v1 = parse(version1, null, true);
|
|
16229
|
+
const v2 = parse(version2, null, true);
|
|
16230
|
+
const comparison = v1.compare(v2);
|
|
16231
|
+
if (comparison === 0) return null;
|
|
16232
|
+
const v1Higher = comparison > 0;
|
|
16233
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
16234
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
16235
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
16236
|
+
if (!!lowVersion.prerelease.length && !highHasPre) {
|
|
16237
|
+
if (!lowVersion.patch && !lowVersion.minor) return "major";
|
|
16238
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
16239
|
+
if (lowVersion.minor && !lowVersion.patch) return "minor";
|
|
16240
|
+
return "patch";
|
|
16241
|
+
}
|
|
16242
|
+
}
|
|
16243
|
+
const prefix = highHasPre ? "pre" : "";
|
|
16244
|
+
if (v1.major !== v2.major) return prefix + "major";
|
|
16245
|
+
if (v1.minor !== v2.minor) return prefix + "minor";
|
|
16246
|
+
if (v1.patch !== v2.patch) return prefix + "patch";
|
|
16247
|
+
return "prerelease";
|
|
16248
|
+
};
|
|
16249
|
+
module.exports = diff;
|
|
16250
|
+
}));
|
|
16251
|
+
//#endregion
|
|
16252
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/major.js
|
|
16253
|
+
var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16254
|
+
const SemVer = require_semver$1();
|
|
16255
|
+
const major = (a, loose) => new SemVer(a, loose).major;
|
|
16256
|
+
module.exports = major;
|
|
16257
|
+
}));
|
|
16258
|
+
//#endregion
|
|
16259
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/minor.js
|
|
16260
|
+
var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16261
|
+
const SemVer = require_semver$1();
|
|
16262
|
+
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
16263
|
+
module.exports = minor;
|
|
16264
|
+
}));
|
|
16265
|
+
//#endregion
|
|
16266
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/patch.js
|
|
16267
|
+
var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16268
|
+
const SemVer = require_semver$1();
|
|
16269
|
+
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
16270
|
+
module.exports = patch;
|
|
16271
|
+
}));
|
|
16272
|
+
//#endregion
|
|
16273
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js
|
|
16274
|
+
var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16275
|
+
const parse = require_parse();
|
|
16276
|
+
const prerelease = (version, options) => {
|
|
16277
|
+
const parsed = parse(version, options);
|
|
16278
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
16279
|
+
};
|
|
16280
|
+
module.exports = prerelease;
|
|
16281
|
+
}));
|
|
16282
|
+
//#endregion
|
|
16283
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js
|
|
16284
|
+
var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16285
|
+
const SemVer = require_semver$1();
|
|
16286
|
+
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
16287
|
+
module.exports = compare;
|
|
16288
|
+
}));
|
|
16289
|
+
//#endregion
|
|
16290
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rcompare.js
|
|
16291
|
+
var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16292
|
+
const compare = require_compare();
|
|
16293
|
+
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
16294
|
+
module.exports = rcompare;
|
|
16295
|
+
}));
|
|
16296
|
+
//#endregion
|
|
16297
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-loose.js
|
|
16298
|
+
var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16299
|
+
const compare = require_compare();
|
|
16300
|
+
const compareLoose = (a, b) => compare(a, b, true);
|
|
16301
|
+
module.exports = compareLoose;
|
|
16302
|
+
}));
|
|
16303
|
+
//#endregion
|
|
16304
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-build.js
|
|
16305
|
+
var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16306
|
+
const SemVer = require_semver$1();
|
|
16307
|
+
const compareBuild = (a, b, loose) => {
|
|
16308
|
+
const versionA = new SemVer(a, loose);
|
|
16309
|
+
const versionB = new SemVer(b, loose);
|
|
16310
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
16311
|
+
};
|
|
16312
|
+
module.exports = compareBuild;
|
|
16313
|
+
}));
|
|
16314
|
+
//#endregion
|
|
16315
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/sort.js
|
|
16316
|
+
var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16317
|
+
const compareBuild = require_compare_build();
|
|
16318
|
+
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
16319
|
+
module.exports = sort;
|
|
16320
|
+
}));
|
|
16321
|
+
//#endregion
|
|
16322
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rsort.js
|
|
16323
|
+
var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16324
|
+
const compareBuild = require_compare_build();
|
|
16325
|
+
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
16326
|
+
module.exports = rsort;
|
|
16327
|
+
}));
|
|
16328
|
+
//#endregion
|
|
16329
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js
|
|
16330
|
+
var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16331
|
+
const compare = require_compare();
|
|
16332
|
+
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
16333
|
+
module.exports = gt;
|
|
16334
|
+
}));
|
|
16335
|
+
//#endregion
|
|
16336
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js
|
|
16337
|
+
var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16338
|
+
const compare = require_compare();
|
|
16339
|
+
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
16340
|
+
module.exports = lt;
|
|
16341
|
+
}));
|
|
16342
|
+
//#endregion
|
|
16343
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js
|
|
16344
|
+
var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16345
|
+
const compare = require_compare();
|
|
16346
|
+
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
16347
|
+
module.exports = eq;
|
|
16348
|
+
}));
|
|
16349
|
+
//#endregion
|
|
16350
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js
|
|
16351
|
+
var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16352
|
+
const compare = require_compare();
|
|
16353
|
+
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
16354
|
+
module.exports = neq;
|
|
16355
|
+
}));
|
|
16356
|
+
//#endregion
|
|
16357
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js
|
|
16358
|
+
var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16359
|
+
const compare = require_compare();
|
|
16360
|
+
const gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
16361
|
+
module.exports = gte;
|
|
16362
|
+
}));
|
|
16363
|
+
//#endregion
|
|
16364
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js
|
|
16365
|
+
var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16366
|
+
const compare = require_compare();
|
|
16367
|
+
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
16368
|
+
module.exports = lte;
|
|
16369
|
+
}));
|
|
16370
|
+
//#endregion
|
|
16371
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js
|
|
16372
|
+
var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16373
|
+
const eq = require_eq();
|
|
16374
|
+
const neq = require_neq();
|
|
16375
|
+
const gt = require_gt();
|
|
16376
|
+
const gte = require_gte();
|
|
16377
|
+
const lt = require_lt();
|
|
16378
|
+
const lte = require_lte();
|
|
16379
|
+
const cmp = (a, op, b, loose) => {
|
|
16380
|
+
switch (op) {
|
|
16381
|
+
case "===":
|
|
16382
|
+
if (typeof a === "object") a = a.version;
|
|
16383
|
+
if (typeof b === "object") b = b.version;
|
|
16384
|
+
return a === b;
|
|
16385
|
+
case "!==":
|
|
16386
|
+
if (typeof a === "object") a = a.version;
|
|
16387
|
+
if (typeof b === "object") b = b.version;
|
|
16388
|
+
return a !== b;
|
|
16389
|
+
case "":
|
|
16390
|
+
case "=":
|
|
16391
|
+
case "==": return eq(a, b, loose);
|
|
16392
|
+
case "!=": return neq(a, b, loose);
|
|
16393
|
+
case ">": return gt(a, b, loose);
|
|
16394
|
+
case ">=": return gte(a, b, loose);
|
|
16395
|
+
case "<": return lt(a, b, loose);
|
|
16396
|
+
case "<=": return lte(a, b, loose);
|
|
16397
|
+
default: throw new TypeError(`Invalid operator: ${op}`);
|
|
16398
|
+
}
|
|
16399
|
+
};
|
|
16400
|
+
module.exports = cmp;
|
|
16401
|
+
}));
|
|
16402
|
+
//#endregion
|
|
16403
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/coerce.js
|
|
16404
|
+
var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16405
|
+
const SemVer = require_semver$1();
|
|
16406
|
+
const parse = require_parse();
|
|
16407
|
+
const { safeRe: re, t } = require_re();
|
|
16408
|
+
const coerce = (version, options) => {
|
|
16409
|
+
if (version instanceof SemVer) return version;
|
|
16410
|
+
if (typeof version === "number") version = String(version);
|
|
16411
|
+
if (typeof version !== "string") return null;
|
|
16412
|
+
options = options || {};
|
|
16413
|
+
let match = null;
|
|
16414
|
+
if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
16415
|
+
else {
|
|
16416
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
16417
|
+
let next;
|
|
16418
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
16419
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
|
|
16420
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
16421
|
+
}
|
|
16422
|
+
coerceRtlRegex.lastIndex = -1;
|
|
16423
|
+
}
|
|
16424
|
+
if (match === null) return null;
|
|
16425
|
+
const major = match[2];
|
|
16426
|
+
return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
|
|
16427
|
+
};
|
|
16428
|
+
module.exports = coerce;
|
|
16429
|
+
}));
|
|
16430
|
+
//#endregion
|
|
16431
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/truncate.js
|
|
16432
|
+
var require_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16433
|
+
const parse = require_parse();
|
|
16434
|
+
const constants = require_constants();
|
|
16435
|
+
const SemVer = require_semver$1();
|
|
16436
|
+
const truncate = (version, truncation, options) => {
|
|
16437
|
+
if (!constants.RELEASE_TYPES.includes(truncation)) return null;
|
|
16438
|
+
const clonedVersion = cloneInputVersion(version, options);
|
|
16439
|
+
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
16440
|
+
};
|
|
16441
|
+
const cloneInputVersion = (version, options) => {
|
|
16442
|
+
return parse(version instanceof SemVer ? version.version : version, options);
|
|
16443
|
+
};
|
|
16444
|
+
const doTruncation = (version, truncation) => {
|
|
16445
|
+
if (isPrerelease(truncation)) return version.version;
|
|
16446
|
+
version.prerelease = [];
|
|
16447
|
+
switch (truncation) {
|
|
16448
|
+
case "major":
|
|
16449
|
+
version.minor = 0;
|
|
16450
|
+
version.patch = 0;
|
|
16451
|
+
break;
|
|
16452
|
+
case "minor":
|
|
16453
|
+
version.patch = 0;
|
|
16454
|
+
break;
|
|
16455
|
+
}
|
|
16456
|
+
return version.format();
|
|
16457
|
+
};
|
|
16458
|
+
const isPrerelease = (type) => {
|
|
16459
|
+
return type.startsWith("pre");
|
|
16460
|
+
};
|
|
16461
|
+
module.exports = truncate;
|
|
16462
|
+
}));
|
|
16463
|
+
//#endregion
|
|
16464
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js
|
|
16465
|
+
var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16466
|
+
var LRUCache = class {
|
|
16467
|
+
constructor() {
|
|
16468
|
+
this.max = 1e3;
|
|
16469
|
+
this.map = /* @__PURE__ */ new Map();
|
|
16470
|
+
}
|
|
16471
|
+
get(key) {
|
|
16472
|
+
const value = this.map.get(key);
|
|
16473
|
+
if (value === void 0) return;
|
|
16474
|
+
else {
|
|
16475
|
+
this.map.delete(key);
|
|
16476
|
+
this.map.set(key, value);
|
|
16477
|
+
return value;
|
|
16478
|
+
}
|
|
16479
|
+
}
|
|
16480
|
+
delete(key) {
|
|
16481
|
+
return this.map.delete(key);
|
|
16482
|
+
}
|
|
16483
|
+
set(key, value) {
|
|
16484
|
+
if (!this.delete(key) && value !== void 0) {
|
|
16485
|
+
if (this.map.size >= this.max) {
|
|
16486
|
+
const firstKey = this.map.keys().next().value;
|
|
16487
|
+
this.delete(firstKey);
|
|
16488
|
+
}
|
|
16489
|
+
this.map.set(key, value);
|
|
16490
|
+
}
|
|
16491
|
+
return this;
|
|
16492
|
+
}
|
|
16493
|
+
};
|
|
16494
|
+
module.exports = LRUCache;
|
|
16495
|
+
}));
|
|
16496
|
+
//#endregion
|
|
16497
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js
|
|
16498
|
+
var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16499
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
16500
|
+
module.exports = class Range {
|
|
16501
|
+
constructor(range, options) {
|
|
16502
|
+
options = parseOptions(options);
|
|
16503
|
+
if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
16504
|
+
else return new Range(range.raw, options);
|
|
16505
|
+
if (range instanceof Comparator) {
|
|
16506
|
+
this.raw = range.value;
|
|
16507
|
+
this.set = [[range]];
|
|
16508
|
+
this.formatted = void 0;
|
|
16509
|
+
return this;
|
|
16510
|
+
}
|
|
16511
|
+
this.options = options;
|
|
16512
|
+
this.loose = !!options.loose;
|
|
16513
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
16514
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
16515
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
16516
|
+
if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
16517
|
+
if (this.set.length > 1) {
|
|
16518
|
+
const first = this.set[0];
|
|
16519
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
16520
|
+
if (this.set.length === 0) this.set = [first];
|
|
16521
|
+
else if (this.set.length > 1) {
|
|
16522
|
+
for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
|
|
16523
|
+
this.set = [c];
|
|
16524
|
+
break;
|
|
16525
|
+
}
|
|
16526
|
+
}
|
|
16527
|
+
}
|
|
16528
|
+
this.formatted = void 0;
|
|
16529
|
+
}
|
|
16530
|
+
get range() {
|
|
16531
|
+
if (this.formatted === void 0) {
|
|
16532
|
+
this.formatted = "";
|
|
16533
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
16534
|
+
if (i > 0) this.formatted += "||";
|
|
16535
|
+
const comps = this.set[i];
|
|
16536
|
+
for (let k = 0; k < comps.length; k++) {
|
|
16537
|
+
if (k > 0) this.formatted += " ";
|
|
16538
|
+
this.formatted += comps[k].toString().trim();
|
|
16539
|
+
}
|
|
16540
|
+
}
|
|
16541
|
+
}
|
|
16542
|
+
return this.formatted;
|
|
16543
|
+
}
|
|
16544
|
+
format() {
|
|
16545
|
+
return this.range;
|
|
16546
|
+
}
|
|
16547
|
+
toString() {
|
|
16548
|
+
return this.range;
|
|
16549
|
+
}
|
|
16550
|
+
parseRange(range) {
|
|
16551
|
+
range = range.replace(BUILDSTRIPRE, "");
|
|
16552
|
+
const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
|
|
16553
|
+
const cached = cache.get(memoKey);
|
|
16554
|
+
if (cached) return cached;
|
|
16555
|
+
const loose = this.options.loose;
|
|
16556
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
16557
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
16558
|
+
debug("hyphen replace", range);
|
|
16559
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
16560
|
+
debug("comparator trim", range);
|
|
16561
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
16562
|
+
debug("tilde trim", range);
|
|
16563
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
16564
|
+
debug("caret trim", range);
|
|
16565
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
16566
|
+
if (loose) rangeList = rangeList.filter((comp) => {
|
|
16567
|
+
debug("loose invalid filter", comp, this.options);
|
|
16568
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
16569
|
+
});
|
|
16570
|
+
debug("range list", rangeList);
|
|
16571
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
16572
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
16573
|
+
for (const comp of comparators) {
|
|
16574
|
+
if (isNullSet(comp)) return [comp];
|
|
16575
|
+
rangeMap.set(comp.value, comp);
|
|
16576
|
+
}
|
|
16577
|
+
if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
|
|
16578
|
+
const result = [...rangeMap.values()];
|
|
16579
|
+
cache.set(memoKey, result);
|
|
16580
|
+
return result;
|
|
16581
|
+
}
|
|
16582
|
+
intersects(range, options) {
|
|
16583
|
+
if (!(range instanceof Range)) throw new TypeError("a Range is required");
|
|
16584
|
+
return this.set.some((thisComparators) => {
|
|
16585
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
16586
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
16587
|
+
return rangeComparators.every((rangeComparator) => {
|
|
16588
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
16589
|
+
});
|
|
16590
|
+
});
|
|
16591
|
+
});
|
|
16592
|
+
});
|
|
16593
|
+
}
|
|
16594
|
+
test(version) {
|
|
16595
|
+
if (!version) return false;
|
|
16596
|
+
if (typeof version === "string") try {
|
|
16597
|
+
version = new SemVer(version, this.options);
|
|
16598
|
+
} catch (er) {
|
|
16599
|
+
return false;
|
|
16600
|
+
}
|
|
16601
|
+
for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
|
|
16602
|
+
return false;
|
|
16603
|
+
}
|
|
16604
|
+
};
|
|
16605
|
+
const cache = new (require_lrucache())();
|
|
16606
|
+
const parseOptions = require_parse_options();
|
|
16607
|
+
const Comparator = require_comparator();
|
|
16608
|
+
const debug = require_debug();
|
|
16609
|
+
const SemVer = require_semver$1();
|
|
16610
|
+
const { safeRe: re, src, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
|
|
16611
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
16612
|
+
const BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
|
|
16613
|
+
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
16614
|
+
const isAny = (c) => c.value === "";
|
|
16615
|
+
const isSatisfiable = (comparators, options) => {
|
|
16616
|
+
let result = true;
|
|
16617
|
+
const remainingComparators = comparators.slice();
|
|
16618
|
+
let testComparator = remainingComparators.pop();
|
|
16619
|
+
while (result && remainingComparators.length) {
|
|
16620
|
+
result = remainingComparators.every((otherComparator) => {
|
|
16621
|
+
return testComparator.intersects(otherComparator, options);
|
|
16622
|
+
});
|
|
16623
|
+
testComparator = remainingComparators.pop();
|
|
16624
|
+
}
|
|
16625
|
+
return result;
|
|
16626
|
+
};
|
|
16627
|
+
const parseComparator = (comp, options) => {
|
|
16628
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
16629
|
+
debug("comp", comp, options);
|
|
16630
|
+
comp = replaceCarets(comp, options);
|
|
16631
|
+
debug("caret", comp);
|
|
16632
|
+
comp = replaceTildes(comp, options);
|
|
16633
|
+
debug("tildes", comp);
|
|
16634
|
+
comp = replaceXRanges(comp, options);
|
|
16635
|
+
debug("xrange", comp);
|
|
16636
|
+
comp = replaceStars(comp, options);
|
|
16637
|
+
debug("stars", comp);
|
|
16638
|
+
return comp;
|
|
16639
|
+
};
|
|
16640
|
+
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
16641
|
+
const invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
|
|
16642
|
+
const replaceTildes = (comp, options) => {
|
|
16643
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
16644
|
+
};
|
|
16645
|
+
const replaceTilde = (comp, options) => {
|
|
16646
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
16647
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
16648
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
16649
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
16650
|
+
let ret;
|
|
16651
|
+
if (isX(M)) ret = "";
|
|
16652
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
16653
|
+
else if (isX(p)) ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
16654
|
+
else if (pr) {
|
|
16655
|
+
debug("replaceTilde pr", pr);
|
|
16656
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
16657
|
+
} else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
16658
|
+
debug("tilde return", ret);
|
|
16659
|
+
return ret;
|
|
16660
|
+
});
|
|
16661
|
+
};
|
|
16662
|
+
const replaceCarets = (comp, options) => {
|
|
16663
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
16664
|
+
};
|
|
16665
|
+
const replaceCaret = (comp, options) => {
|
|
16666
|
+
debug("caret", comp, options);
|
|
16667
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
16668
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
16669
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
16670
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
16671
|
+
let ret;
|
|
16672
|
+
if (isX(M)) ret = "";
|
|
16673
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
16674
|
+
else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
16675
|
+
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
16676
|
+
else if (pr) {
|
|
16677
|
+
debug("replaceCaret pr", pr);
|
|
16678
|
+
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
16679
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
16680
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
16681
|
+
} else {
|
|
16682
|
+
debug("no pr");
|
|
16683
|
+
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
|
|
16684
|
+
else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
16685
|
+
else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
16686
|
+
}
|
|
16687
|
+
debug("caret return", ret);
|
|
16688
|
+
return ret;
|
|
16689
|
+
});
|
|
16690
|
+
};
|
|
16691
|
+
const replaceXRanges = (comp, options) => {
|
|
16692
|
+
debug("replaceXRanges", comp, options);
|
|
16693
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
16694
|
+
};
|
|
16695
|
+
const replaceXRange = (comp, options) => {
|
|
16696
|
+
comp = comp.trim();
|
|
16697
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
16698
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
16699
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
16700
|
+
if (invalidXRangeOrder(M, m, p)) return comp;
|
|
16701
|
+
const xM = isX(M);
|
|
16702
|
+
const xm = xM || isX(m);
|
|
16703
|
+
const xp = xm || isX(p);
|
|
16704
|
+
const anyX = xp;
|
|
16705
|
+
if (gtlt === "=" && anyX) gtlt = "";
|
|
16706
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
16707
|
+
if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
|
|
16708
|
+
else ret = "*";
|
|
16709
|
+
else if (gtlt && anyX) {
|
|
16710
|
+
if (xm) m = 0;
|
|
16711
|
+
p = 0;
|
|
16712
|
+
if (gtlt === ">") {
|
|
16713
|
+
gtlt = ">=";
|
|
16714
|
+
if (xm) {
|
|
16715
|
+
M = +M + 1;
|
|
16716
|
+
m = 0;
|
|
16717
|
+
p = 0;
|
|
16718
|
+
} else {
|
|
16719
|
+
m = +m + 1;
|
|
16720
|
+
p = 0;
|
|
16721
|
+
}
|
|
16722
|
+
} else if (gtlt === "<=") {
|
|
16723
|
+
gtlt = "<";
|
|
16724
|
+
if (xm) M = +M + 1;
|
|
16725
|
+
else m = +m + 1;
|
|
16726
|
+
}
|
|
16727
|
+
if (gtlt === "<") pr = "-0";
|
|
16728
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
16729
|
+
} else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
16730
|
+
else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
16731
|
+
debug("xRange return", ret);
|
|
16732
|
+
return ret;
|
|
16733
|
+
});
|
|
16734
|
+
};
|
|
16735
|
+
const replaceStars = (comp, options) => {
|
|
16736
|
+
debug("replaceStars", comp, options);
|
|
16737
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
16738
|
+
};
|
|
16739
|
+
const replaceGTE0 = (comp, options) => {
|
|
16740
|
+
debug("replaceGTE0", comp, options);
|
|
16741
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
16742
|
+
};
|
|
16743
|
+
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
16744
|
+
if (isX(fM)) from = "";
|
|
16745
|
+
else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
16746
|
+
else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
16747
|
+
else if (fpr) from = `>=${from}`;
|
|
16748
|
+
else from = `>=${from}${incPr ? "-0" : ""}`;
|
|
16749
|
+
if (isX(tM)) to = "";
|
|
16750
|
+
else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
|
|
16751
|
+
else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
|
|
16752
|
+
else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
16753
|
+
else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
16754
|
+
else to = `<=${to}`;
|
|
16755
|
+
return `${from} ${to}`.trim();
|
|
16756
|
+
};
|
|
16757
|
+
const testSet = (set, version, options) => {
|
|
16758
|
+
for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
|
|
16759
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
16760
|
+
for (let i = 0; i < set.length; i++) {
|
|
16761
|
+
debug(set[i].semver);
|
|
16762
|
+
if (set[i].semver === Comparator.ANY) continue;
|
|
16763
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
16764
|
+
const allowed = set[i].semver;
|
|
16765
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
|
|
16766
|
+
}
|
|
16767
|
+
}
|
|
16768
|
+
return false;
|
|
16769
|
+
}
|
|
16770
|
+
return true;
|
|
16771
|
+
};
|
|
16772
|
+
}));
|
|
16773
|
+
//#endregion
|
|
16774
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js
|
|
16775
|
+
var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16776
|
+
const ANY = Symbol("SemVer ANY");
|
|
16777
|
+
module.exports = class Comparator {
|
|
16778
|
+
static get ANY() {
|
|
16779
|
+
return ANY;
|
|
16780
|
+
}
|
|
16781
|
+
constructor(comp, options) {
|
|
16782
|
+
options = parseOptions(options);
|
|
16783
|
+
if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
|
|
16784
|
+
else comp = comp.value;
|
|
16785
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
16786
|
+
debug("comparator", comp, options);
|
|
16787
|
+
this.options = options;
|
|
16788
|
+
this.loose = !!options.loose;
|
|
16789
|
+
this.parse(comp);
|
|
16790
|
+
if (this.semver === ANY) this.value = "";
|
|
16791
|
+
else this.value = this.operator + this.semver.version;
|
|
16792
|
+
debug("comp", this);
|
|
16793
|
+
}
|
|
16794
|
+
parse(comp) {
|
|
16795
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
16796
|
+
const m = comp.match(r);
|
|
16797
|
+
if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
|
|
16798
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
16799
|
+
if (this.operator === "=") this.operator = "";
|
|
16800
|
+
if (!m[2]) this.semver = ANY;
|
|
16801
|
+
else this.semver = new SemVer(m[2], this.options.loose);
|
|
16802
|
+
}
|
|
16803
|
+
toString() {
|
|
16804
|
+
return this.value;
|
|
16805
|
+
}
|
|
16806
|
+
test(version) {
|
|
16807
|
+
debug("Comparator.test", version, this.options.loose);
|
|
16808
|
+
if (this.semver === ANY || version === ANY) return true;
|
|
16809
|
+
if (typeof version === "string") try {
|
|
16810
|
+
version = new SemVer(version, this.options);
|
|
16811
|
+
} catch (er) {
|
|
16812
|
+
return false;
|
|
16813
|
+
}
|
|
16814
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
16815
|
+
}
|
|
16816
|
+
intersects(comp, options) {
|
|
16817
|
+
if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
|
|
16818
|
+
if (this.operator === "") {
|
|
16819
|
+
if (this.value === "") return true;
|
|
16820
|
+
return new Range(comp.value, options).test(this.value);
|
|
16821
|
+
} else if (comp.operator === "") {
|
|
16822
|
+
if (comp.value === "") return true;
|
|
16823
|
+
return new Range(this.value, options).test(comp.semver);
|
|
16824
|
+
}
|
|
16825
|
+
options = parseOptions(options);
|
|
16826
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
|
|
16827
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
|
|
16828
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
|
|
16829
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
|
|
16830
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
|
|
16831
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
|
|
16832
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
|
|
16833
|
+
return false;
|
|
16834
|
+
}
|
|
16835
|
+
};
|
|
16836
|
+
const parseOptions = require_parse_options();
|
|
16837
|
+
const { safeRe: re, t } = require_re();
|
|
16838
|
+
const cmp = require_cmp();
|
|
16839
|
+
const debug = require_debug();
|
|
16840
|
+
const SemVer = require_semver$1();
|
|
16841
|
+
const Range = require_range();
|
|
16842
|
+
}));
|
|
16843
|
+
//#endregion
|
|
16844
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js
|
|
16845
|
+
var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16846
|
+
const Range = require_range();
|
|
16847
|
+
const satisfies = (version, range, options) => {
|
|
16848
|
+
try {
|
|
16849
|
+
range = new Range(range, options);
|
|
16850
|
+
} catch (er) {
|
|
16851
|
+
return false;
|
|
16852
|
+
}
|
|
16853
|
+
return range.test(version);
|
|
16854
|
+
};
|
|
16855
|
+
module.exports = satisfies;
|
|
16856
|
+
}));
|
|
16857
|
+
//#endregion
|
|
16858
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/to-comparators.js
|
|
16859
|
+
var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16860
|
+
const Range = require_range();
|
|
16861
|
+
const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
16862
|
+
module.exports = toComparators;
|
|
16863
|
+
}));
|
|
16864
|
+
//#endregion
|
|
16865
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/max-satisfying.js
|
|
16866
|
+
var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16867
|
+
const SemVer = require_semver$1();
|
|
16868
|
+
const Range = require_range();
|
|
16869
|
+
const maxSatisfying = (versions, range, options) => {
|
|
16870
|
+
let max = null;
|
|
16871
|
+
let maxSV = null;
|
|
16872
|
+
let rangeObj = null;
|
|
16873
|
+
try {
|
|
16874
|
+
rangeObj = new Range(range, options);
|
|
16875
|
+
} catch (er) {
|
|
16876
|
+
return null;
|
|
16877
|
+
}
|
|
16878
|
+
versions.forEach((v) => {
|
|
16879
|
+
if (rangeObj.test(v)) {
|
|
16880
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
16881
|
+
max = v;
|
|
16882
|
+
maxSV = new SemVer(max, options);
|
|
16883
|
+
}
|
|
16884
|
+
}
|
|
16885
|
+
});
|
|
16886
|
+
return max;
|
|
16887
|
+
};
|
|
16888
|
+
module.exports = maxSatisfying;
|
|
16889
|
+
}));
|
|
16890
|
+
//#endregion
|
|
16891
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-satisfying.js
|
|
16892
|
+
var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16893
|
+
const SemVer = require_semver$1();
|
|
16894
|
+
const Range = require_range();
|
|
16895
|
+
const minSatisfying = (versions, range, options) => {
|
|
16896
|
+
let min = null;
|
|
16897
|
+
let minSV = null;
|
|
16898
|
+
let rangeObj = null;
|
|
16899
|
+
try {
|
|
16900
|
+
rangeObj = new Range(range, options);
|
|
16901
|
+
} catch (er) {
|
|
16902
|
+
return null;
|
|
16903
|
+
}
|
|
16904
|
+
versions.forEach((v) => {
|
|
16905
|
+
if (rangeObj.test(v)) {
|
|
16906
|
+
if (!min || minSV.compare(v) === 1) {
|
|
16907
|
+
min = v;
|
|
16908
|
+
minSV = new SemVer(min, options);
|
|
16909
|
+
}
|
|
16910
|
+
}
|
|
16911
|
+
});
|
|
16912
|
+
return min;
|
|
16913
|
+
};
|
|
16914
|
+
module.exports = minSatisfying;
|
|
16915
|
+
}));
|
|
16916
|
+
//#endregion
|
|
16917
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-version.js
|
|
16918
|
+
var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16919
|
+
const SemVer = require_semver$1();
|
|
16920
|
+
const Range = require_range();
|
|
16921
|
+
const gt = require_gt();
|
|
16922
|
+
const minVersion = (range, loose) => {
|
|
16923
|
+
range = new Range(range, loose);
|
|
16924
|
+
let minver = new SemVer("0.0.0");
|
|
16925
|
+
if (range.test(minver)) return minver;
|
|
16926
|
+
minver = new SemVer("0.0.0-0");
|
|
16927
|
+
if (range.test(minver)) return minver;
|
|
16928
|
+
minver = null;
|
|
16929
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
16930
|
+
const comparators = range.set[i];
|
|
16931
|
+
let setMin = null;
|
|
16932
|
+
comparators.forEach((comparator) => {
|
|
16933
|
+
const compver = new SemVer(comparator.semver.version);
|
|
16934
|
+
switch (comparator.operator) {
|
|
16935
|
+
case ">":
|
|
16936
|
+
if (compver.prerelease.length === 0) compver.patch++;
|
|
16937
|
+
else compver.prerelease.push(0);
|
|
16938
|
+
compver.raw = compver.format();
|
|
16939
|
+
case "":
|
|
16940
|
+
case ">=":
|
|
16941
|
+
if (!setMin || gt(compver, setMin)) setMin = compver;
|
|
16942
|
+
break;
|
|
16943
|
+
case "<":
|
|
16944
|
+
case "<=": break;
|
|
16945
|
+
/* istanbul ignore next */
|
|
16946
|
+
default: throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
16947
|
+
}
|
|
16948
|
+
});
|
|
16949
|
+
if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
|
|
16950
|
+
}
|
|
16951
|
+
if (minver && range.test(minver)) return minver;
|
|
16952
|
+
return null;
|
|
16953
|
+
};
|
|
16954
|
+
module.exports = minVersion;
|
|
16955
|
+
}));
|
|
16956
|
+
//#endregion
|
|
16957
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js
|
|
16958
|
+
var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16959
|
+
const Range = require_range();
|
|
16960
|
+
const validRange = (range, options) => {
|
|
16961
|
+
try {
|
|
16962
|
+
return new Range(range, options).range || "*";
|
|
16963
|
+
} catch (er) {
|
|
16964
|
+
return null;
|
|
16965
|
+
}
|
|
16966
|
+
};
|
|
16967
|
+
module.exports = validRange;
|
|
16968
|
+
}));
|
|
16969
|
+
//#endregion
|
|
16970
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/outside.js
|
|
16971
|
+
var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16972
|
+
const SemVer = require_semver$1();
|
|
16973
|
+
const Comparator = require_comparator();
|
|
16974
|
+
const { ANY } = Comparator;
|
|
16975
|
+
const Range = require_range();
|
|
16976
|
+
const satisfies = require_satisfies();
|
|
16977
|
+
const gt = require_gt();
|
|
16978
|
+
const lt = require_lt();
|
|
16979
|
+
const lte = require_lte();
|
|
16980
|
+
const gte = require_gte();
|
|
16981
|
+
const outside = (version, range, hilo, options) => {
|
|
16982
|
+
version = new SemVer(version, options);
|
|
16983
|
+
range = new Range(range, options);
|
|
16984
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
16985
|
+
switch (hilo) {
|
|
16986
|
+
case ">":
|
|
16987
|
+
gtfn = gt;
|
|
16988
|
+
ltefn = lte;
|
|
16989
|
+
ltfn = lt;
|
|
16990
|
+
comp = ">";
|
|
16991
|
+
ecomp = ">=";
|
|
16992
|
+
break;
|
|
16993
|
+
case "<":
|
|
16994
|
+
gtfn = lt;
|
|
16995
|
+
ltefn = gte;
|
|
16996
|
+
ltfn = gt;
|
|
16997
|
+
comp = "<";
|
|
16998
|
+
ecomp = "<=";
|
|
16999
|
+
break;
|
|
17000
|
+
default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
|
|
17001
|
+
}
|
|
17002
|
+
if (satisfies(version, range, options)) return false;
|
|
17003
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
17004
|
+
const comparators = range.set[i];
|
|
17005
|
+
let high = null;
|
|
17006
|
+
let low = null;
|
|
17007
|
+
comparators.forEach((comparator) => {
|
|
17008
|
+
if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
|
|
17009
|
+
high = high || comparator;
|
|
17010
|
+
low = low || comparator;
|
|
17011
|
+
if (gtfn(comparator.semver, high.semver, options)) high = comparator;
|
|
17012
|
+
else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
|
|
17013
|
+
});
|
|
17014
|
+
if (high.operator === comp || high.operator === ecomp) return false;
|
|
17015
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
|
|
17016
|
+
else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
|
|
17017
|
+
}
|
|
17018
|
+
return true;
|
|
17019
|
+
};
|
|
17020
|
+
module.exports = outside;
|
|
17021
|
+
}));
|
|
17022
|
+
//#endregion
|
|
17023
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/gtr.js
|
|
17024
|
+
var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
17025
|
+
const outside = require_outside();
|
|
17026
|
+
const gtr = (version, range, options) => outside(version, range, ">", options);
|
|
17027
|
+
module.exports = gtr;
|
|
17028
|
+
}));
|
|
17029
|
+
//#endregion
|
|
17030
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/ltr.js
|
|
17031
|
+
var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
17032
|
+
const outside = require_outside();
|
|
17033
|
+
const ltr = (version, range, options) => outside(version, range, "<", options);
|
|
17034
|
+
module.exports = ltr;
|
|
17035
|
+
}));
|
|
17036
|
+
//#endregion
|
|
17037
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/intersects.js
|
|
17038
|
+
var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
17039
|
+
const Range = require_range();
|
|
17040
|
+
const intersects = (r1, r2, options) => {
|
|
17041
|
+
r1 = new Range(r1, options);
|
|
17042
|
+
r2 = new Range(r2, options);
|
|
17043
|
+
return r1.intersects(r2, options);
|
|
17044
|
+
};
|
|
17045
|
+
module.exports = intersects;
|
|
17046
|
+
}));
|
|
17047
|
+
//#endregion
|
|
17048
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/simplify.js
|
|
17049
|
+
var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
17050
|
+
const satisfies = require_satisfies();
|
|
17051
|
+
const compare = require_compare();
|
|
17052
|
+
module.exports = (versions, range, options) => {
|
|
17053
|
+
const set = [];
|
|
17054
|
+
let first = null;
|
|
17055
|
+
let prev = null;
|
|
17056
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
17057
|
+
for (const version of v) if (satisfies(version, range, options)) {
|
|
17058
|
+
prev = version;
|
|
17059
|
+
if (!first) first = version;
|
|
17060
|
+
} else {
|
|
17061
|
+
if (prev) set.push([first, prev]);
|
|
17062
|
+
prev = null;
|
|
17063
|
+
first = null;
|
|
17064
|
+
}
|
|
17065
|
+
if (first) set.push([first, null]);
|
|
17066
|
+
const ranges = [];
|
|
17067
|
+
for (const [min, max] of set) if (min === max) ranges.push(min);
|
|
17068
|
+
else if (!max && min === v[0]) ranges.push("*");
|
|
17069
|
+
else if (!max) ranges.push(`>=${min}`);
|
|
17070
|
+
else if (min === v[0]) ranges.push(`<=${max}`);
|
|
17071
|
+
else ranges.push(`${min} - ${max}`);
|
|
17072
|
+
const simplified = ranges.join(" || ");
|
|
17073
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
17074
|
+
return simplified.length < original.length ? simplified : range;
|
|
17075
|
+
};
|
|
17076
|
+
}));
|
|
17077
|
+
//#endregion
|
|
17078
|
+
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/subset.js
|
|
17079
|
+
var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
17080
|
+
const Range = require_range();
|
|
17081
|
+
const Comparator = require_comparator();
|
|
17082
|
+
const { ANY } = Comparator;
|
|
17083
|
+
const satisfies = require_satisfies();
|
|
17084
|
+
const compare = require_compare();
|
|
17085
|
+
const subset = (sub, dom, options = {}) => {
|
|
17086
|
+
if (sub === dom) return true;
|
|
17087
|
+
sub = new Range(sub, options);
|
|
17088
|
+
dom = new Range(dom, options);
|
|
17089
|
+
let sawNonNull = false;
|
|
17090
|
+
OUTER: for (const simpleSub of sub.set) {
|
|
17091
|
+
for (const simpleDom of dom.set) {
|
|
17092
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
17093
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
17094
|
+
if (isSub) continue OUTER;
|
|
17095
|
+
}
|
|
17096
|
+
if (sawNonNull) return false;
|
|
17097
|
+
}
|
|
17098
|
+
return true;
|
|
17099
|
+
};
|
|
17100
|
+
const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
17101
|
+
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
17102
|
+
const simpleSubset = (sub, dom, options) => {
|
|
17103
|
+
if (sub === dom) return true;
|
|
17104
|
+
if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
|
|
17105
|
+
else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
|
|
17106
|
+
else sub = minimumVersion;
|
|
17107
|
+
if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
|
|
17108
|
+
else dom = minimumVersion;
|
|
17109
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
17110
|
+
let gt, lt;
|
|
17111
|
+
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
|
|
17112
|
+
else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
|
|
17113
|
+
else eqSet.add(c.semver);
|
|
17114
|
+
if (eqSet.size > 1) return null;
|
|
17115
|
+
let gtltComp;
|
|
17116
|
+
if (gt && lt) {
|
|
17117
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
17118
|
+
if (gtltComp > 0) return null;
|
|
17119
|
+
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
|
|
17120
|
+
}
|
|
17121
|
+
for (const eq of eqSet) {
|
|
17122
|
+
if (gt && !satisfies(eq, String(gt), options)) return null;
|
|
17123
|
+
if (lt && !satisfies(eq, String(lt), options)) return null;
|
|
17124
|
+
for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
|
|
17125
|
+
return true;
|
|
17126
|
+
}
|
|
17127
|
+
let higher, lower;
|
|
17128
|
+
let hasDomLT, hasDomGT;
|
|
17129
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
17130
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
17131
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
|
|
17132
|
+
for (const c of dom) {
|
|
17133
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
17134
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
17135
|
+
if (gt) {
|
|
17136
|
+
if (needDomGTPre) {
|
|
17137
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
|
|
17138
|
+
}
|
|
17139
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
17140
|
+
higher = higherGT(gt, c, options);
|
|
17141
|
+
if (higher === c && higher !== gt) return false;
|
|
17142
|
+
} else if (gt.operator === ">=" && !c.test(gt.semver)) return false;
|
|
17143
|
+
}
|
|
17144
|
+
if (lt) {
|
|
17145
|
+
if (needDomLTPre) {
|
|
17146
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
|
|
17147
|
+
}
|
|
17148
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
17149
|
+
lower = lowerLT(lt, c, options);
|
|
17150
|
+
if (lower === c && lower !== lt) return false;
|
|
17151
|
+
} else if (lt.operator === "<=" && !c.test(lt.semver)) return false;
|
|
17152
|
+
}
|
|
17153
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
|
|
17154
|
+
}
|
|
17155
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
|
|
17156
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
|
|
17157
|
+
if (needDomGTPre || needDomLTPre) return false;
|
|
17158
|
+
return true;
|
|
17159
|
+
};
|
|
17160
|
+
const higherGT = (a, b, options) => {
|
|
17161
|
+
if (!a) return b;
|
|
17162
|
+
const comp = compare(a.semver, b.semver, options);
|
|
17163
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
17164
|
+
};
|
|
17165
|
+
const lowerLT = (a, b, options) => {
|
|
17166
|
+
if (!a) return b;
|
|
17167
|
+
const comp = compare(a.semver, b.semver, options);
|
|
17168
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
17169
|
+
};
|
|
17170
|
+
module.exports = subset;
|
|
17171
|
+
}));
|
|
17172
|
+
//#endregion
|
|
17173
|
+
//#region src/update-check/version.ts
|
|
17174
|
+
var import_semver = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
17175
|
+
const internalRe = require_re();
|
|
17176
|
+
const constants = require_constants();
|
|
17177
|
+
const SemVer = require_semver$1();
|
|
17178
|
+
const identifiers = require_identifiers();
|
|
17179
|
+
module.exports = {
|
|
17180
|
+
parse: require_parse(),
|
|
17181
|
+
valid: require_valid$1(),
|
|
17182
|
+
clean: require_clean(),
|
|
17183
|
+
inc: require_inc(),
|
|
17184
|
+
diff: require_diff(),
|
|
17185
|
+
major: require_major(),
|
|
17186
|
+
minor: require_minor(),
|
|
17187
|
+
patch: require_patch(),
|
|
17188
|
+
prerelease: require_prerelease(),
|
|
17189
|
+
compare: require_compare(),
|
|
17190
|
+
rcompare: require_rcompare(),
|
|
17191
|
+
compareLoose: require_compare_loose(),
|
|
17192
|
+
compareBuild: require_compare_build(),
|
|
17193
|
+
sort: require_sort(),
|
|
17194
|
+
rsort: require_rsort(),
|
|
17195
|
+
gt: require_gt(),
|
|
17196
|
+
lt: require_lt(),
|
|
17197
|
+
eq: require_eq(),
|
|
17198
|
+
neq: require_neq(),
|
|
17199
|
+
gte: require_gte(),
|
|
17200
|
+
lte: require_lte(),
|
|
17201
|
+
cmp: require_cmp(),
|
|
17202
|
+
coerce: require_coerce(),
|
|
17203
|
+
truncate: require_truncate(),
|
|
17204
|
+
Comparator: require_comparator(),
|
|
17205
|
+
Range: require_range(),
|
|
17206
|
+
satisfies: require_satisfies(),
|
|
17207
|
+
toComparators: require_to_comparators(),
|
|
17208
|
+
maxSatisfying: require_max_satisfying(),
|
|
17209
|
+
minSatisfying: require_min_satisfying(),
|
|
17210
|
+
minVersion: require_min_version(),
|
|
17211
|
+
validRange: require_valid(),
|
|
17212
|
+
outside: require_outside(),
|
|
17213
|
+
gtr: require_gtr(),
|
|
17214
|
+
ltr: require_ltr(),
|
|
17215
|
+
intersects: require_intersects(),
|
|
17216
|
+
simplifyRange: require_simplify(),
|
|
17217
|
+
subset: require_subset(),
|
|
17218
|
+
SemVer,
|
|
17219
|
+
re: internalRe.re,
|
|
17220
|
+
src: internalRe.src,
|
|
17221
|
+
tokens: internalRe.t,
|
|
17222
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
17223
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
17224
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
17225
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
17226
|
+
};
|
|
17227
|
+
})))();
|
|
17228
|
+
function findAvailableUpdate(runningVersion, metadata) {
|
|
17229
|
+
const normalizedRunning = runningVersion ? (0, import_semver.valid)(runningVersion) : null;
|
|
17230
|
+
if (!normalizedRunning) return {
|
|
17231
|
+
available: false,
|
|
17232
|
+
reason: "invalid-running-version"
|
|
17233
|
+
};
|
|
17234
|
+
const runningPrerelease = (0, import_semver.prerelease)(normalizedRunning);
|
|
17235
|
+
const latestVersion = (runningPrerelease && runningPrerelease.length > 0 ? prereleaseCandidates(normalizedRunning, metadata.versions) : stableCandidates(metadata)).find((candidate) => (0, import_semver.gt)(candidate, normalizedRunning));
|
|
17236
|
+
if (!latestVersion) return {
|
|
17237
|
+
available: false,
|
|
17238
|
+
reason: "no-eligible-version"
|
|
17239
|
+
};
|
|
17240
|
+
return {
|
|
17241
|
+
available: true,
|
|
17242
|
+
runningVersion: normalizedRunning,
|
|
17243
|
+
latestVersion
|
|
17244
|
+
};
|
|
17245
|
+
}
|
|
17246
|
+
function stableCandidates(metadata) {
|
|
17247
|
+
const versions = /* @__PURE__ */ new Set();
|
|
17248
|
+
const latest = (0, import_semver.valid)(metadata.distTags.latest);
|
|
17249
|
+
if (latest && !(0, import_semver.prerelease)(latest)) versions.add(latest);
|
|
17250
|
+
for (const version of metadata.versions) {
|
|
17251
|
+
const normalized = (0, import_semver.valid)(version);
|
|
17252
|
+
if (normalized && !(0, import_semver.prerelease)(normalized)) versions.add(normalized);
|
|
17253
|
+
}
|
|
17254
|
+
return [...versions].sort(import_semver.rcompare);
|
|
17255
|
+
}
|
|
17256
|
+
function prereleaseCandidates(runningVersion, versions) {
|
|
17257
|
+
const running = (0, import_semver.parse)(runningVersion);
|
|
17258
|
+
const runningPrerelease = (0, import_semver.prerelease)(runningVersion);
|
|
17259
|
+
if (!running || !runningPrerelease?.length) return [];
|
|
17260
|
+
const runningIdentifier = String(runningPrerelease[0]);
|
|
17261
|
+
return versions.map((version) => (0, import_semver.valid)(version)).filter((version) => Boolean(version)).filter((version) => {
|
|
17262
|
+
const candidate = (0, import_semver.parse)(version);
|
|
17263
|
+
const candidatePrerelease = (0, import_semver.prerelease)(version);
|
|
17264
|
+
return Boolean(candidate) && candidate.major === running.major && candidate.minor === running.minor && candidate.patch === running.patch && candidatePrerelease?.length !== void 0 && candidatePrerelease.length > 0 && String(candidatePrerelease[0]) === runningIdentifier;
|
|
17265
|
+
}).sort(import_semver.rcompare);
|
|
17266
|
+
}
|
|
17267
|
+
//#endregion
|
|
17268
|
+
//#region src/update-check/notice.ts
|
|
17269
|
+
async function maybePrintUpdateNotice(options) {
|
|
17270
|
+
const now = options.now ?? Date.now();
|
|
17271
|
+
const eligibility = classifyUpdateNoticeEligibility({
|
|
17272
|
+
args: options.args,
|
|
17273
|
+
env: options.env,
|
|
17274
|
+
stderrIsTTY: options.stderrIsTTY
|
|
17275
|
+
});
|
|
17276
|
+
if (!options.version) return;
|
|
17277
|
+
const cache = readUpdateMetadataCache({
|
|
17278
|
+
...options,
|
|
17279
|
+
now
|
|
17280
|
+
});
|
|
17281
|
+
if (eligibility.eligible && cache?.status === "positive" && cache.usable) {
|
|
17282
|
+
const update = findAvailableUpdate(options.version, cache.metadata);
|
|
17283
|
+
if (update.available && shouldShowUpdateNotice(update.latestVersion, {
|
|
17284
|
+
...options,
|
|
17285
|
+
now
|
|
17286
|
+
})) try {
|
|
17287
|
+
const line = `Update available: caplets ${update.runningVersion} -> ${update.latestVersion}. Update with your package manager.\n`;
|
|
17288
|
+
if (options.writeErr) options.writeErr(line);
|
|
17289
|
+
else process.stderr.write(line);
|
|
17290
|
+
recordUpdateNoticeShown(update.latestVersion, {
|
|
17291
|
+
...options,
|
|
17292
|
+
now
|
|
17293
|
+
});
|
|
17294
|
+
} catch {}
|
|
17295
|
+
}
|
|
17296
|
+
if ((eligibility.eligible || eligibility.reason === "stdio") && options.refreshForLater && (!cache || cache.status === "positive" && !cache.fresh || cache.status === "negative" && !cache.fresh)) refreshUpdateMetadata({
|
|
17297
|
+
...options,
|
|
17298
|
+
now,
|
|
17299
|
+
fetcher: options.fetcher,
|
|
17300
|
+
signal: options.signal
|
|
17301
|
+
}).catch(() => void 0);
|
|
17302
|
+
}
|
|
17303
|
+
//#endregion
|
|
15409
17304
|
//#region src/cli.ts
|
|
15410
17305
|
async function runCli(args, io = {}) {
|
|
15411
17306
|
let observedExitCode = 0;
|
|
17307
|
+
let updateNoticeHandled = false;
|
|
15412
17308
|
const wrappedIo = {
|
|
15413
17309
|
...io,
|
|
15414
17310
|
setExitCode: (code) => {
|
|
@@ -15417,6 +17313,22 @@ async function runCli(args, io = {}) {
|
|
|
15417
17313
|
else process.exitCode = code;
|
|
15418
17314
|
}
|
|
15419
17315
|
};
|
|
17316
|
+
wrappedIo.maybePrintUpdateNotice = async () => {
|
|
17317
|
+
if (updateNoticeHandled) return;
|
|
17318
|
+
updateNoticeHandled = true;
|
|
17319
|
+
await maybePrintUpdateNotice({
|
|
17320
|
+
args,
|
|
17321
|
+
env: wrappedIo.env,
|
|
17322
|
+
version: wrappedIo.version,
|
|
17323
|
+
fetcher: wrappedIo.fetch,
|
|
17324
|
+
signal: wrappedIo.signal,
|
|
17325
|
+
stderrIsTTY: wrappedIo.stderrIsTTY ?? process.stderr.isTTY === true,
|
|
17326
|
+
writeErr: wrappedIo.writeErr,
|
|
17327
|
+
cacheDir: wrappedIo.updateCheckCacheDir ?? defaultUpdateCheckCacheDir(wrappedIo.env),
|
|
17328
|
+
stateDir: wrappedIo.updateCheckStateDir ?? defaultUpdateCheckStateDir(wrappedIo.env),
|
|
17329
|
+
refreshForLater: shouldRefreshUpdateMetadataForLater(args)
|
|
17330
|
+
}).catch(() => void 0);
|
|
17331
|
+
};
|
|
15420
17332
|
const program = createProgram(wrappedIo);
|
|
15421
17333
|
const trackedCommand = telemetryCommandFamilyFromArgs(args);
|
|
15422
17334
|
const startedAt = Date.now();
|
|
@@ -15432,6 +17344,7 @@ async function runCli(args, io = {}) {
|
|
|
15432
17344
|
"caplets",
|
|
15433
17345
|
...args
|
|
15434
17346
|
]);
|
|
17347
|
+
await wrappedIo.maybePrintUpdateNotice();
|
|
15435
17348
|
if (trackedCommand) await captureCliTelemetry(telemetryContext, {
|
|
15436
17349
|
debugSink: wrappedIo.telemetryDebugSink,
|
|
15437
17350
|
dispatcher,
|
|
@@ -15463,6 +17376,12 @@ async function runCli(args, io = {}) {
|
|
|
15463
17376
|
await dispatcher.shutdown();
|
|
15464
17377
|
}
|
|
15465
17378
|
}
|
|
17379
|
+
function shouldRefreshUpdateMetadataForLater(args) {
|
|
17380
|
+
const command = args[0];
|
|
17381
|
+
if (command === cliCommands$1.serve) return true;
|
|
17382
|
+
if (command !== cliCommands$1.attach) return false;
|
|
17383
|
+
return !args.some((arg) => arg === "--once");
|
|
17384
|
+
}
|
|
15466
17385
|
function normalizeCompletionWords(words) {
|
|
15467
17386
|
return words.map((word) => word === "__CAPLETS_TRAILING_SPACE__" ? "" : word);
|
|
15468
17387
|
}
|
|
@@ -16272,6 +18191,7 @@ function createProgram(io = {}) {
|
|
|
16272
18191
|
...io,
|
|
16273
18192
|
env: {
|
|
16274
18193
|
...env,
|
|
18194
|
+
CAPLETS_DISABLE_UPDATE_CHECK: "1",
|
|
16275
18195
|
CAPLETS_TELEMETRY_DEBUG: "1"
|
|
16276
18196
|
},
|
|
16277
18197
|
telemetryDebugSink: sink,
|
|
@@ -16345,7 +18265,7 @@ function createProgram(io = {}) {
|
|
|
16345
18265
|
printTelemetryNotice("serve");
|
|
16346
18266
|
const resolved = resolveServeOptions(options);
|
|
16347
18267
|
const configPath = currentConfigPath();
|
|
16348
|
-
|
|
18268
|
+
const runner = io.serve ?? ((serveOptions) => serveResolvedCaplets(serveOptions, {
|
|
16349
18269
|
...configPath ? { configPath } : {},
|
|
16350
18270
|
...io.authDir ? { authDir: io.authDir } : {},
|
|
16351
18271
|
telemetryEnv: env,
|
|
@@ -16353,7 +18273,9 @@ function createProgram(io = {}) {
|
|
|
16353
18273
|
telemetrySurface: "serve",
|
|
16354
18274
|
telemetryVisibility: "visible",
|
|
16355
18275
|
telemetryRuntimeMode: runtimeModeForEnv(env)
|
|
16356
|
-
}, writeErr))
|
|
18276
|
+
}, writeErr));
|
|
18277
|
+
await io.maybePrintUpdateNotice?.();
|
|
18278
|
+
await runner(resolved);
|
|
16357
18279
|
});
|
|
16358
18280
|
const daemonOptions = () => ({
|
|
16359
18281
|
env,
|
|
@@ -16489,6 +18411,7 @@ function createProgram(io = {}) {
|
|
|
16489
18411
|
};
|
|
16490
18412
|
if (!options.once) {
|
|
16491
18413
|
const resolved = await resolveAttachServeOptions(attachOptions, env);
|
|
18414
|
+
await io.maybePrintUpdateNotice?.();
|
|
16492
18415
|
await (io.attachServe ?? ((serveOptions) => attachResolvedCaplets(serveOptions, { writeErr })))(resolved);
|
|
16493
18416
|
return;
|
|
16494
18417
|
}
|
|
@@ -16876,17 +18799,16 @@ function createProgram(io = {}) {
|
|
|
16876
18799
|
writeOut(await runSetup(integration, setupOptions));
|
|
16877
18800
|
});
|
|
16878
18801
|
program.command(cliCommands$1.doctor).description("Diagnose Caplets local, remote, and project-sync configuration.").option("--json", "print JSON output").action(async (options) => {
|
|
18802
|
+
const doctorOptions = {
|
|
18803
|
+
env,
|
|
18804
|
+
...io.authDir ? { authDir: io.authDir } : {},
|
|
18805
|
+
...io.daemon ? { daemon: io.daemon } : {}
|
|
18806
|
+
};
|
|
16879
18807
|
if (options.json) {
|
|
16880
|
-
writeOut(`${JSON.stringify(await doctorJsonReport(
|
|
16881
|
-
env,
|
|
16882
|
-
...io.daemon ? { daemon: io.daemon } : {}
|
|
16883
|
-
}), null, 2)}\n`);
|
|
18808
|
+
writeOut(`${JSON.stringify(await doctorJsonReport(doctorOptions), null, 2)}\n`);
|
|
16884
18809
|
return;
|
|
16885
18810
|
}
|
|
16886
|
-
writeOut(await formatDoctorReport(
|
|
16887
|
-
env,
|
|
16888
|
-
...io.daemon ? { daemon: io.daemon } : {}
|
|
16889
|
-
}));
|
|
18811
|
+
writeOut(await formatDoctorReport(doctorOptions));
|
|
16890
18812
|
});
|
|
16891
18813
|
const vault = program.command(cliCommands$1.vault).description("Manage Caplets Vault values.");
|
|
16892
18814
|
vault.command("set").description("Set a local/global Vault value.").argument("<name>", "Vault key name").option("-g, --global", "target the local/global Vault").option("--remote", "target the selected remote Vault").option("--force", "overwrite an existing Vault value").option("--grant <capletId>", "grant this key to a configured Caplet after setting it").option("--as <referenceName>", "reference name the Caplet uses in config").option("--json", "print JSON output").action(async (name, options) => {
|