@sourcegraph/cody-web 0.33.0 → 0.34.0
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/{agent.worker-2jv6UYtG.mjs → agent.worker-BKTrW_fZ.mjs} +1791 -231
- package/dist/agent.worker.js +2 -2
- package/dist/{git-log-Sw0MOWAb.mjs → git-log-7kbEzZhk.mjs} +1 -1
- package/dist/index.js +562 -700
- package/dist/lib/agent/agent.client.d.ts.map +1 -1
- package/dist/{lite-ch5VbcSy.mjs → lite-BobkBW3_.mjs} +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{util-BcM-aRzi.mjs → util-CCLzYWyF.mjs} +1 -1
- package/dist/{vscode-shim-DCfZW3km.mjs → vscode-shim-DpWxvTpJ.mjs} +3920 -3780
- package/package.json +1 -1
|
@@ -17,9 +17,9 @@ var __privateWrapper = (obj, member, setter2, getter) => ({
|
|
|
17
17
|
return __privateGet2(obj, member, getter);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
var _a2, _b, _c, _d, _e, _constructing, _f, _g, _max, _maxSize, _dispose, _disposeAfter, _fetchMethod, _size, _calculatedSize, _keyMap, _keyList, _valList, _next, _prev, _head, _tail, _free, _disposed, _sizes, _starts, _ttls, _hasDispose, _hasFetchMethod, _hasDisposeAfter, _LRUCache_instances, initializeTTLTracking_fn, _updateItemAge, _statusTTL, _setItemTTL, _isStale, initializeSizeTracking_fn, _removeItemSize, _addItemSize, _requireSize, indexes_fn, rindexes_fn, isValidIndex_fn, evict_fn, backgroundFetch_fn, isBackgroundFetch_fn, connect_fn2, moveToTail_fn, _h, _i, _j, _k, _l;
|
|
21
|
-
import { O as Observable, aV as unsubscribe, aW as AsyncSerialScheduler, aX as authStatus, aY as pick, aZ as distinctUntilChanged$1, a_ as switchMapReplayOperation, a$ as pendingOperation, b0 as promiseFactoryToObservable, J as map$1, ad as isError$3, P as isDotCom, b1 as retry$1, b2 as logError$2, aG as firstResultFromOperation, b3 as graphqlClient, b4 as semver, b5 as debounceTime, b6 as interval, b7 as filter$
|
|
22
|
-
import { r as requireUtil, i as inherits_browserExports, a as utilExports } from "./util-
|
|
20
|
+
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn, _a2, _b, _c, _d, _e, _constructing, _f, _g, _max, _maxSize, _dispose, _disposeAfter, _fetchMethod, _size, _calculatedSize, _keyMap, _keyList, _valList, _next, _prev, _head, _tail, _free, _disposed, _sizes, _starts, _ttls, _hasDispose, _hasFetchMethod, _hasDisposeAfter, _LRUCache_instances, initializeTTLTracking_fn, _updateItemAge, _statusTTL, _setItemTTL, _isStale, initializeSizeTracking_fn, _removeItemSize, _addItemSize, _requireSize, indexes_fn, rindexes_fn, isValidIndex_fn, evict_fn, backgroundFetch_fn, isBackgroundFetch_fn, connect_fn2, moveToTail_fn, _h, _i, _j, _k, _l;
|
|
21
|
+
import { O as Observable, aV as unsubscribe, aW as AsyncSerialScheduler, aX as authStatus, aY as pick, aZ as distinctUntilChanged$1, a_ as switchMapReplayOperation, a$ as pendingOperation, b0 as promiseFactoryToObservable, J as map$1, ad as isError$3, P as isDotCom, b1 as retry$1, b2 as logError$2, aG as firstResultFromOperation, b3 as graphqlClient, b4 as semver, b5 as debounceTime, b6 as interval, b7 as filter$3, b8 as startWith$1, b9 as switchMap$1, at as firstValueFrom$1, au as skipPendingOperation, ba as logDebug$1, bb as isAbortError, ai as ModelTag, bc as getModelInfo, bd as CHAT_INPUT_TOKEN_BUDGET, be as CHAT_OUTPUT_TOKEN_BUDGET, bf as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, bg as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, bh as expand, ac as LRUCache$1, bi as TRANSIENT_REFETCH_INTERVAL_HINT, bj as createSubscriber, bk as fromVSCodeEvent, D as isEqual, bl as cenv, aE as lodashExports, bm as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, bn as isFileURI, w as wrapInActiveSpan, bo as INCLUDE_EVERYTHING_CONTEXT_FILTERS, bp as onAbort, bq as addCodyClientIdentificationHeaders, br as addTraceparent, bs as addAuthHeaders, bt as fetch$2, bu as verifyResponseCode, H as combineLatest$1, bv as take$2, bw as clientCapabilities, bx as shareReplay$1, by as tap$2, bz as featureFlagProvider, af as FeatureFlag, a7 as isCodyProUser, bA as isFreeUser, bB as telemetryRecorder, bC as getEnterpriseContextWindow, bD as ANSWER_TOKENS, bE as currentAuthStatusOrNotReadyYet, bF as mockAuthStatus, bG as storeLastValue, bH as resolvedConfig, bI as userProductSubscription, bJ as currentAuthStatus, bK as isEnterpriseUser, bL as ps, bM as GuardrailsMode, bN as currentResolvedConfig, aR as PromptString, a8 as CodyIDE, bO as CORPUS_CONTEXT_ALLOCATION, bP as isCustomModel, bQ as recordErrorToSpan, bR as addClientInfoParams, bS as dependentAbortController, F as FILE_CONTEXT_MENTION_PROVIDER, S as SYMBOL_CONTEXT_MENTION_PROVIDER, R as REMOTE_REPOSITORY_PROVIDER_URI, a as REMOTE_FILE_PROVIDER_URI, b as REMOTE_DIRECTORY_PROVIDER_URI, W as WEB_PROVIDER_URI, C as ContextItemSource, bT as isS2, bU as GIT_OPENCTX_PROVIDER_URI, bV as CODE_SEARCH_PROVIDER_URI, aa as cryptoJsExports, bW as currentOpenCtxController, m as URI, bX as MulticastSubject, bY as AsyncSerialScheduler_1, g as getDefaultExportFromCjs, bZ as workspace, p as path$1, b_ as vscode, b$ as Range, c0 as commands$1, c1 as window$1, c2 as Selection, U as Uri, c3 as AgentEventEmitter, c4 as MarkdownString, c5 as Disposable, c6 as TextEditorRevealType, c7 as ThemeIcon, c8 as StatusBarAlignment, c9 as readFile, ca as env, cb as UIKind, cc as languages$1, c as commonjsGlobal, cd as InvalidAccessTokenError, ce as _baseAssignValue, cf as eq_1, cg as isArrayLike_1, ch as isObjectLike_1, ci as _copyObject, cj as keysIn_1, ck as _cloneBufferExports, cl as _cloneTypedArray, cm as _copyArray, cn as _initCloneObject, co as isArguments_1, cp as isArray_1, cq as isBufferExports, cr as isFunction_1, cs as isObject_1, ct as isPlainObject_1, cu as isTypedArray_1, cv as _Stack, cw as identity_1, cx as _overRest, cy as _setToString, cz as _isIndex, Y as isSourcegraphToken, aD as v4, cA as CONFIG_KEY, aO as CodyAutoSuggestionMode, cB as ConfigurationTarget, cC as pathBrowserify, cD as stat, cE as extensions, cF as version$2, cG as setExtensionVersion, cH as withLatestFrom, cI as NEVER$1, cJ as abortableOperation, cK as isNeedsAuthChallengeError, cL as EMPTY$1, cM as disposableSubscription, cN as setAuthStatusObservable, cO as DOTCOM_URL, X as isAvailabilityError, cP as isInvalidAccessTokenError, cQ as normalizeServerEndpointURL, cR as isEnterpriseUserDotComError, cS as ProgressLocation, cT as AuthConfigError, cU as SourcegraphGraphQLAPIClient, cV as isExternalProviderAuthError, cW as isNetworkLikeError, cX as NeedsAuthChallengeError, cY as AvailabilityError, cZ as EnterpriseUserDotComError, c_ as resolveAuth, c$ as QuickPickItemKind, Q as isWorkspaceInstance, d0 as getAuthHeaders, d1 as toLightweightChatTranscript, d2 as SUPPORTED_URI_SCHEMAS, d3 as RelativePattern, d4 as _baseIsEqual, d5 as keys_1, d6 as _baseGet, d7 as _castPath, d8 as isLength_1, d9 as _toKey, da as _isKey, db as toNumber_1, dc as _baseFindIndex, dd as require$$0$2, de as NetworkError, df as isRateLimitError, V as isAuthError, dg as FileType, dh as dedent$1, di as FoldingRange, dj as CancellationTokenSource, dk as SymbolKind, dl as convertGitCloneURLToCodebaseName, aM as isDefined, dm as pluck, dn as toRangeData, dp as Position, dq as DefaultChatCommands, dr as pathFunctionsForURI, ds as uriParseNameAndExtension, dt as uriDirname, du as Utils$1, dv as uriExtname, dw as uriBasename, dx as DefaultEditCommands, dy as subscriptionDisposable, dz as updateGlobalTelemetryInstances, dA as TelemetryRecorderProvider, dB as telemetryRecorderProvider, dC as createGitDiff, dD as catchError$1, dE as AgentWorkspaceEdit, dF as TextDocumentChangeReason, dG as omit$1, dH as displayPathWithoutWorkspaceFolderPrefix, dI as getEditorInsertSpaces, dJ as escapeRegExp$1, dK as TimeoutError, dL as isNetworkError, dM as http, dN as open, dO as defer$2, dP as merge$2, dQ as ruleSearchPaths, dR as isRuleFilename, dS as parseRuleFile, dT as languageFromFilename, f as displayLineRange, e as displayPath, dU as ruleTitle, ao as isCodyProModel, dV as debounce_1, aQ as isErrorLike, dW as isWindows, dX as GLOBAL_SEARCH_PROVIDER_URI, dY as mentionProvidersMetadata, dZ as currentUserProductSubscription, d_ as checkIfEnterpriseUser, d$ as ThemeColor, e0 as QuickInputButtons, E as scanForMentionTriggerInUserTextInput, u as parseMentionQuery, L as LARGE_FILE_WARNING_LABEL, e1 as GENERAL_HELP_LABEL, a9 as CodyTaskState, e2 as CodeLens, e3 as defaultWebviewPanel, x as createExtensionAPI, y as createMessageAPIForWebview, e4 as EndOfLine, e5 as ViewColumn, e6 as Location, e7 as onDidChangeActiveTextEditor, e8 as tabGroups, e9 as workspaceTextDocuments, ea as visibleTextEditors, eb as onDidChangeVisibleTextEditors, ec as fs, ed as onDidCloseTextDocument, ee as setCreateWebviewPanel, ef as getAugmentedNamespace, eg as extensionConfiguration, eh as main$1, ei as setAgent, ej as setWorkspaceDocuments, ek as setLastOpenedWorkspaceFolder, el as onDidRegisterNewCodeActionProvider, em as onDidUnregisterNewCodeActionProvider, en as onDidRegisterNewCodeLensProvider, eo as onDidUnregisterNewCodeLensProvider, ep as setClientInfo, eq as AgentWorkspaceConfiguration, er as firstNonPendingAuthStatus, es as workspaceFolders$1, et as setWorkspaceFolders, eu as onDidChangeWorkspaceFolders, ev as onDidChangeWindowState, ew as onDidOpenTextDocument, ex as onDidSaveTextDocument, ey as onDidRenameFiles, ez as packageJson, eA as progressBars, eB as CodeActionTriggerKind, eC as CodeAction, eD as UriString, eE as DiagnosticSeverity, eF as diagnostics, eG as isIntegrationTesting, eH as TESTING_TELEMETRY_EXPORTER, eI as dist, eJ as completionProvider, eK as InlineCompletionTriggerKind, eL as currentAuthStatusAuthed, eM as waitUntilComplete, eN as setExtensionConfiguration, eO as onDidChangeConfiguration, eP as onDidChangeTextDocument, eQ as onDidChangeTextEditorSelection, eR as isTokenOrEndpointChange, ap as isMacOS, ar as CustomCommandType, aP as setDisplayPathEnvInfo, aJ as ACCOUNT_USAGE_URL, z as debounce$1, eS as structuredPatch, eT as isDotComAuthed, eU as dedupeWith$1, eV as AbortError, eW as createDisposables, eX as isNodeResponse, eY as getClientInfoQueryParams, eZ as tracer, e_ as getActiveTraceAndSpanId, e$ as getClientIdentificationHeaders, f0 as setJSONAcceptContentTypeHeaders, f1 as logResponseHeadersToSpan, f2 as isCustomAuthChallengeResponse, f3 as TracedError, $ as SpanStatusCode, ae as RateLimitError$1, f4 as capitalize, f5 as InlineCompletionItem, f6 as createTwoFilesPatch, f7 as vsCodeMocks, a2 as whitespace, a0 as svg, a3 as find$1, a4 as stringify$1, a5 as stringify$2, a6 as ccount, a1 as html$3, f8 as getEditorTabSize$1, f9 as metrics, fa as _, aF as deserializeContextItem, fb as editorStateFromPromptString, fc as _baseGetTag, ah as isAbortErrorOrSocketHangUp, fd as inputTextWithoutContextChipsFromPromptEditorState, aj as DeepCodyAgentID, fe as exec, s as spawn, ay as UIToolStatus, i as displayPathBasename, ff as expandToLineRange, fg as openctxController, fh as openCtxProviderMetadata, fi as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, aA as diffWithLineNum, aB as UITerminalOutputType, fj as getPlatform$1, fk as PromptMode, fl as skip$1, _ as context, fm as extractContextFromTraceparent, fn as isContextWindowLimitError, q as serializeContextItem, K as forceHydration, ag as reformatBotMessageForChat, M as hydrateAfterPostMessage, fo as addMessageListenersForExtensionAPI, fp as createMessageAPIForExtension, an as View, aH as ChatHistoryType, fq as CodeActionKind, ax as pluralize, fr as assertFileURI, d as RULES_PROVIDER_URI, fs as createCodeSearchProvider, ft as ProgrammingLanguage, fu as MAX_CURRENT_FILE_TOKENS, fv as psDedent, fw as formatRuleForPrompt, fx as posixFilePaths, fy as DecorationRangeBehavior, fz as SURROUNDING_LINES, fA as diffLines, fB as CODY_SUPPORT_URL, fC as CODY_DOC_URL, fD as CODY_FEEDBACK_URL, fE as DISCORD_URL, fF as globalAgentRef, fG as VSCODE_CHANGELOG_URL, fH as SG_CHANGELOG_URL, fI as ACCOUNT_LIMITS_INFO_URL, fJ as assertUnreachable, fK as promise, fL as ExtensionMode, fM as setLogger, fN as setClientCapabilities, fO as setResolvedConfigurationObservable, fP as setClientNameVersion, fQ as setOpenCtxControllerObservable, aL as isPlgEsAccessDisabled, aN as browser$4 } from "./vscode-shim-DpWxvTpJ.mjs";
|
|
22
|
+
import { r as requireUtil, i as inherits_browserExports, a as utilExports } from "./util-CCLzYWyF.mjs";
|
|
23
23
|
var NOTHING = Symbol.for("immer-nothing");
|
|
24
24
|
var DRAFTABLE = Symbol.for("immer-draftable");
|
|
25
25
|
var DRAFT_STATE = Symbol.for("immer-state");
|
|
@@ -674,7 +674,7 @@ var __awaiter = function(thisArg, _arguments, P, generator) {
|
|
|
674
674
|
step6((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
675
675
|
});
|
|
676
676
|
};
|
|
677
|
-
function filter$
|
|
677
|
+
function filter$2(test) {
|
|
678
678
|
return (observable) => {
|
|
679
679
|
return new Observable((observer) => {
|
|
680
680
|
const scheduler = new AsyncSerialScheduler(observer);
|
|
@@ -697,13 +697,13 @@ function filter$1(test) {
|
|
|
697
697
|
});
|
|
698
698
|
};
|
|
699
699
|
}
|
|
700
|
-
var define_process_default$
|
|
700
|
+
var define_process_default$o = { env: {} };
|
|
701
701
|
let _editorWindowIsFocused;
|
|
702
702
|
function setEditorWindowIsFocused(editorWindowIsFocused2) {
|
|
703
703
|
_editorWindowIsFocused = editorWindowIsFocused2;
|
|
704
704
|
}
|
|
705
705
|
function editorWindowIsFocused() {
|
|
706
|
-
if (define_process_default$
|
|
706
|
+
if (define_process_default$o.env.VITEST) {
|
|
707
707
|
return true;
|
|
708
708
|
}
|
|
709
709
|
if (!_editorWindowIsFocused) {
|
|
@@ -830,7 +830,7 @@ function parseDateFromPreReleaseVersion(version2) {
|
|
|
830
830
|
return void 0;
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
|
-
var define_process_default$
|
|
833
|
+
var define_process_default$n = { env: {} };
|
|
834
834
|
const _ClientConfigSingleton = class _ClientConfigSingleton {
|
|
835
835
|
constructor() {
|
|
836
836
|
// Default values for the legacy GraphQL features API, used when a Sourcegraph instance
|
|
@@ -855,7 +855,7 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
|
|
|
855
855
|
// activity that can cause OS warnings or authorization flows when the
|
|
856
856
|
// user is not using Cody. See
|
|
857
857
|
// linear.app/sourcegraph/issue/CODY-3745/codys-background-periodic-network-access-causes-2fa.
|
|
858
|
-
filter$
|
|
858
|
+
filter$3((_value) => editorWindowIsFocused()),
|
|
859
859
|
startWith$1(void 0),
|
|
860
860
|
switchMap$1(
|
|
861
861
|
() => promiseFactoryToObservable((signal2) => this.fetchConfig(signal2))
|
|
@@ -867,7 +867,7 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
|
|
|
867
867
|
distinctUntilChanged$1()
|
|
868
868
|
));
|
|
869
869
|
__publicField2(this, "updates", this.changes.pipe(
|
|
870
|
-
filter$
|
|
870
|
+
filter$3((value) => value !== void 0 && value !== pendingOperation),
|
|
871
871
|
distinctUntilChanged$1()
|
|
872
872
|
));
|
|
873
873
|
}
|
|
@@ -1014,7 +1014,7 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
|
|
|
1014
1014
|
};
|
|
1015
1015
|
__publicField2(_ClientConfigSingleton, "instance");
|
|
1016
1016
|
// REFETCH_INTERVAL is only updated via process.env during test execution, otherwise it is 60 seconds.
|
|
1017
|
-
__publicField2(_ClientConfigSingleton, "REFETCH_INTERVAL", define_process_default$
|
|
1017
|
+
__publicField2(_ClientConfigSingleton, "REFETCH_INTERVAL", define_process_default$n.env.CODY_CLIENT_CONFIG_SINGLETON_REFETCH_INTERVAL ? Number.parseInt(define_process_default$n.env.CODY_CLIENT_CONFIG_SINGLETON_REFETCH_INTERVAL, 10) : 60 * 1e3);
|
|
1018
1018
|
let ClientConfigSingleton = _ClientConfigSingleton;
|
|
1019
1019
|
const configOverwrites = authStatus.pipe(
|
|
1020
1020
|
pick("authenticated", "endpoint", "pendingValidation"),
|
|
@@ -1199,7 +1199,7 @@ createModel({
|
|
|
1199
1199
|
usage: [ModelUsage.Chat],
|
|
1200
1200
|
tags: [ModelTag.Enterprise]
|
|
1201
1201
|
});
|
|
1202
|
-
var define_process_default$
|
|
1202
|
+
var define_process_default$m = { env: {} };
|
|
1203
1203
|
const version$1 = "0.5.1";
|
|
1204
1204
|
class ResponseError extends Error {
|
|
1205
1205
|
constructor(error, status_code) {
|
|
@@ -1239,8 +1239,8 @@ const checkOk = async (response) => {
|
|
|
1239
1239
|
function getPlatform() {
|
|
1240
1240
|
if (typeof window !== "undefined" && window.navigator) {
|
|
1241
1241
|
return `${window.navigator.platform.toLowerCase()} Browser/${navigator.userAgent};`;
|
|
1242
|
-
} else if (typeof define_process_default$
|
|
1243
|
-
return `${define_process_default$
|
|
1242
|
+
} else if (typeof define_process_default$m !== "undefined") {
|
|
1243
|
+
return `${define_process_default$m.arch} ${define_process_default$m.platform} Node.js/${define_process_default$m.version}`;
|
|
1244
1244
|
}
|
|
1245
1245
|
return "";
|
|
1246
1246
|
}
|
|
@@ -1483,6 +1483,1344 @@ let Ollama$1 = class Ollama {
|
|
|
1483
1483
|
}
|
|
1484
1484
|
};
|
|
1485
1485
|
const browser$3 = new Ollama$1();
|
|
1486
|
+
const MAX_PATTERN_LENGTH = 1024 * 64;
|
|
1487
|
+
const assertValidPattern = (pattern) => {
|
|
1488
|
+
if (typeof pattern !== "string") {
|
|
1489
|
+
throw new TypeError("invalid pattern");
|
|
1490
|
+
}
|
|
1491
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
1492
|
+
throw new TypeError("pattern is too long");
|
|
1493
|
+
}
|
|
1494
|
+
};
|
|
1495
|
+
const posixClasses = {
|
|
1496
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
1497
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
1498
|
+
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
1499
|
+
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
1500
|
+
"[:cntrl:]": ["\\p{Cc}", true],
|
|
1501
|
+
"[:digit:]": ["\\p{Nd}", true],
|
|
1502
|
+
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
1503
|
+
"[:lower:]": ["\\p{Ll}", true],
|
|
1504
|
+
"[:print:]": ["\\p{C}", true],
|
|
1505
|
+
"[:punct:]": ["\\p{P}", true],
|
|
1506
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
1507
|
+
"[:upper:]": ["\\p{Lu}", true],
|
|
1508
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
1509
|
+
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
1510
|
+
};
|
|
1511
|
+
const braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
1512
|
+
const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1513
|
+
const rangesToString = (ranges2) => ranges2.join("");
|
|
1514
|
+
const parseClass = (glob, position) => {
|
|
1515
|
+
const pos2 = position;
|
|
1516
|
+
if (glob.charAt(pos2) !== "[") {
|
|
1517
|
+
throw new Error("not in a brace expression");
|
|
1518
|
+
}
|
|
1519
|
+
const ranges2 = [];
|
|
1520
|
+
const negs = [];
|
|
1521
|
+
let i2 = pos2 + 1;
|
|
1522
|
+
let sawStart = false;
|
|
1523
|
+
let uflag = false;
|
|
1524
|
+
let escaping = false;
|
|
1525
|
+
let negate = false;
|
|
1526
|
+
let endPos = pos2;
|
|
1527
|
+
let rangeStart = "";
|
|
1528
|
+
WHILE: while (i2 < glob.length) {
|
|
1529
|
+
const c = glob.charAt(i2);
|
|
1530
|
+
if ((c === "!" || c === "^") && i2 === pos2 + 1) {
|
|
1531
|
+
negate = true;
|
|
1532
|
+
i2++;
|
|
1533
|
+
continue;
|
|
1534
|
+
}
|
|
1535
|
+
if (c === "]" && sawStart && !escaping) {
|
|
1536
|
+
endPos = i2 + 1;
|
|
1537
|
+
break;
|
|
1538
|
+
}
|
|
1539
|
+
sawStart = true;
|
|
1540
|
+
if (c === "\\") {
|
|
1541
|
+
if (!escaping) {
|
|
1542
|
+
escaping = true;
|
|
1543
|
+
i2++;
|
|
1544
|
+
continue;
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
if (c === "[" && !escaping) {
|
|
1548
|
+
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
1549
|
+
if (glob.startsWith(cls, i2)) {
|
|
1550
|
+
if (rangeStart) {
|
|
1551
|
+
return ["$.", false, glob.length - pos2, true];
|
|
1552
|
+
}
|
|
1553
|
+
i2 += cls.length;
|
|
1554
|
+
if (neg)
|
|
1555
|
+
negs.push(unip);
|
|
1556
|
+
else
|
|
1557
|
+
ranges2.push(unip);
|
|
1558
|
+
uflag = uflag || u;
|
|
1559
|
+
continue WHILE;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
escaping = false;
|
|
1564
|
+
if (rangeStart) {
|
|
1565
|
+
if (c > rangeStart) {
|
|
1566
|
+
ranges2.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
1567
|
+
} else if (c === rangeStart) {
|
|
1568
|
+
ranges2.push(braceEscape(c));
|
|
1569
|
+
}
|
|
1570
|
+
rangeStart = "";
|
|
1571
|
+
i2++;
|
|
1572
|
+
continue;
|
|
1573
|
+
}
|
|
1574
|
+
if (glob.startsWith("-]", i2 + 1)) {
|
|
1575
|
+
ranges2.push(braceEscape(c + "-"));
|
|
1576
|
+
i2 += 2;
|
|
1577
|
+
continue;
|
|
1578
|
+
}
|
|
1579
|
+
if (glob.startsWith("-", i2 + 1)) {
|
|
1580
|
+
rangeStart = c;
|
|
1581
|
+
i2 += 2;
|
|
1582
|
+
continue;
|
|
1583
|
+
}
|
|
1584
|
+
ranges2.push(braceEscape(c));
|
|
1585
|
+
i2++;
|
|
1586
|
+
}
|
|
1587
|
+
if (endPos < i2) {
|
|
1588
|
+
return ["", false, 0, false];
|
|
1589
|
+
}
|
|
1590
|
+
if (!ranges2.length && !negs.length) {
|
|
1591
|
+
return ["$.", false, glob.length - pos2, true];
|
|
1592
|
+
}
|
|
1593
|
+
if (negs.length === 0 && ranges2.length === 1 && /^\\?.$/.test(ranges2[0]) && !negate) {
|
|
1594
|
+
const r2 = ranges2[0].length === 2 ? ranges2[0].slice(-1) : ranges2[0];
|
|
1595
|
+
return [regexpEscape(r2), false, endPos - pos2, false];
|
|
1596
|
+
}
|
|
1597
|
+
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges2) + "]";
|
|
1598
|
+
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
1599
|
+
const comb = ranges2.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges2.length ? sranges : snegs;
|
|
1600
|
+
return [comb, uflag, endPos - pos2, true];
|
|
1601
|
+
};
|
|
1602
|
+
const unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
1603
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
1604
|
+
};
|
|
1605
|
+
const types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
1606
|
+
const isExtglobType = (c) => types.has(c);
|
|
1607
|
+
const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
1608
|
+
const startNoDot = "(?!\\.)";
|
|
1609
|
+
const addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
|
1610
|
+
const justDots = /* @__PURE__ */ new Set(["..", "."]);
|
|
1611
|
+
const reSpecials = new Set("().*{}+?[]^$\\!");
|
|
1612
|
+
const regExpEscape$1 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1613
|
+
const qmark$1 = "[^/]";
|
|
1614
|
+
const star$2 = qmark$1 + "*?";
|
|
1615
|
+
const starNoEmpty = qmark$1 + "+?";
|
|
1616
|
+
const _AST = class _AST {
|
|
1617
|
+
constructor(type, parent, options = {}) {
|
|
1618
|
+
__privateAdd2(this, _AST_instances);
|
|
1619
|
+
__publicField2(this, "type");
|
|
1620
|
+
__privateAdd2(this, _root);
|
|
1621
|
+
__privateAdd2(this, _hasMagic);
|
|
1622
|
+
__privateAdd2(this, _uflag, false);
|
|
1623
|
+
__privateAdd2(this, _parts, []);
|
|
1624
|
+
__privateAdd2(this, _parent);
|
|
1625
|
+
__privateAdd2(this, _parentIndex);
|
|
1626
|
+
__privateAdd2(this, _negs);
|
|
1627
|
+
__privateAdd2(this, _filledNegs, false);
|
|
1628
|
+
__privateAdd2(this, _options);
|
|
1629
|
+
__privateAdd2(this, _toString);
|
|
1630
|
+
// set to true if it's an extglob with no children
|
|
1631
|
+
// (which really means one child of '')
|
|
1632
|
+
__privateAdd2(this, _emptyExt, false);
|
|
1633
|
+
this.type = type;
|
|
1634
|
+
if (type)
|
|
1635
|
+
__privateSet2(this, _hasMagic, true);
|
|
1636
|
+
__privateSet2(this, _parent, parent);
|
|
1637
|
+
__privateSet2(this, _root, __privateGet2(this, _parent) ? __privateGet2(__privateGet2(this, _parent), _root) : this);
|
|
1638
|
+
__privateSet2(this, _options, __privateGet2(this, _root) === this ? options : __privateGet2(__privateGet2(this, _root), _options));
|
|
1639
|
+
__privateSet2(this, _negs, __privateGet2(this, _root) === this ? [] : __privateGet2(__privateGet2(this, _root), _negs));
|
|
1640
|
+
if (type === "!" && !__privateGet2(__privateGet2(this, _root), _filledNegs))
|
|
1641
|
+
__privateGet2(this, _negs).push(this);
|
|
1642
|
+
__privateSet2(this, _parentIndex, __privateGet2(this, _parent) ? __privateGet2(__privateGet2(this, _parent), _parts).length : 0);
|
|
1643
|
+
}
|
|
1644
|
+
get hasMagic() {
|
|
1645
|
+
if (__privateGet2(this, _hasMagic) !== void 0)
|
|
1646
|
+
return __privateGet2(this, _hasMagic);
|
|
1647
|
+
for (const p2 of __privateGet2(this, _parts)) {
|
|
1648
|
+
if (typeof p2 === "string")
|
|
1649
|
+
continue;
|
|
1650
|
+
if (p2.type || p2.hasMagic)
|
|
1651
|
+
return __privateSet2(this, _hasMagic, true);
|
|
1652
|
+
}
|
|
1653
|
+
return __privateGet2(this, _hasMagic);
|
|
1654
|
+
}
|
|
1655
|
+
// reconstructs the pattern
|
|
1656
|
+
toString() {
|
|
1657
|
+
if (__privateGet2(this, _toString) !== void 0)
|
|
1658
|
+
return __privateGet2(this, _toString);
|
|
1659
|
+
if (!this.type) {
|
|
1660
|
+
return __privateSet2(this, _toString, __privateGet2(this, _parts).map((p2) => String(p2)).join(""));
|
|
1661
|
+
} else {
|
|
1662
|
+
return __privateSet2(this, _toString, this.type + "(" + __privateGet2(this, _parts).map((p2) => String(p2)).join("|") + ")");
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
push(...parts2) {
|
|
1666
|
+
for (const p2 of parts2) {
|
|
1667
|
+
if (p2 === "")
|
|
1668
|
+
continue;
|
|
1669
|
+
if (typeof p2 !== "string" && !(p2 instanceof _AST && __privateGet2(p2, _parent) === this)) {
|
|
1670
|
+
throw new Error("invalid part: " + p2);
|
|
1671
|
+
}
|
|
1672
|
+
__privateGet2(this, _parts).push(p2);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
toJSON() {
|
|
1676
|
+
var _a3;
|
|
1677
|
+
const ret2 = this.type === null ? __privateGet2(this, _parts).slice().map((p2) => typeof p2 === "string" ? p2 : p2.toJSON()) : [this.type, ...__privateGet2(this, _parts).map((p2) => p2.toJSON())];
|
|
1678
|
+
if (this.isStart() && !this.type)
|
|
1679
|
+
ret2.unshift([]);
|
|
1680
|
+
if (this.isEnd() && (this === __privateGet2(this, _root) || __privateGet2(__privateGet2(this, _root), _filledNegs) && ((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.type) === "!")) {
|
|
1681
|
+
ret2.push({});
|
|
1682
|
+
}
|
|
1683
|
+
return ret2;
|
|
1684
|
+
}
|
|
1685
|
+
isStart() {
|
|
1686
|
+
var _a3;
|
|
1687
|
+
if (__privateGet2(this, _root) === this)
|
|
1688
|
+
return true;
|
|
1689
|
+
if (!((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.isStart()))
|
|
1690
|
+
return false;
|
|
1691
|
+
if (__privateGet2(this, _parentIndex) === 0)
|
|
1692
|
+
return true;
|
|
1693
|
+
const p2 = __privateGet2(this, _parent);
|
|
1694
|
+
for (let i2 = 0; i2 < __privateGet2(this, _parentIndex); i2++) {
|
|
1695
|
+
const pp = __privateGet2(p2, _parts)[i2];
|
|
1696
|
+
if (!(pp instanceof _AST && pp.type === "!")) {
|
|
1697
|
+
return false;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
return true;
|
|
1701
|
+
}
|
|
1702
|
+
isEnd() {
|
|
1703
|
+
var _a3, _b2, _c2;
|
|
1704
|
+
if (__privateGet2(this, _root) === this)
|
|
1705
|
+
return true;
|
|
1706
|
+
if (((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.type) === "!")
|
|
1707
|
+
return true;
|
|
1708
|
+
if (!((_b2 = __privateGet2(this, _parent)) == null ? void 0 : _b2.isEnd()))
|
|
1709
|
+
return false;
|
|
1710
|
+
if (!this.type)
|
|
1711
|
+
return (_c2 = __privateGet2(this, _parent)) == null ? void 0 : _c2.isEnd();
|
|
1712
|
+
const pl = __privateGet2(this, _parent) ? __privateGet2(__privateGet2(this, _parent), _parts).length : 0;
|
|
1713
|
+
return __privateGet2(this, _parentIndex) === pl - 1;
|
|
1714
|
+
}
|
|
1715
|
+
copyIn(part) {
|
|
1716
|
+
if (typeof part === "string")
|
|
1717
|
+
this.push(part);
|
|
1718
|
+
else
|
|
1719
|
+
this.push(part.clone(this));
|
|
1720
|
+
}
|
|
1721
|
+
clone(parent) {
|
|
1722
|
+
const c = new _AST(this.type, parent);
|
|
1723
|
+
for (const p2 of __privateGet2(this, _parts)) {
|
|
1724
|
+
c.copyIn(p2);
|
|
1725
|
+
}
|
|
1726
|
+
return c;
|
|
1727
|
+
}
|
|
1728
|
+
static fromGlob(pattern, options = {}) {
|
|
1729
|
+
var _a3;
|
|
1730
|
+
const ast = new _AST(null, void 0, options);
|
|
1731
|
+
__privateMethod2(_a3 = _AST, _AST_static, parseAST_fn).call(_a3, pattern, ast, 0, options);
|
|
1732
|
+
return ast;
|
|
1733
|
+
}
|
|
1734
|
+
// returns the regular expression if there's magic, or the unescaped
|
|
1735
|
+
// string if not.
|
|
1736
|
+
toMMPattern() {
|
|
1737
|
+
if (this !== __privateGet2(this, _root))
|
|
1738
|
+
return __privateGet2(this, _root).toMMPattern();
|
|
1739
|
+
const glob = this.toString();
|
|
1740
|
+
const [re, body2, hasMagic, uflag] = this.toRegExpSource();
|
|
1741
|
+
const anyMagic = hasMagic || __privateGet2(this, _hasMagic) || __privateGet2(this, _options).nocase && !__privateGet2(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
1742
|
+
if (!anyMagic) {
|
|
1743
|
+
return body2;
|
|
1744
|
+
}
|
|
1745
|
+
const flags2 = (__privateGet2(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
|
|
1746
|
+
return Object.assign(new RegExp(`^${re}$`, flags2), {
|
|
1747
|
+
_src: re,
|
|
1748
|
+
_glob: glob
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
get options() {
|
|
1752
|
+
return __privateGet2(this, _options);
|
|
1753
|
+
}
|
|
1754
|
+
// returns the string match, the regexp source, whether there's magic
|
|
1755
|
+
// in the regexp (so a regular expression is required) and whether or
|
|
1756
|
+
// not the uflag is needed for the regular expression (for posix classes)
|
|
1757
|
+
// TODO: instead of injecting the start/end at this point, just return
|
|
1758
|
+
// the BODY of the regexp, along with the start/end portions suitable
|
|
1759
|
+
// for binding the start/end in either a joined full-path makeRe context
|
|
1760
|
+
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
1761
|
+
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
1762
|
+
//
|
|
1763
|
+
// In part-matching mode, the start is:
|
|
1764
|
+
// - if not isStart: nothing
|
|
1765
|
+
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
1766
|
+
// - if dots allowed or not possible: ^
|
|
1767
|
+
// - if dots possible and not allowed: ^(?!\.)
|
|
1768
|
+
// end is:
|
|
1769
|
+
// - if not isEnd(): nothing
|
|
1770
|
+
// - else: $
|
|
1771
|
+
//
|
|
1772
|
+
// In full-path matching mode, we put the slash at the START of the
|
|
1773
|
+
// pattern, so start is:
|
|
1774
|
+
// - if first pattern: same as part-matching mode
|
|
1775
|
+
// - if not isStart(): nothing
|
|
1776
|
+
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
1777
|
+
// - if dots allowed or not possible: /
|
|
1778
|
+
// - if dots possible and not allowed: /(?!\.)
|
|
1779
|
+
// end is:
|
|
1780
|
+
// - if last pattern, same as part-matching mode
|
|
1781
|
+
// - else nothing
|
|
1782
|
+
//
|
|
1783
|
+
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
1784
|
+
// there to bind the end of the negated pattern portion, and it's easier to
|
|
1785
|
+
// just stick it in now rather than try to inject it later in the middle of
|
|
1786
|
+
// the pattern.
|
|
1787
|
+
//
|
|
1788
|
+
// We can just always return the same end, and leave it up to the caller
|
|
1789
|
+
// to know whether it's going to be used joined or in parts.
|
|
1790
|
+
// And, if the start is adjusted slightly, can do the same there:
|
|
1791
|
+
// - if not isStart: nothing
|
|
1792
|
+
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
1793
|
+
// - if dots allowed or not possible: (?:/|^)
|
|
1794
|
+
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
1795
|
+
//
|
|
1796
|
+
// But it's better to have a simpler binding without a conditional, for
|
|
1797
|
+
// performance, so probably better to return both start options.
|
|
1798
|
+
//
|
|
1799
|
+
// Then the caller just ignores the end if it's not the first pattern,
|
|
1800
|
+
// and the start always gets applied.
|
|
1801
|
+
//
|
|
1802
|
+
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
1803
|
+
// so the caller can just attach $ at the end of the pattern when building.
|
|
1804
|
+
//
|
|
1805
|
+
// So the todo is:
|
|
1806
|
+
// - better detect what kind of start is needed
|
|
1807
|
+
// - return both flavors of starting pattern
|
|
1808
|
+
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
1809
|
+
//
|
|
1810
|
+
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
1811
|
+
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
1812
|
+
// that dot prevention biz to live in the extglob portions, because eg
|
|
1813
|
+
// +(*|.x*) can match .xy but not .yx.
|
|
1814
|
+
//
|
|
1815
|
+
// So, return the two flavors if it's #root and the first child is not an
|
|
1816
|
+
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
1817
|
+
// use the (?:^|/) style of start binding.
|
|
1818
|
+
//
|
|
1819
|
+
// Even simplified further:
|
|
1820
|
+
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
1821
|
+
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
1822
|
+
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
1823
|
+
toRegExpSource(allowDot) {
|
|
1824
|
+
var _a3;
|
|
1825
|
+
const dot2 = allowDot ?? !!__privateGet2(this, _options).dot;
|
|
1826
|
+
if (__privateGet2(this, _root) === this)
|
|
1827
|
+
__privateMethod2(this, _AST_instances, fillNegs_fn).call(this);
|
|
1828
|
+
if (!this.type) {
|
|
1829
|
+
const noEmpty = this.isStart() && this.isEnd();
|
|
1830
|
+
const src = __privateGet2(this, _parts).map((p2) => {
|
|
1831
|
+
var _a4;
|
|
1832
|
+
const [re, _2, hasMagic, uflag] = typeof p2 === "string" ? __privateMethod2(_a4 = _AST, _AST_static, parseGlob_fn).call(_a4, p2, __privateGet2(this, _hasMagic), noEmpty) : p2.toRegExpSource(allowDot);
|
|
1833
|
+
__privateSet2(this, _hasMagic, __privateGet2(this, _hasMagic) || hasMagic);
|
|
1834
|
+
__privateSet2(this, _uflag, __privateGet2(this, _uflag) || uflag);
|
|
1835
|
+
return re;
|
|
1836
|
+
}).join("");
|
|
1837
|
+
let start3 = "";
|
|
1838
|
+
if (this.isStart()) {
|
|
1839
|
+
if (typeof __privateGet2(this, _parts)[0] === "string") {
|
|
1840
|
+
const dotTravAllowed = __privateGet2(this, _parts).length === 1 && justDots.has(__privateGet2(this, _parts)[0]);
|
|
1841
|
+
if (!dotTravAllowed) {
|
|
1842
|
+
const aps = addPatternStart;
|
|
1843
|
+
const needNoTrav = (
|
|
1844
|
+
// dots are allowed, and the pattern starts with [ or .
|
|
1845
|
+
dot2 && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
1846
|
+
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
1847
|
+
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
|
|
1848
|
+
);
|
|
1849
|
+
const needNoDot = !dot2 && !allowDot && aps.has(src.charAt(0));
|
|
1850
|
+
start3 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
let end = "";
|
|
1855
|
+
if (this.isEnd() && __privateGet2(__privateGet2(this, _root), _filledNegs) && ((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.type) === "!") {
|
|
1856
|
+
end = "(?:$|\\/)";
|
|
1857
|
+
}
|
|
1858
|
+
const final2 = start3 + src + end;
|
|
1859
|
+
return [
|
|
1860
|
+
final2,
|
|
1861
|
+
unescape(src),
|
|
1862
|
+
__privateSet2(this, _hasMagic, !!__privateGet2(this, _hasMagic)),
|
|
1863
|
+
__privateGet2(this, _uflag)
|
|
1864
|
+
];
|
|
1865
|
+
}
|
|
1866
|
+
const repeated = this.type === "*" || this.type === "+";
|
|
1867
|
+
const start2 = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
1868
|
+
let body2 = __privateMethod2(this, _AST_instances, partsToRegExp_fn).call(this, dot2);
|
|
1869
|
+
if (this.isStart() && this.isEnd() && !body2 && this.type !== "!") {
|
|
1870
|
+
const s = this.toString();
|
|
1871
|
+
__privateSet2(this, _parts, [s]);
|
|
1872
|
+
this.type = null;
|
|
1873
|
+
__privateSet2(this, _hasMagic, void 0);
|
|
1874
|
+
return [s, unescape(this.toString()), false, false];
|
|
1875
|
+
}
|
|
1876
|
+
let bodyDotAllowed = !repeated || allowDot || dot2 || !startNoDot ? "" : __privateMethod2(this, _AST_instances, partsToRegExp_fn).call(this, true);
|
|
1877
|
+
if (bodyDotAllowed === body2) {
|
|
1878
|
+
bodyDotAllowed = "";
|
|
1879
|
+
}
|
|
1880
|
+
if (bodyDotAllowed) {
|
|
1881
|
+
body2 = `(?:${body2})(?:${bodyDotAllowed})*?`;
|
|
1882
|
+
}
|
|
1883
|
+
let final = "";
|
|
1884
|
+
if (this.type === "!" && __privateGet2(this, _emptyExt)) {
|
|
1885
|
+
final = (this.isStart() && !dot2 ? startNoDot : "") + starNoEmpty;
|
|
1886
|
+
} else {
|
|
1887
|
+
const close = this.type === "!" ? (
|
|
1888
|
+
// !() must match something,but !(x) can match ''
|
|
1889
|
+
"))" + (this.isStart() && !dot2 && !allowDot ? startNoDot : "") + star$2 + ")"
|
|
1890
|
+
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
1891
|
+
final = start2 + body2 + close;
|
|
1892
|
+
}
|
|
1893
|
+
return [
|
|
1894
|
+
final,
|
|
1895
|
+
unescape(body2),
|
|
1896
|
+
__privateSet2(this, _hasMagic, !!__privateGet2(this, _hasMagic)),
|
|
1897
|
+
__privateGet2(this, _uflag)
|
|
1898
|
+
];
|
|
1899
|
+
}
|
|
1900
|
+
};
|
|
1901
|
+
_root = new WeakMap();
|
|
1902
|
+
_hasMagic = new WeakMap();
|
|
1903
|
+
_uflag = new WeakMap();
|
|
1904
|
+
_parts = new WeakMap();
|
|
1905
|
+
_parent = new WeakMap();
|
|
1906
|
+
_parentIndex = new WeakMap();
|
|
1907
|
+
_negs = new WeakMap();
|
|
1908
|
+
_filledNegs = new WeakMap();
|
|
1909
|
+
_options = new WeakMap();
|
|
1910
|
+
_toString = new WeakMap();
|
|
1911
|
+
_emptyExt = new WeakMap();
|
|
1912
|
+
_AST_instances = new WeakSet();
|
|
1913
|
+
fillNegs_fn = function() {
|
|
1914
|
+
if (this !== __privateGet2(this, _root))
|
|
1915
|
+
throw new Error("should only call on root");
|
|
1916
|
+
if (__privateGet2(this, _filledNegs))
|
|
1917
|
+
return this;
|
|
1918
|
+
this.toString();
|
|
1919
|
+
__privateSet2(this, _filledNegs, true);
|
|
1920
|
+
let n;
|
|
1921
|
+
while (n = __privateGet2(this, _negs).pop()) {
|
|
1922
|
+
if (n.type !== "!")
|
|
1923
|
+
continue;
|
|
1924
|
+
let p2 = n;
|
|
1925
|
+
let pp = __privateGet2(p2, _parent);
|
|
1926
|
+
while (pp) {
|
|
1927
|
+
for (let i2 = __privateGet2(p2, _parentIndex) + 1; !pp.type && i2 < __privateGet2(pp, _parts).length; i2++) {
|
|
1928
|
+
for (const part of __privateGet2(n, _parts)) {
|
|
1929
|
+
if (typeof part === "string") {
|
|
1930
|
+
throw new Error("string part in extglob AST??");
|
|
1931
|
+
}
|
|
1932
|
+
part.copyIn(__privateGet2(pp, _parts)[i2]);
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
p2 = pp;
|
|
1936
|
+
pp = __privateGet2(p2, _parent);
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
return this;
|
|
1940
|
+
};
|
|
1941
|
+
_AST_static = new WeakSet();
|
|
1942
|
+
parseAST_fn = function(str, ast, pos2, opt) {
|
|
1943
|
+
var _a3, _b2;
|
|
1944
|
+
let escaping = false;
|
|
1945
|
+
let inBrace = false;
|
|
1946
|
+
let braceStart = -1;
|
|
1947
|
+
let braceNeg = false;
|
|
1948
|
+
if (ast.type === null) {
|
|
1949
|
+
let i3 = pos2;
|
|
1950
|
+
let acc2 = "";
|
|
1951
|
+
while (i3 < str.length) {
|
|
1952
|
+
const c = str.charAt(i3++);
|
|
1953
|
+
if (escaping || c === "\\") {
|
|
1954
|
+
escaping = !escaping;
|
|
1955
|
+
acc2 += c;
|
|
1956
|
+
continue;
|
|
1957
|
+
}
|
|
1958
|
+
if (inBrace) {
|
|
1959
|
+
if (i3 === braceStart + 1) {
|
|
1960
|
+
if (c === "^" || c === "!") {
|
|
1961
|
+
braceNeg = true;
|
|
1962
|
+
}
|
|
1963
|
+
} else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
|
|
1964
|
+
inBrace = false;
|
|
1965
|
+
}
|
|
1966
|
+
acc2 += c;
|
|
1967
|
+
continue;
|
|
1968
|
+
} else if (c === "[") {
|
|
1969
|
+
inBrace = true;
|
|
1970
|
+
braceStart = i3;
|
|
1971
|
+
braceNeg = false;
|
|
1972
|
+
acc2 += c;
|
|
1973
|
+
continue;
|
|
1974
|
+
}
|
|
1975
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
|
|
1976
|
+
ast.push(acc2);
|
|
1977
|
+
acc2 = "";
|
|
1978
|
+
const ext2 = new _AST(c, ast);
|
|
1979
|
+
i3 = __privateMethod2(_a3 = _AST, _AST_static, parseAST_fn).call(_a3, str, ext2, i3, opt);
|
|
1980
|
+
ast.push(ext2);
|
|
1981
|
+
continue;
|
|
1982
|
+
}
|
|
1983
|
+
acc2 += c;
|
|
1984
|
+
}
|
|
1985
|
+
ast.push(acc2);
|
|
1986
|
+
return i3;
|
|
1987
|
+
}
|
|
1988
|
+
let i2 = pos2 + 1;
|
|
1989
|
+
let part = new _AST(null, ast);
|
|
1990
|
+
const parts2 = [];
|
|
1991
|
+
let acc = "";
|
|
1992
|
+
while (i2 < str.length) {
|
|
1993
|
+
const c = str.charAt(i2++);
|
|
1994
|
+
if (escaping || c === "\\") {
|
|
1995
|
+
escaping = !escaping;
|
|
1996
|
+
acc += c;
|
|
1997
|
+
continue;
|
|
1998
|
+
}
|
|
1999
|
+
if (inBrace) {
|
|
2000
|
+
if (i2 === braceStart + 1) {
|
|
2001
|
+
if (c === "^" || c === "!") {
|
|
2002
|
+
braceNeg = true;
|
|
2003
|
+
}
|
|
2004
|
+
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
2005
|
+
inBrace = false;
|
|
2006
|
+
}
|
|
2007
|
+
acc += c;
|
|
2008
|
+
continue;
|
|
2009
|
+
} else if (c === "[") {
|
|
2010
|
+
inBrace = true;
|
|
2011
|
+
braceStart = i2;
|
|
2012
|
+
braceNeg = false;
|
|
2013
|
+
acc += c;
|
|
2014
|
+
continue;
|
|
2015
|
+
}
|
|
2016
|
+
if (isExtglobType(c) && str.charAt(i2) === "(") {
|
|
2017
|
+
part.push(acc);
|
|
2018
|
+
acc = "";
|
|
2019
|
+
const ext2 = new _AST(c, part);
|
|
2020
|
+
part.push(ext2);
|
|
2021
|
+
i2 = __privateMethod2(_b2 = _AST, _AST_static, parseAST_fn).call(_b2, str, ext2, i2, opt);
|
|
2022
|
+
continue;
|
|
2023
|
+
}
|
|
2024
|
+
if (c === "|") {
|
|
2025
|
+
part.push(acc);
|
|
2026
|
+
acc = "";
|
|
2027
|
+
parts2.push(part);
|
|
2028
|
+
part = new _AST(null, ast);
|
|
2029
|
+
continue;
|
|
2030
|
+
}
|
|
2031
|
+
if (c === ")") {
|
|
2032
|
+
if (acc === "" && __privateGet2(ast, _parts).length === 0) {
|
|
2033
|
+
__privateSet2(ast, _emptyExt, true);
|
|
2034
|
+
}
|
|
2035
|
+
part.push(acc);
|
|
2036
|
+
acc = "";
|
|
2037
|
+
ast.push(...parts2, part);
|
|
2038
|
+
return i2;
|
|
2039
|
+
}
|
|
2040
|
+
acc += c;
|
|
2041
|
+
}
|
|
2042
|
+
ast.type = null;
|
|
2043
|
+
__privateSet2(ast, _hasMagic, void 0);
|
|
2044
|
+
__privateSet2(ast, _parts, [str.substring(pos2 - 1)]);
|
|
2045
|
+
return i2;
|
|
2046
|
+
};
|
|
2047
|
+
partsToRegExp_fn = function(dot2) {
|
|
2048
|
+
return __privateGet2(this, _parts).map((p2) => {
|
|
2049
|
+
if (typeof p2 === "string") {
|
|
2050
|
+
throw new Error("string type in extglob ast??");
|
|
2051
|
+
}
|
|
2052
|
+
const [re, _2, _hasMagic2, uflag] = p2.toRegExpSource(dot2);
|
|
2053
|
+
__privateSet2(this, _uflag, __privateGet2(this, _uflag) || uflag);
|
|
2054
|
+
return re;
|
|
2055
|
+
}).filter((p2) => !(this.isStart() && this.isEnd()) || !!p2).join("|");
|
|
2056
|
+
};
|
|
2057
|
+
parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
|
|
2058
|
+
let escaping = false;
|
|
2059
|
+
let re = "";
|
|
2060
|
+
let uflag = false;
|
|
2061
|
+
for (let i2 = 0; i2 < glob.length; i2++) {
|
|
2062
|
+
const c = glob.charAt(i2);
|
|
2063
|
+
if (escaping) {
|
|
2064
|
+
escaping = false;
|
|
2065
|
+
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
2066
|
+
continue;
|
|
2067
|
+
}
|
|
2068
|
+
if (c === "\\") {
|
|
2069
|
+
if (i2 === glob.length - 1) {
|
|
2070
|
+
re += "\\\\";
|
|
2071
|
+
} else {
|
|
2072
|
+
escaping = true;
|
|
2073
|
+
}
|
|
2074
|
+
continue;
|
|
2075
|
+
}
|
|
2076
|
+
if (c === "[") {
|
|
2077
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i2);
|
|
2078
|
+
if (consumed) {
|
|
2079
|
+
re += src;
|
|
2080
|
+
uflag = uflag || needUflag;
|
|
2081
|
+
i2 += consumed - 1;
|
|
2082
|
+
hasMagic = hasMagic || magic;
|
|
2083
|
+
continue;
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
if (c === "*") {
|
|
2087
|
+
if (noEmpty && glob === "*")
|
|
2088
|
+
re += starNoEmpty;
|
|
2089
|
+
else
|
|
2090
|
+
re += star$2;
|
|
2091
|
+
hasMagic = true;
|
|
2092
|
+
continue;
|
|
2093
|
+
}
|
|
2094
|
+
if (c === "?") {
|
|
2095
|
+
re += qmark$1;
|
|
2096
|
+
hasMagic = true;
|
|
2097
|
+
continue;
|
|
2098
|
+
}
|
|
2099
|
+
re += regExpEscape$1(c);
|
|
2100
|
+
}
|
|
2101
|
+
return [re, unescape(glob), !!hasMagic, uflag];
|
|
2102
|
+
};
|
|
2103
|
+
__privateAdd2(_AST, _AST_static);
|
|
2104
|
+
let AST = _AST;
|
|
2105
|
+
const escape$1 = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
2106
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
2107
|
+
};
|
|
2108
|
+
var define_process_default$l = { env: {} };
|
|
2109
|
+
const minimatch = (p2, pattern, options = {}) => {
|
|
2110
|
+
assertValidPattern(pattern);
|
|
2111
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
2112
|
+
return false;
|
|
2113
|
+
}
|
|
2114
|
+
return new Minimatch(pattern, options).match(p2);
|
|
2115
|
+
};
|
|
2116
|
+
const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
2117
|
+
const starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
2118
|
+
const starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
|
|
2119
|
+
const starDotExtTestNocase = (ext2) => {
|
|
2120
|
+
ext2 = ext2.toLowerCase();
|
|
2121
|
+
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
|
|
2122
|
+
};
|
|
2123
|
+
const starDotExtTestNocaseDot = (ext2) => {
|
|
2124
|
+
ext2 = ext2.toLowerCase();
|
|
2125
|
+
return (f) => f.toLowerCase().endsWith(ext2);
|
|
2126
|
+
};
|
|
2127
|
+
const starDotStarRE = /^\*+\.\*+$/;
|
|
2128
|
+
const starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
2129
|
+
const starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
2130
|
+
const dotStarRE = /^\.\*+$/;
|
|
2131
|
+
const dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
2132
|
+
const starRE = /^\*+$/;
|
|
2133
|
+
const starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
2134
|
+
const starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
2135
|
+
const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
2136
|
+
const qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
2137
|
+
const noext = qmarksTestNoExt([$0]);
|
|
2138
|
+
if (!ext2)
|
|
2139
|
+
return noext;
|
|
2140
|
+
ext2 = ext2.toLowerCase();
|
|
2141
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
2142
|
+
};
|
|
2143
|
+
const qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
|
|
2144
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
2145
|
+
if (!ext2)
|
|
2146
|
+
return noext;
|
|
2147
|
+
ext2 = ext2.toLowerCase();
|
|
2148
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
2149
|
+
};
|
|
2150
|
+
const qmarksTestDot = ([$0, ext2 = ""]) => {
|
|
2151
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
2152
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
2153
|
+
};
|
|
2154
|
+
const qmarksTest = ([$0, ext2 = ""]) => {
|
|
2155
|
+
const noext = qmarksTestNoExt([$0]);
|
|
2156
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
2157
|
+
};
|
|
2158
|
+
const qmarksTestNoExt = ([$0]) => {
|
|
2159
|
+
const len2 = $0.length;
|
|
2160
|
+
return (f) => f.length === len2 && !f.startsWith(".");
|
|
2161
|
+
};
|
|
2162
|
+
const qmarksTestNoExtDot = ([$0]) => {
|
|
2163
|
+
const len2 = $0.length;
|
|
2164
|
+
return (f) => f.length === len2 && f !== "." && f !== "..";
|
|
2165
|
+
};
|
|
2166
|
+
const defaultPlatform = typeof define_process_default$l === "object" && define_process_default$l ? typeof define_process_default$l.env === "object" && define_process_default$l.env && define_process_default$l.env.__MINIMATCH_TESTING_PLATFORM__ || define_process_default$l.platform : "posix";
|
|
2167
|
+
const path = {
|
|
2168
|
+
win32: { sep: "\\" },
|
|
2169
|
+
posix: { sep: "/" }
|
|
2170
|
+
};
|
|
2171
|
+
const sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
2172
|
+
minimatch.sep = sep;
|
|
2173
|
+
const GLOBSTAR = Symbol("globstar **");
|
|
2174
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
2175
|
+
const qmark = "[^/]";
|
|
2176
|
+
const star$1 = qmark + "*?";
|
|
2177
|
+
const twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
2178
|
+
const twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
2179
|
+
const filter$1 = (pattern, options = {}) => (p2) => minimatch(p2, pattern, options);
|
|
2180
|
+
minimatch.filter = filter$1;
|
|
2181
|
+
const ext = (a, b = {}) => Object.assign({}, a, b);
|
|
2182
|
+
const defaults = (def) => {
|
|
2183
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
2184
|
+
return minimatch;
|
|
2185
|
+
}
|
|
2186
|
+
const orig = minimatch;
|
|
2187
|
+
const m = (p2, pattern, options = {}) => orig(p2, pattern, ext(def, options));
|
|
2188
|
+
return Object.assign(m, {
|
|
2189
|
+
Minimatch: class Minimatch extends orig.Minimatch {
|
|
2190
|
+
constructor(pattern, options = {}) {
|
|
2191
|
+
super(pattern, ext(def, options));
|
|
2192
|
+
}
|
|
2193
|
+
static defaults(options) {
|
|
2194
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
2195
|
+
}
|
|
2196
|
+
},
|
|
2197
|
+
AST: class AST extends orig.AST {
|
|
2198
|
+
/* c8 ignore start */
|
|
2199
|
+
constructor(type, parent, options = {}) {
|
|
2200
|
+
super(type, parent, ext(def, options));
|
|
2201
|
+
}
|
|
2202
|
+
/* c8 ignore stop */
|
|
2203
|
+
static fromGlob(pattern, options = {}) {
|
|
2204
|
+
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
2205
|
+
}
|
|
2206
|
+
},
|
|
2207
|
+
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
2208
|
+
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
2209
|
+
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
2210
|
+
defaults: (options) => orig.defaults(ext(def, options)),
|
|
2211
|
+
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
2212
|
+
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
2213
|
+
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
2214
|
+
sep: orig.sep,
|
|
2215
|
+
GLOBSTAR
|
|
2216
|
+
});
|
|
2217
|
+
};
|
|
2218
|
+
minimatch.defaults = defaults;
|
|
2219
|
+
const braceExpand = (pattern, options = {}) => {
|
|
2220
|
+
assertValidPattern(pattern);
|
|
2221
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
2222
|
+
return [pattern];
|
|
2223
|
+
}
|
|
2224
|
+
return expand(pattern);
|
|
2225
|
+
};
|
|
2226
|
+
minimatch.braceExpand = braceExpand;
|
|
2227
|
+
const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
2228
|
+
minimatch.makeRe = makeRe;
|
|
2229
|
+
const match$1 = (list, pattern, options = {}) => {
|
|
2230
|
+
const mm = new Minimatch(pattern, options);
|
|
2231
|
+
list = list.filter((f) => mm.match(f));
|
|
2232
|
+
if (mm.options.nonull && !list.length) {
|
|
2233
|
+
list.push(pattern);
|
|
2234
|
+
}
|
|
2235
|
+
return list;
|
|
2236
|
+
};
|
|
2237
|
+
minimatch.match = match$1;
|
|
2238
|
+
const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
2239
|
+
const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
2240
|
+
class Minimatch {
|
|
2241
|
+
constructor(pattern, options = {}) {
|
|
2242
|
+
__publicField2(this, "options");
|
|
2243
|
+
__publicField2(this, "set");
|
|
2244
|
+
__publicField2(this, "pattern");
|
|
2245
|
+
__publicField2(this, "windowsPathsNoEscape");
|
|
2246
|
+
__publicField2(this, "nonegate");
|
|
2247
|
+
__publicField2(this, "negate");
|
|
2248
|
+
__publicField2(this, "comment");
|
|
2249
|
+
__publicField2(this, "empty");
|
|
2250
|
+
__publicField2(this, "preserveMultipleSlashes");
|
|
2251
|
+
__publicField2(this, "partial");
|
|
2252
|
+
__publicField2(this, "globSet");
|
|
2253
|
+
__publicField2(this, "globParts");
|
|
2254
|
+
__publicField2(this, "nocase");
|
|
2255
|
+
__publicField2(this, "isWindows");
|
|
2256
|
+
__publicField2(this, "platform");
|
|
2257
|
+
__publicField2(this, "windowsNoMagicRoot");
|
|
2258
|
+
__publicField2(this, "regexp");
|
|
2259
|
+
assertValidPattern(pattern);
|
|
2260
|
+
options = options || {};
|
|
2261
|
+
this.options = options;
|
|
2262
|
+
this.pattern = pattern;
|
|
2263
|
+
this.platform = options.platform || defaultPlatform;
|
|
2264
|
+
this.isWindows = this.platform === "win32";
|
|
2265
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
2266
|
+
if (this.windowsPathsNoEscape) {
|
|
2267
|
+
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
2268
|
+
}
|
|
2269
|
+
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
2270
|
+
this.regexp = null;
|
|
2271
|
+
this.negate = false;
|
|
2272
|
+
this.nonegate = !!options.nonegate;
|
|
2273
|
+
this.comment = false;
|
|
2274
|
+
this.empty = false;
|
|
2275
|
+
this.partial = !!options.partial;
|
|
2276
|
+
this.nocase = !!this.options.nocase;
|
|
2277
|
+
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
2278
|
+
this.globSet = [];
|
|
2279
|
+
this.globParts = [];
|
|
2280
|
+
this.set = [];
|
|
2281
|
+
this.make();
|
|
2282
|
+
}
|
|
2283
|
+
hasMagic() {
|
|
2284
|
+
if (this.options.magicalBraces && this.set.length > 1) {
|
|
2285
|
+
return true;
|
|
2286
|
+
}
|
|
2287
|
+
for (const pattern of this.set) {
|
|
2288
|
+
for (const part of pattern) {
|
|
2289
|
+
if (typeof part !== "string")
|
|
2290
|
+
return true;
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
return false;
|
|
2294
|
+
}
|
|
2295
|
+
debug(..._2) {
|
|
2296
|
+
}
|
|
2297
|
+
make() {
|
|
2298
|
+
const pattern = this.pattern;
|
|
2299
|
+
const options = this.options;
|
|
2300
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
2301
|
+
this.comment = true;
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
if (!pattern) {
|
|
2305
|
+
this.empty = true;
|
|
2306
|
+
return;
|
|
2307
|
+
}
|
|
2308
|
+
this.parseNegate();
|
|
2309
|
+
this.globSet = [...new Set(this.braceExpand())];
|
|
2310
|
+
if (options.debug) {
|
|
2311
|
+
this.debug = (...args2) => console.error(...args2);
|
|
2312
|
+
}
|
|
2313
|
+
this.debug(this.pattern, this.globSet);
|
|
2314
|
+
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
2315
|
+
this.globParts = this.preprocess(rawGlobParts);
|
|
2316
|
+
this.debug(this.pattern, this.globParts);
|
|
2317
|
+
let set2 = this.globParts.map((s, _2, __) => {
|
|
2318
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
2319
|
+
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
2320
|
+
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
2321
|
+
if (isUNC) {
|
|
2322
|
+
return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
2323
|
+
} else if (isDrive) {
|
|
2324
|
+
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
return s.map((ss) => this.parse(ss));
|
|
2328
|
+
});
|
|
2329
|
+
this.debug(this.pattern, set2);
|
|
2330
|
+
this.set = set2.filter((s) => s.indexOf(false) === -1);
|
|
2331
|
+
if (this.isWindows) {
|
|
2332
|
+
for (let i2 = 0; i2 < this.set.length; i2++) {
|
|
2333
|
+
const p2 = this.set[i2];
|
|
2334
|
+
if (p2[0] === "" && p2[1] === "" && this.globParts[i2][2] === "?" && typeof p2[3] === "string" && /^[a-z]:$/i.test(p2[3])) {
|
|
2335
|
+
p2[2] = "?";
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
this.debug(this.pattern, this.set);
|
|
2340
|
+
}
|
|
2341
|
+
// various transforms to equivalent pattern sets that are
|
|
2342
|
+
// faster to process in a filesystem walk. The goal is to
|
|
2343
|
+
// eliminate what we can, and push all ** patterns as far
|
|
2344
|
+
// to the right as possible, even if it increases the number
|
|
2345
|
+
// of patterns that we have to process.
|
|
2346
|
+
preprocess(globParts) {
|
|
2347
|
+
if (this.options.noglobstar) {
|
|
2348
|
+
for (let i2 = 0; i2 < globParts.length; i2++) {
|
|
2349
|
+
for (let j = 0; j < globParts[i2].length; j++) {
|
|
2350
|
+
if (globParts[i2][j] === "**") {
|
|
2351
|
+
globParts[i2][j] = "*";
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
const { optimizationLevel = 1 } = this.options;
|
|
2357
|
+
if (optimizationLevel >= 2) {
|
|
2358
|
+
globParts = this.firstPhasePreProcess(globParts);
|
|
2359
|
+
globParts = this.secondPhasePreProcess(globParts);
|
|
2360
|
+
} else if (optimizationLevel >= 1) {
|
|
2361
|
+
globParts = this.levelOneOptimize(globParts);
|
|
2362
|
+
} else {
|
|
2363
|
+
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
2364
|
+
}
|
|
2365
|
+
return globParts;
|
|
2366
|
+
}
|
|
2367
|
+
// just get rid of adjascent ** portions
|
|
2368
|
+
adjascentGlobstarOptimize(globParts) {
|
|
2369
|
+
return globParts.map((parts2) => {
|
|
2370
|
+
let gs = -1;
|
|
2371
|
+
while (-1 !== (gs = parts2.indexOf("**", gs + 1))) {
|
|
2372
|
+
let i2 = gs;
|
|
2373
|
+
while (parts2[i2 + 1] === "**") {
|
|
2374
|
+
i2++;
|
|
2375
|
+
}
|
|
2376
|
+
if (i2 !== gs) {
|
|
2377
|
+
parts2.splice(gs, i2 - gs);
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
return parts2;
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
// get rid of adjascent ** and resolve .. portions
|
|
2384
|
+
levelOneOptimize(globParts) {
|
|
2385
|
+
return globParts.map((parts2) => {
|
|
2386
|
+
parts2 = parts2.reduce((set2, part) => {
|
|
2387
|
+
const prev = set2[set2.length - 1];
|
|
2388
|
+
if (part === "**" && prev === "**") {
|
|
2389
|
+
return set2;
|
|
2390
|
+
}
|
|
2391
|
+
if (part === "..") {
|
|
2392
|
+
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
2393
|
+
set2.pop();
|
|
2394
|
+
return set2;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
set2.push(part);
|
|
2398
|
+
return set2;
|
|
2399
|
+
}, []);
|
|
2400
|
+
return parts2.length === 0 ? [""] : parts2;
|
|
2401
|
+
});
|
|
2402
|
+
}
|
|
2403
|
+
levelTwoFileOptimize(parts2) {
|
|
2404
|
+
if (!Array.isArray(parts2)) {
|
|
2405
|
+
parts2 = this.slashSplit(parts2);
|
|
2406
|
+
}
|
|
2407
|
+
let didSomething = false;
|
|
2408
|
+
do {
|
|
2409
|
+
didSomething = false;
|
|
2410
|
+
if (!this.preserveMultipleSlashes) {
|
|
2411
|
+
for (let i2 = 1; i2 < parts2.length - 1; i2++) {
|
|
2412
|
+
const p2 = parts2[i2];
|
|
2413
|
+
if (i2 === 1 && p2 === "" && parts2[0] === "")
|
|
2414
|
+
continue;
|
|
2415
|
+
if (p2 === "." || p2 === "") {
|
|
2416
|
+
didSomething = true;
|
|
2417
|
+
parts2.splice(i2, 1);
|
|
2418
|
+
i2--;
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
if (parts2[0] === "." && parts2.length === 2 && (parts2[1] === "." || parts2[1] === "")) {
|
|
2422
|
+
didSomething = true;
|
|
2423
|
+
parts2.pop();
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
let dd2 = 0;
|
|
2427
|
+
while (-1 !== (dd2 = parts2.indexOf("..", dd2 + 1))) {
|
|
2428
|
+
const p2 = parts2[dd2 - 1];
|
|
2429
|
+
if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**") {
|
|
2430
|
+
didSomething = true;
|
|
2431
|
+
parts2.splice(dd2 - 1, 2);
|
|
2432
|
+
dd2 -= 2;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
} while (didSomething);
|
|
2436
|
+
return parts2.length === 0 ? [""] : parts2;
|
|
2437
|
+
}
|
|
2438
|
+
// First phase: single-pattern processing
|
|
2439
|
+
// <pre> is 1 or more portions
|
|
2440
|
+
// <rest> is 1 or more portions
|
|
2441
|
+
// <p> is any portion other than ., .., '', or **
|
|
2442
|
+
// <e> is . or ''
|
|
2443
|
+
//
|
|
2444
|
+
// **/.. is *brutal* for filesystem walking performance, because
|
|
2445
|
+
// it effectively resets the recursive walk each time it occurs,
|
|
2446
|
+
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
2447
|
+
// or most strings (other than .., ., and '') can be.
|
|
2448
|
+
//
|
|
2449
|
+
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
2450
|
+
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
2451
|
+
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
2452
|
+
// **/**/<rest> -> **/<rest>
|
|
2453
|
+
//
|
|
2454
|
+
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
2455
|
+
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
2456
|
+
firstPhasePreProcess(globParts) {
|
|
2457
|
+
let didSomething = false;
|
|
2458
|
+
do {
|
|
2459
|
+
didSomething = false;
|
|
2460
|
+
for (let parts2 of globParts) {
|
|
2461
|
+
let gs = -1;
|
|
2462
|
+
while (-1 !== (gs = parts2.indexOf("**", gs + 1))) {
|
|
2463
|
+
let gss = gs;
|
|
2464
|
+
while (parts2[gss + 1] === "**") {
|
|
2465
|
+
gss++;
|
|
2466
|
+
}
|
|
2467
|
+
if (gss > gs) {
|
|
2468
|
+
parts2.splice(gs + 1, gss - gs);
|
|
2469
|
+
}
|
|
2470
|
+
let next = parts2[gs + 1];
|
|
2471
|
+
const p2 = parts2[gs + 2];
|
|
2472
|
+
const p22 = parts2[gs + 3];
|
|
2473
|
+
if (next !== "..")
|
|
2474
|
+
continue;
|
|
2475
|
+
if (!p2 || p2 === "." || p2 === ".." || !p22 || p22 === "." || p22 === "..") {
|
|
2476
|
+
continue;
|
|
2477
|
+
}
|
|
2478
|
+
didSomething = true;
|
|
2479
|
+
parts2.splice(gs, 1);
|
|
2480
|
+
const other = parts2.slice(0);
|
|
2481
|
+
other[gs] = "**";
|
|
2482
|
+
globParts.push(other);
|
|
2483
|
+
gs--;
|
|
2484
|
+
}
|
|
2485
|
+
if (!this.preserveMultipleSlashes) {
|
|
2486
|
+
for (let i2 = 1; i2 < parts2.length - 1; i2++) {
|
|
2487
|
+
const p2 = parts2[i2];
|
|
2488
|
+
if (i2 === 1 && p2 === "" && parts2[0] === "")
|
|
2489
|
+
continue;
|
|
2490
|
+
if (p2 === "." || p2 === "") {
|
|
2491
|
+
didSomething = true;
|
|
2492
|
+
parts2.splice(i2, 1);
|
|
2493
|
+
i2--;
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
if (parts2[0] === "." && parts2.length === 2 && (parts2[1] === "." || parts2[1] === "")) {
|
|
2497
|
+
didSomething = true;
|
|
2498
|
+
parts2.pop();
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
let dd2 = 0;
|
|
2502
|
+
while (-1 !== (dd2 = parts2.indexOf("..", dd2 + 1))) {
|
|
2503
|
+
const p2 = parts2[dd2 - 1];
|
|
2504
|
+
if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**") {
|
|
2505
|
+
didSomething = true;
|
|
2506
|
+
const needDot = dd2 === 1 && parts2[dd2 + 1] === "**";
|
|
2507
|
+
const splin = needDot ? ["."] : [];
|
|
2508
|
+
parts2.splice(dd2 - 1, 2, ...splin);
|
|
2509
|
+
if (parts2.length === 0)
|
|
2510
|
+
parts2.push("");
|
|
2511
|
+
dd2 -= 2;
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
} while (didSomething);
|
|
2516
|
+
return globParts;
|
|
2517
|
+
}
|
|
2518
|
+
// second phase: multi-pattern dedupes
|
|
2519
|
+
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
2520
|
+
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
2521
|
+
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
2522
|
+
//
|
|
2523
|
+
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
2524
|
+
// ^-- not valid because ** doens't follow symlinks
|
|
2525
|
+
secondPhasePreProcess(globParts) {
|
|
2526
|
+
for (let i2 = 0; i2 < globParts.length - 1; i2++) {
|
|
2527
|
+
for (let j = i2 + 1; j < globParts.length; j++) {
|
|
2528
|
+
const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
|
|
2529
|
+
if (!matched)
|
|
2530
|
+
continue;
|
|
2531
|
+
globParts[i2] = matched;
|
|
2532
|
+
globParts[j] = [];
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
return globParts.filter((gs) => gs.length);
|
|
2536
|
+
}
|
|
2537
|
+
partsMatch(a, b, emptyGSMatch = false) {
|
|
2538
|
+
let ai = 0;
|
|
2539
|
+
let bi = 0;
|
|
2540
|
+
let result = [];
|
|
2541
|
+
let which = "";
|
|
2542
|
+
while (ai < a.length && bi < b.length) {
|
|
2543
|
+
if (a[ai] === b[bi]) {
|
|
2544
|
+
result.push(which === "b" ? b[bi] : a[ai]);
|
|
2545
|
+
ai++;
|
|
2546
|
+
bi++;
|
|
2547
|
+
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
2548
|
+
result.push(a[ai]);
|
|
2549
|
+
ai++;
|
|
2550
|
+
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
2551
|
+
result.push(b[bi]);
|
|
2552
|
+
bi++;
|
|
2553
|
+
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
2554
|
+
if (which === "b")
|
|
2555
|
+
return false;
|
|
2556
|
+
which = "a";
|
|
2557
|
+
result.push(a[ai]);
|
|
2558
|
+
ai++;
|
|
2559
|
+
bi++;
|
|
2560
|
+
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
2561
|
+
if (which === "a")
|
|
2562
|
+
return false;
|
|
2563
|
+
which = "b";
|
|
2564
|
+
result.push(b[bi]);
|
|
2565
|
+
ai++;
|
|
2566
|
+
bi++;
|
|
2567
|
+
} else {
|
|
2568
|
+
return false;
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
return a.length === b.length && result;
|
|
2572
|
+
}
|
|
2573
|
+
parseNegate() {
|
|
2574
|
+
if (this.nonegate)
|
|
2575
|
+
return;
|
|
2576
|
+
const pattern = this.pattern;
|
|
2577
|
+
let negate = false;
|
|
2578
|
+
let negateOffset = 0;
|
|
2579
|
+
for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
|
|
2580
|
+
negate = !negate;
|
|
2581
|
+
negateOffset++;
|
|
2582
|
+
}
|
|
2583
|
+
if (negateOffset)
|
|
2584
|
+
this.pattern = pattern.slice(negateOffset);
|
|
2585
|
+
this.negate = negate;
|
|
2586
|
+
}
|
|
2587
|
+
// set partial to true to test if, for example,
|
|
2588
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
2589
|
+
// Partial means, if you run out of file before you run
|
|
2590
|
+
// out of pattern, then that's fine, as long as all
|
|
2591
|
+
// the parts match.
|
|
2592
|
+
matchOne(file, pattern, partial = false) {
|
|
2593
|
+
const options = this.options;
|
|
2594
|
+
if (this.isWindows) {
|
|
2595
|
+
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
2596
|
+
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
2597
|
+
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
2598
|
+
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
2599
|
+
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
2600
|
+
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
2601
|
+
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
2602
|
+
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
2603
|
+
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
2604
|
+
pattern[pdi] = fd;
|
|
2605
|
+
if (pdi > fdi) {
|
|
2606
|
+
pattern = pattern.slice(pdi);
|
|
2607
|
+
} else if (fdi > pdi) {
|
|
2608
|
+
file = file.slice(fdi);
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
const { optimizationLevel = 1 } = this.options;
|
|
2614
|
+
if (optimizationLevel >= 2) {
|
|
2615
|
+
file = this.levelTwoFileOptimize(file);
|
|
2616
|
+
}
|
|
2617
|
+
this.debug("matchOne", this, { file, pattern });
|
|
2618
|
+
this.debug("matchOne", file.length, pattern.length);
|
|
2619
|
+
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
2620
|
+
this.debug("matchOne loop");
|
|
2621
|
+
var p2 = pattern[pi];
|
|
2622
|
+
var f = file[fi];
|
|
2623
|
+
this.debug(pattern, p2, f);
|
|
2624
|
+
if (p2 === false) {
|
|
2625
|
+
return false;
|
|
2626
|
+
}
|
|
2627
|
+
if (p2 === GLOBSTAR) {
|
|
2628
|
+
this.debug("GLOBSTAR", [pattern, p2, f]);
|
|
2629
|
+
var fr = fi;
|
|
2630
|
+
var pr = pi + 1;
|
|
2631
|
+
if (pr === pl) {
|
|
2632
|
+
this.debug("** at the end");
|
|
2633
|
+
for (; fi < fl; fi++) {
|
|
2634
|
+
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
2635
|
+
return false;
|
|
2636
|
+
}
|
|
2637
|
+
return true;
|
|
2638
|
+
}
|
|
2639
|
+
while (fr < fl) {
|
|
2640
|
+
var swallowee = file[fr];
|
|
2641
|
+
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
2642
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
2643
|
+
this.debug("globstar found match!", fr, fl, swallowee);
|
|
2644
|
+
return true;
|
|
2645
|
+
} else {
|
|
2646
|
+
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
2647
|
+
this.debug("dot detected!", file, fr, pattern, pr);
|
|
2648
|
+
break;
|
|
2649
|
+
}
|
|
2650
|
+
this.debug("globstar swallow a segment, and continue");
|
|
2651
|
+
fr++;
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
if (partial) {
|
|
2655
|
+
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
2656
|
+
if (fr === fl) {
|
|
2657
|
+
return true;
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
return false;
|
|
2661
|
+
}
|
|
2662
|
+
let hit2;
|
|
2663
|
+
if (typeof p2 === "string") {
|
|
2664
|
+
hit2 = f === p2;
|
|
2665
|
+
this.debug("string match", p2, f, hit2);
|
|
2666
|
+
} else {
|
|
2667
|
+
hit2 = p2.test(f);
|
|
2668
|
+
this.debug("pattern match", p2, f, hit2);
|
|
2669
|
+
}
|
|
2670
|
+
if (!hit2)
|
|
2671
|
+
return false;
|
|
2672
|
+
}
|
|
2673
|
+
if (fi === fl && pi === pl) {
|
|
2674
|
+
return true;
|
|
2675
|
+
} else if (fi === fl) {
|
|
2676
|
+
return partial;
|
|
2677
|
+
} else if (pi === pl) {
|
|
2678
|
+
return fi === fl - 1 && file[fi] === "";
|
|
2679
|
+
} else {
|
|
2680
|
+
throw new Error("wtf?");
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
braceExpand() {
|
|
2684
|
+
return braceExpand(this.pattern, this.options);
|
|
2685
|
+
}
|
|
2686
|
+
parse(pattern) {
|
|
2687
|
+
assertValidPattern(pattern);
|
|
2688
|
+
const options = this.options;
|
|
2689
|
+
if (pattern === "**")
|
|
2690
|
+
return GLOBSTAR;
|
|
2691
|
+
if (pattern === "")
|
|
2692
|
+
return "";
|
|
2693
|
+
let m;
|
|
2694
|
+
let fastTest = null;
|
|
2695
|
+
if (m = pattern.match(starRE)) {
|
|
2696
|
+
fastTest = options.dot ? starTestDot : starTest;
|
|
2697
|
+
} else if (m = pattern.match(starDotExtRE)) {
|
|
2698
|
+
fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
2699
|
+
} else if (m = pattern.match(qmarksRE)) {
|
|
2700
|
+
fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
2701
|
+
} else if (m = pattern.match(starDotStarRE)) {
|
|
2702
|
+
fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
2703
|
+
} else if (m = pattern.match(dotStarRE)) {
|
|
2704
|
+
fastTest = dotStarTest;
|
|
2705
|
+
}
|
|
2706
|
+
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
2707
|
+
if (fastTest && typeof re === "object") {
|
|
2708
|
+
Reflect.defineProperty(re, "test", { value: fastTest });
|
|
2709
|
+
}
|
|
2710
|
+
return re;
|
|
2711
|
+
}
|
|
2712
|
+
makeRe() {
|
|
2713
|
+
if (this.regexp || this.regexp === false)
|
|
2714
|
+
return this.regexp;
|
|
2715
|
+
const set2 = this.set;
|
|
2716
|
+
if (!set2.length) {
|
|
2717
|
+
this.regexp = false;
|
|
2718
|
+
return this.regexp;
|
|
2719
|
+
}
|
|
2720
|
+
const options = this.options;
|
|
2721
|
+
const twoStar = options.noglobstar ? star$1 : options.dot ? twoStarDot : twoStarNoDot;
|
|
2722
|
+
const flags2 = new Set(options.nocase ? ["i"] : []);
|
|
2723
|
+
let re = set2.map((pattern) => {
|
|
2724
|
+
const pp = pattern.map((p2) => {
|
|
2725
|
+
if (p2 instanceof RegExp) {
|
|
2726
|
+
for (const f of p2.flags.split(""))
|
|
2727
|
+
flags2.add(f);
|
|
2728
|
+
}
|
|
2729
|
+
return typeof p2 === "string" ? regExpEscape(p2) : p2 === GLOBSTAR ? GLOBSTAR : p2._src;
|
|
2730
|
+
});
|
|
2731
|
+
pp.forEach((p2, i2) => {
|
|
2732
|
+
const next = pp[i2 + 1];
|
|
2733
|
+
const prev = pp[i2 - 1];
|
|
2734
|
+
if (p2 !== GLOBSTAR || prev === GLOBSTAR) {
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
2737
|
+
if (prev === void 0) {
|
|
2738
|
+
if (next !== void 0 && next !== GLOBSTAR) {
|
|
2739
|
+
pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
2740
|
+
} else {
|
|
2741
|
+
pp[i2] = twoStar;
|
|
2742
|
+
}
|
|
2743
|
+
} else if (next === void 0) {
|
|
2744
|
+
pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
|
|
2745
|
+
} else if (next !== GLOBSTAR) {
|
|
2746
|
+
pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
2747
|
+
pp[i2 + 1] = GLOBSTAR;
|
|
2748
|
+
}
|
|
2749
|
+
});
|
|
2750
|
+
return pp.filter((p2) => p2 !== GLOBSTAR).join("/");
|
|
2751
|
+
}).join("|");
|
|
2752
|
+
const [open2, close] = set2.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
2753
|
+
re = "^" + open2 + re + close + "$";
|
|
2754
|
+
if (this.negate)
|
|
2755
|
+
re = "^(?!" + re + ").+$";
|
|
2756
|
+
try {
|
|
2757
|
+
this.regexp = new RegExp(re, [...flags2].join(""));
|
|
2758
|
+
} catch (ex) {
|
|
2759
|
+
this.regexp = false;
|
|
2760
|
+
}
|
|
2761
|
+
return this.regexp;
|
|
2762
|
+
}
|
|
2763
|
+
slashSplit(p2) {
|
|
2764
|
+
if (this.preserveMultipleSlashes) {
|
|
2765
|
+
return p2.split("/");
|
|
2766
|
+
} else if (this.isWindows && /^\/\/[^\/]+/.test(p2)) {
|
|
2767
|
+
return ["", ...p2.split(/\/+/)];
|
|
2768
|
+
} else {
|
|
2769
|
+
return p2.split(/\/+/);
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
match(f, partial = this.partial) {
|
|
2773
|
+
this.debug("match", f, this.pattern);
|
|
2774
|
+
if (this.comment) {
|
|
2775
|
+
return false;
|
|
2776
|
+
}
|
|
2777
|
+
if (this.empty) {
|
|
2778
|
+
return f === "";
|
|
2779
|
+
}
|
|
2780
|
+
if (f === "/" && partial) {
|
|
2781
|
+
return true;
|
|
2782
|
+
}
|
|
2783
|
+
const options = this.options;
|
|
2784
|
+
if (this.isWindows) {
|
|
2785
|
+
f = f.split("\\").join("/");
|
|
2786
|
+
}
|
|
2787
|
+
const ff = this.slashSplit(f);
|
|
2788
|
+
this.debug(this.pattern, "split", ff);
|
|
2789
|
+
const set2 = this.set;
|
|
2790
|
+
this.debug(this.pattern, "set", set2);
|
|
2791
|
+
let filename = ff[ff.length - 1];
|
|
2792
|
+
if (!filename) {
|
|
2793
|
+
for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
|
|
2794
|
+
filename = ff[i2];
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
for (let i2 = 0; i2 < set2.length; i2++) {
|
|
2798
|
+
const pattern = set2[i2];
|
|
2799
|
+
let file = ff;
|
|
2800
|
+
if (options.matchBase && pattern.length === 1) {
|
|
2801
|
+
file = [filename];
|
|
2802
|
+
}
|
|
2803
|
+
const hit2 = this.matchOne(file, pattern, partial);
|
|
2804
|
+
if (hit2) {
|
|
2805
|
+
if (options.flipNegate) {
|
|
2806
|
+
return true;
|
|
2807
|
+
}
|
|
2808
|
+
return !this.negate;
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
if (options.flipNegate) {
|
|
2812
|
+
return false;
|
|
2813
|
+
}
|
|
2814
|
+
return this.negate;
|
|
2815
|
+
}
|
|
2816
|
+
static defaults(def) {
|
|
2817
|
+
return minimatch.defaults(def).Minimatch;
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
minimatch.AST = AST;
|
|
2821
|
+
minimatch.Minimatch = Minimatch;
|
|
2822
|
+
minimatch.escape = escape$1;
|
|
2823
|
+
minimatch.unescape = unescape;
|
|
1486
2824
|
/*!
|
|
1487
2825
|
* re2js
|
|
1488
2826
|
* RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
|
|
@@ -2996,10 +4334,10 @@ const _Regexp = class _Regexp {
|
|
|
2996
4334
|
break;
|
|
2997
4335
|
}
|
|
2998
4336
|
case _Regexp.Op.ALTERNATE: {
|
|
2999
|
-
let
|
|
4337
|
+
let sep2 = "";
|
|
3000
4338
|
for (let sub2 of this.subs) {
|
|
3001
|
-
out2 +=
|
|
3002
|
-
|
|
4339
|
+
out2 += sep2;
|
|
4340
|
+
sep2 = "|";
|
|
3003
4341
|
out2 += sub2.appendTo();
|
|
3004
4342
|
}
|
|
3005
4343
|
break;
|
|
@@ -6584,7 +7922,10 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
|
|
|
6584
7922
|
}
|
|
6585
7923
|
// Visible for testing.
|
|
6586
7924
|
get timerStateForTest() {
|
|
6587
|
-
return {
|
|
7925
|
+
return {
|
|
7926
|
+
delay: this.lastFetchDelay,
|
|
7927
|
+
lifetime: this.lastResultLifetime
|
|
7928
|
+
};
|
|
6588
7929
|
}
|
|
6589
7930
|
// Fetches context filters and updates the cached filter results
|
|
6590
7931
|
async fetchContextFilters() {
|
|
@@ -6659,9 +8000,6 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
|
|
|
6659
8000
|
await this.lastResultLifetime;
|
|
6660
8001
|
}
|
|
6661
8002
|
async isRepoNameIgnored(repoName) {
|
|
6662
|
-
if (isDotCom(currentAuthStatus())) {
|
|
6663
|
-
return false;
|
|
6664
|
-
}
|
|
6665
8003
|
await this.fetchIfNeeded();
|
|
6666
8004
|
return this.isRepoNameIgnored__noFetch(repoName);
|
|
6667
8005
|
}
|
|
@@ -6688,13 +8026,19 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
|
|
|
6688
8026
|
return isIgnored;
|
|
6689
8027
|
}
|
|
6690
8028
|
async isUriIgnored(uri) {
|
|
6691
|
-
if (
|
|
8029
|
+
if (!uri || allowedSchemes.has(uri.scheme)) {
|
|
6692
8030
|
return false;
|
|
6693
8031
|
}
|
|
6694
|
-
|
|
8032
|
+
const path2 = uri.path.toLowerCase();
|
|
8033
|
+
if (path2.includes("main.java") || path2.includes("index.html") || path2.includes("var.go") || path2.includes("visualize.go") || path2.includes("buzz.ts")) {
|
|
6695
8034
|
return false;
|
|
6696
8035
|
}
|
|
6697
8036
|
await this.fetchIfNeeded();
|
|
8037
|
+
if (_ContextFiltersProvider.excludePatternGetter) {
|
|
8038
|
+
if (await this.isExcludedByPatterns(uri)) {
|
|
8039
|
+
return "exclude-pattern-match";
|
|
8040
|
+
}
|
|
8041
|
+
}
|
|
6698
8042
|
if (this.hasAllowEverythingFilters()) {
|
|
6699
8043
|
return false;
|
|
6700
8044
|
}
|
|
@@ -6729,6 +8073,41 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
|
|
|
6729
8073
|
}
|
|
6730
8074
|
return false;
|
|
6731
8075
|
}
|
|
8076
|
+
async isExcludedByPatterns(uri) {
|
|
8077
|
+
try {
|
|
8078
|
+
const workspaceFolder = _ContextFiltersProvider.excludePatternGetter.getWorkspaceFolder(uri);
|
|
8079
|
+
const excludePatternString = await _ContextFiltersProvider.excludePatternGetter.getExcludePattern(workspaceFolder);
|
|
8080
|
+
const patterns = this.parseExcludePatternString(excludePatternString);
|
|
8081
|
+
let relativePath;
|
|
8082
|
+
if (workspaceFolder) {
|
|
8083
|
+
const workspacePath = workspaceFolder.uri.fsPath;
|
|
8084
|
+
if (uri.fsPath.startsWith(workspacePath)) {
|
|
8085
|
+
relativePath = uri.fsPath.substring(workspacePath.length + 1).replace(/\\/g, "/");
|
|
8086
|
+
} else {
|
|
8087
|
+
return false;
|
|
8088
|
+
}
|
|
8089
|
+
} else {
|
|
8090
|
+
relativePath = uri.fsPath.replace(/\\/g, "/");
|
|
8091
|
+
}
|
|
8092
|
+
return patterns.some((pattern) => minimatch(relativePath, pattern, { dot: true }));
|
|
8093
|
+
} catch (error) {
|
|
8094
|
+
logDebug$1("ContextFiltersProvider", "isExcludedByPatterns error", { error });
|
|
8095
|
+
return false;
|
|
8096
|
+
}
|
|
8097
|
+
}
|
|
8098
|
+
parseExcludePatternString(patternString) {
|
|
8099
|
+
if (!patternString || typeof patternString !== "string") {
|
|
8100
|
+
return [];
|
|
8101
|
+
}
|
|
8102
|
+
if (patternString.startsWith("{") && patternString.endsWith("}")) {
|
|
8103
|
+
const content = patternString.slice(1, -1);
|
|
8104
|
+
return content ? content.split(",").filter((pattern) => pattern.trim() !== "") : [];
|
|
8105
|
+
}
|
|
8106
|
+
if (patternString.includes(",") || patternString.includes("{") || patternString.includes("}")) {
|
|
8107
|
+
return [];
|
|
8108
|
+
}
|
|
8109
|
+
return [patternString.trim()].filter((pattern) => pattern !== "");
|
|
8110
|
+
}
|
|
6732
8111
|
reset() {
|
|
6733
8112
|
this.lastFetchTimestamp = 0;
|
|
6734
8113
|
this.lastResultLifetime = Promise.resolve(TRANSIENT_REFETCH_INTERVAL_HINT);
|
|
@@ -6741,7 +8120,7 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
|
|
|
6741
8120
|
this.reset();
|
|
6742
8121
|
}
|
|
6743
8122
|
hasAllowEverythingFilters() {
|
|
6744
|
-
return
|
|
8123
|
+
return this.lastContextFiltersResponse === INCLUDE_EVERYTHING_CONTEXT_FILTERS;
|
|
6745
8124
|
}
|
|
6746
8125
|
hasIgnoreEverythingFilters() {
|
|
6747
8126
|
return this.lastContextFiltersResponse === EXCLUDE_EVERYTHING_CONTEXT_FILTERS;
|
|
@@ -6753,6 +8132,7 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
|
|
|
6753
8132
|
}
|
|
6754
8133
|
};
|
|
6755
8134
|
__publicField2(_ContextFiltersProvider, "repoNameResolver");
|
|
8135
|
+
__publicField2(_ContextFiltersProvider, "excludePatternGetter");
|
|
6756
8136
|
let ContextFiltersProvider = _ContextFiltersProvider;
|
|
6757
8137
|
function matchesContextFilter(parsedFilter, repoName) {
|
|
6758
8138
|
return Boolean(parsedFilter.repoNamePattern.matcher(repoName).find(0));
|
|
@@ -8162,7 +9542,7 @@ async function getTokenCounterUtils() {
|
|
|
8162
9542
|
const browser2 = detect();
|
|
8163
9543
|
if (browser2 && browser2.name === "safari") {
|
|
8164
9544
|
_tokenCounterUtilsPromise = import("./cl100k_base-B4kyDDRQ.mjs").then(async (tokenizer2) => {
|
|
8165
|
-
const tiktoken = await import("./lite-
|
|
9545
|
+
const tiktoken = await import("./lite-BobkBW3_.mjs");
|
|
8166
9546
|
return createTokenCounterUtils(new tiktoken.Tiktoken(tokenizer2.default));
|
|
8167
9547
|
});
|
|
8168
9548
|
} else {
|
|
@@ -9601,7 +10981,7 @@ class APIClient {
|
|
|
9601
10981
|
const socketKeepAliveInterval = 60 * 1e3;
|
|
9602
10982
|
const keepAliveTimeout = setTimeout(() => {
|
|
9603
10983
|
var _a3, _b2;
|
|
9604
|
-
if ((_a3 = fetchOptions == null ? void 0 : fetchOptions.agent) == null ? void 0 : _a3.sockets) {
|
|
10984
|
+
if (fetchOptions && ((_a3 = fetchOptions == null ? void 0 : fetchOptions.agent) == null ? void 0 : _a3.sockets)) {
|
|
9605
10985
|
for (const socket of Object.values((_b2 = fetchOptions == null ? void 0 : fetchOptions.agent) == null ? void 0 : _b2.sockets).flat()) {
|
|
9606
10986
|
if (socket == null ? void 0 : socket.setKeepAlive) {
|
|
9607
10987
|
socket.setKeepAlive(true, socketKeepAliveInterval);
|
|
@@ -12312,13 +13692,11 @@ const events$2 = [
|
|
|
12312
13692
|
event(
|
|
12313
13693
|
"cody.chat-question/submitted",
|
|
12314
13694
|
({ feature: feature2, action }) => (params) => {
|
|
12315
|
-
const recordTranscript = params.authStatus.endpoint && isDotCom(params.authStatus);
|
|
12316
|
-
const gitMetadata = isDotCom(params.authStatus) && params.repoIsPublic && lodashExports.isArray(params.repoMetadata) ? params.repoMetadata : void 0;
|
|
12317
13695
|
telemetryRecorder.recordEvent(feature2, action, {
|
|
12318
13696
|
metadata: {
|
|
12319
|
-
// Flag indicating this is a transcript event to go through ML data pipeline.
|
|
13697
|
+
// Flag indicating this is a transcript event to go through ML data pipeline. Not for enterprise users
|
|
12320
13698
|
// See https://github.com/sourcegraph/sourcegraph/pull/59524
|
|
12321
|
-
recordsPrivateMetadataTranscript:
|
|
13699
|
+
recordsPrivateMetadataTranscript: 0,
|
|
12322
13700
|
isPublicRepo: params.repoIsPublic ? 1 : 0,
|
|
12323
13701
|
// TODO: Remove this field when the transition from commands to prompts is complete
|
|
12324
13702
|
isCommand: params.command ? 1 : 0,
|
|
@@ -12332,11 +13710,8 @@ const events$2 = [
|
|
|
12332
13710
|
requestID: params.requestID,
|
|
12333
13711
|
sessionID: params.sessionID,
|
|
12334
13712
|
traceId: params.traceId,
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
// the condition below is an additional safeguard measure
|
|
12338
|
-
promptText: recordTranscript ? truncatePromptString(params.promptText, CHAT_INPUT_TOKEN_BUDGET) : void 0,
|
|
12339
|
-
gitMetadata,
|
|
13713
|
+
promptText: void 0,
|
|
13714
|
+
gitMetadata: void 0,
|
|
12340
13715
|
chatAgent: params.chatAgent
|
|
12341
13716
|
},
|
|
12342
13717
|
billingMetadata: {
|
|
@@ -12352,7 +13727,7 @@ const events$2 = [
|
|
|
12352
13727
|
event(
|
|
12353
13728
|
"cody.chat-question/executed",
|
|
12354
13729
|
({ feature: feature2, action, map: map2 }) => (params, spans) => {
|
|
12355
|
-
const recordTranscript = params.authStatus.endpoint &&
|
|
13730
|
+
const recordTranscript = params.authStatus.endpoint && isS2(params.authStatus);
|
|
12356
13731
|
const gitMetadata = recordTranscript && params.repoIsPublic && lodashExports.isArray(params.repoMetadata) ? params.repoMetadata : void 0;
|
|
12357
13732
|
const metadata2 = lodashExports.isArray(params.context) ? publicContextSummary("context", params.context) : {
|
|
12358
13733
|
...publicContextSummary("context.used", params.context.used),
|
|
@@ -12377,8 +13752,8 @@ const events$2 = [
|
|
|
12377
13752
|
userSpecifiedIntent: params.userSpecifiedIntent,
|
|
12378
13753
|
traceId: spans.current.spanContext().traceId,
|
|
12379
13754
|
gitMetadata,
|
|
12380
|
-
// 🚨 SECURITY: Chat transcripts are to be included only for S2
|
|
12381
|
-
// V2 telemetry exports privateMetadata only for S2
|
|
13755
|
+
// 🚨 SECURITY: Chat transcripts are to be included only for S2 users AND for V2 telemetry.
|
|
13756
|
+
// V2 telemetry exports privateMetadata only for S2 users. The condition below is an additional safeguard measure.
|
|
12382
13757
|
// Check `SRC_TELEMETRY_SENSITIVEMETADATA_ADDITIONAL_ALLOWED_EVENT_TYPES` env to learn more.
|
|
12383
13758
|
promptText: recordTranscript ? truncatePromptString(params.promptText, CHAT_INPUT_TOKEN_BUDGET) : void 0,
|
|
12384
13759
|
chatAgent: params.chatAgent
|
|
@@ -14325,7 +15700,7 @@ function createRuleService(providers, {
|
|
|
14325
15700
|
const BUILTIN_RULES = [RULE_EDITING_HELPER_RULE];
|
|
14326
15701
|
const own$2 = {}.hasOwnProperty;
|
|
14327
15702
|
function zwitch(key2, options) {
|
|
14328
|
-
const settings = options;
|
|
15703
|
+
const settings = options || {};
|
|
14329
15704
|
function one2(value, ...parameters) {
|
|
14330
15705
|
let fn = one2.invalid;
|
|
14331
15706
|
const handlers2 = one2.handlers;
|
|
@@ -14766,7 +16141,7 @@ function observeProviderCall(providerClients, fn, { emitPartial, errorHook, logg
|
|
|
14766
16141
|
console.error(error);
|
|
14767
16142
|
}
|
|
14768
16143
|
return Observable.of(null);
|
|
14769
|
-
})).pipe(map$1((items) => items === EMIT_PARTIAL_SENTINEL ? items : (items || []).map((item) => ({ ...item, providerUri: uri })))))) : Observable.of([])), filter$
|
|
16144
|
+
})).pipe(map$1((items) => items === EMIT_PARTIAL_SENTINEL ? items : (items || []).map((item) => ({ ...item, providerUri: uri })))))) : Observable.of([])), filter$2((result) => !emitPartial || result.length === 0 || result.some((v) => v !== EMIT_PARTIAL_SENTINEL)), map$1((result) => result.filter((v) => v !== null && v !== EMIT_PARTIAL_SENTINEL).flat()), distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)), tap$1((items) => {
|
|
14770
16145
|
}));
|
|
14771
16146
|
}
|
|
14772
16147
|
function observeMeta(providerClients, params, opts) {
|
|
@@ -18019,16 +19394,16 @@ function resolveProviderUrisInConfig(config, scope) {
|
|
|
18019
19394
|
return void 0;
|
|
18020
19395
|
}
|
|
18021
19396
|
return Object.fromEntries(Object.entries(providers).map(([providerUri, settings]) => {
|
|
18022
|
-
const isRelativeFilePath = providerUri.startsWith("../") || providerUri.startsWith("./") || providerUri.startsWith(`..${path.sep}`) || providerUri.startsWith(`.${path.sep}`);
|
|
19397
|
+
const isRelativeFilePath = providerUri.startsWith("../") || providerUri.startsWith("./") || providerUri.startsWith(`..${path$1.sep}`) || providerUri.startsWith(`.${path$1.sep}`);
|
|
18023
19398
|
if (isRelativeFilePath) {
|
|
18024
|
-
providerUri = fromUri.with({ path: path.resolve(fromUri.path, providerUri) }).toString();
|
|
19399
|
+
providerUri = fromUri.with({ path: path$1.resolve(fromUri.path, providerUri) }).toString();
|
|
18025
19400
|
}
|
|
18026
19401
|
return [providerUri, settings];
|
|
18027
19402
|
}));
|
|
18028
19403
|
}
|
|
18029
19404
|
const scopeUri = scope && ("uri" in scope ? scope.uri : "fsPath" in scope ? scope : scope.uri);
|
|
18030
19405
|
const workspaceFile = (_a3 = workspace.workspaceFile) == null ? void 0 : _a3.with({
|
|
18031
|
-
path: path.dirname(workspace.workspaceFile.path)
|
|
19406
|
+
path: path$1.dirname(workspace.workspaceFile.path)
|
|
18032
19407
|
});
|
|
18033
19408
|
const workspaceFolder = scopeUri ? workspace.getWorkspaceFolder(scopeUri) : void 0;
|
|
18034
19409
|
const workspaceFolderSettingsFileUri = workspaceFolder ? workspaceFolder.uri.with({ path: workspaceFolder.uri.path + "/.vscode" }) : void 0;
|
|
@@ -20045,9 +21420,9 @@ function requireBuffer() {
|
|
|
20045
21420
|
Object.setPrototypeOf(newBuf, Buffer2.prototype);
|
|
20046
21421
|
return newBuf;
|
|
20047
21422
|
};
|
|
20048
|
-
function checkOffset(offset2,
|
|
21423
|
+
function checkOffset(offset2, ext2, length) {
|
|
20049
21424
|
if (offset2 % 1 !== 0 || offset2 < 0) throw new RangeError("offset is not uint");
|
|
20050
|
-
if (offset2 +
|
|
21425
|
+
if (offset2 + ext2 > length) throw new RangeError("Trying to access beyond buffer length");
|
|
20051
21426
|
}
|
|
20052
21427
|
Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = function readUIntLE(offset2, byteLength3, noAssert) {
|
|
20053
21428
|
offset2 = offset2 >>> 0;
|
|
@@ -20222,10 +21597,10 @@ function requireBuffer() {
|
|
|
20222
21597
|
if (!noAssert) checkOffset(offset2, 8, this.length);
|
|
20223
21598
|
return ieee7542.read(this, offset2, false, 52, 8);
|
|
20224
21599
|
};
|
|
20225
|
-
function checkInt(buf, value, offset2,
|
|
21600
|
+
function checkInt(buf, value, offset2, ext2, max, min) {
|
|
20226
21601
|
if (!Buffer2.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
20227
21602
|
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
|
20228
|
-
if (offset2 +
|
|
21603
|
+
if (offset2 + ext2 > buf.length) throw new RangeError("Index out of range");
|
|
20229
21604
|
}
|
|
20230
21605
|
Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset2, byteLength3, noAssert) {
|
|
20231
21606
|
value = +value;
|
|
@@ -20437,8 +21812,8 @@ function requireBuffer() {
|
|
|
20437
21812
|
Buffer2.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset2 = 0) {
|
|
20438
21813
|
return wrtBigUInt64BE(this, value, offset2, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
20439
21814
|
});
|
|
20440
|
-
function checkIEEE754(buf, value, offset2,
|
|
20441
|
-
if (offset2 +
|
|
21815
|
+
function checkIEEE754(buf, value, offset2, ext2, max, min) {
|
|
21816
|
+
if (offset2 + ext2 > buf.length) throw new RangeError("Index out of range");
|
|
20442
21817
|
if (offset2 < 0) throw new RangeError("Index out of range");
|
|
20443
21818
|
}
|
|
20444
21819
|
function writeFloat(buf, value, offset2, littleEndian, noAssert) {
|
|
@@ -20846,7 +22221,7 @@ function requireBuffer_list() {
|
|
|
20846
22221
|
}
|
|
20847
22222
|
}
|
|
20848
22223
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
20849
|
-
_defineProperties(Constructor.prototype, protoProps);
|
|
22224
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
20850
22225
|
Object.defineProperty(Constructor, "prototype", { writable: false });
|
|
20851
22226
|
return Constructor;
|
|
20852
22227
|
}
|
|
@@ -20858,11 +22233,11 @@ function requireBuffer_list() {
|
|
|
20858
22233
|
if (typeof input !== "object" || input === null) return input;
|
|
20859
22234
|
var prim2 = input[Symbol.toPrimitive];
|
|
20860
22235
|
if (prim2 !== void 0) {
|
|
20861
|
-
var res = prim2.call(input, hint);
|
|
22236
|
+
var res = prim2.call(input, hint || "default");
|
|
20862
22237
|
if (typeof res !== "object") return res;
|
|
20863
22238
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
20864
22239
|
}
|
|
20865
|
-
return String(input);
|
|
22240
|
+
return (hint === "string" ? String : Number)(input);
|
|
20866
22241
|
}
|
|
20867
22242
|
var _require = requireBuffer(), Buffer2 = _require.Buffer;
|
|
20868
22243
|
var _require2 = requireUtil(), inspect = _require2.inspect;
|
|
@@ -23944,6 +25319,13 @@ class LocalStorage {
|
|
|
23944
25319
|
const accountKey = getKeyForAuthStatus(authStatus2);
|
|
23945
25320
|
return (history == null ? void 0 : history[accountKey]) ?? { chat: {} };
|
|
23946
25321
|
}
|
|
25322
|
+
/**
|
|
25323
|
+
* Get all chat history for all accounts without authentication check
|
|
25324
|
+
* Useful for export functionality when user can't authenticate
|
|
25325
|
+
*/
|
|
25326
|
+
getAllChatHistory() {
|
|
25327
|
+
return this.storage.get(this.KEY_LOCAL_HISTORY, null);
|
|
25328
|
+
}
|
|
23947
25329
|
async setChatHistory(authStatus2, history) {
|
|
23948
25330
|
try {
|
|
23949
25331
|
const key2 = getKeyForAuthStatus(authStatus2);
|
|
@@ -24294,19 +25676,22 @@ var define_process_default$h = { env: {} };
|
|
|
24294
25676
|
const CODY_OUTPUT_CHANNEL = "Cody by Sourcegraph";
|
|
24295
25677
|
class OutputChannelManager {
|
|
24296
25678
|
constructor() {
|
|
24297
|
-
__publicField2(this, "defaultOutputChannel", window$1.createOutputChannel(CODY_OUTPUT_CHANNEL,
|
|
25679
|
+
__publicField2(this, "defaultOutputChannel", window$1.createOutputChannel(CODY_OUTPUT_CHANNEL, { log: true }));
|
|
24298
25680
|
__publicField2(this, "outputChannels", /* @__PURE__ */ new Map());
|
|
24299
25681
|
}
|
|
24300
25682
|
getOutputChannel(feature2) {
|
|
24301
|
-
if (!this.outputChannels.has(feature2) && false)
|
|
25683
|
+
if (!this.outputChannels.has(feature2) && false) {
|
|
25684
|
+
const channel2 = window$1.createOutputChannel(`Cody ${feature2}`, { log: true });
|
|
25685
|
+
this.outputChannels.set(feature2, channel2);
|
|
25686
|
+
}
|
|
24302
25687
|
return this.outputChannels.get(feature2);
|
|
24303
25688
|
}
|
|
24304
|
-
appendLine(text2, feature2) {
|
|
24305
|
-
var _a3;
|
|
24306
|
-
(_a3 = this.defaultOutputChannel) == null ? void 0 : _a3.
|
|
25689
|
+
appendLine(level2, text2, feature2) {
|
|
25690
|
+
var _a3, _b2;
|
|
25691
|
+
level2 === "error" ? (_a3 = this.defaultOutputChannel) == null ? void 0 : _a3.error(text2) : (_b2 = this.defaultOutputChannel) == null ? void 0 : _b2.debug(text2);
|
|
24307
25692
|
if (feature2) {
|
|
24308
25693
|
const channel2 = this.getOutputChannel(feature2);
|
|
24309
|
-
channel2 == null ? void 0 : channel2.
|
|
25694
|
+
level2 === "error" ? channel2 == null ? void 0 : channel2.error(text2) : channel2 == null ? void 0 : channel2.debug(text2);
|
|
24310
25695
|
}
|
|
24311
25696
|
const path2 = define_process_default$h.env.CODY_LOG_FILE;
|
|
24312
25697
|
if (path2) {
|
|
@@ -24360,7 +25745,7 @@ class Logger {
|
|
|
24360
25745
|
args: args2,
|
|
24361
25746
|
debugVerbose
|
|
24362
25747
|
});
|
|
24363
|
-
outputChannelManager.appendLine(message, feature2);
|
|
25748
|
+
outputChannelManager.appendLine(level2, message, feature2);
|
|
24364
25749
|
}
|
|
24365
25750
|
}
|
|
24366
25751
|
const outputChannelLogger = new Logger();
|
|
@@ -24985,8 +26370,8 @@ async function signOut(endpoint) {
|
|
|
24985
26370
|
}
|
|
24986
26371
|
}
|
|
24987
26372
|
);
|
|
24988
|
-
await Promise.all([secretStorage.deleteToken(endpoint), localStorage.deleteEndpoint(endpoint)]);
|
|
24989
26373
|
authProvider.signout(endpoint);
|
|
26374
|
+
await Promise.all([secretStorage.deleteToken(endpoint), localStorage.deleteEndpoint(endpoint)]);
|
|
24990
26375
|
}
|
|
24991
26376
|
async function validateCredentials(config, signal2, clientConfig) {
|
|
24992
26377
|
var _a3, _b2;
|
|
@@ -25260,6 +26645,132 @@ function getEditor() {
|
|
|
25260
26645
|
};
|
|
25261
26646
|
return get2();
|
|
25262
26647
|
}
|
|
26648
|
+
async function findWorkspaceFiles() {
|
|
26649
|
+
var _a3;
|
|
26650
|
+
const excludePatternStrings = await Promise.all(
|
|
26651
|
+
((_a3 = workspace.workspaceFolders) == null ? void 0 : _a3.flatMap(
|
|
26652
|
+
(workspaceFolder) => getExcludePattern(workspaceFolder)
|
|
26653
|
+
)) ?? []
|
|
26654
|
+
);
|
|
26655
|
+
const allExcludePatterns = [];
|
|
26656
|
+
for (const patternString of excludePatternStrings) {
|
|
26657
|
+
if ((patternString == null ? void 0 : patternString.startsWith("{")) && patternString.endsWith("}")) {
|
|
26658
|
+
const content = patternString.slice(1, -1);
|
|
26659
|
+
if (content) {
|
|
26660
|
+
allExcludePatterns.push(...content.split(",").filter((p2) => p2.trim()));
|
|
26661
|
+
}
|
|
26662
|
+
}
|
|
26663
|
+
}
|
|
26664
|
+
const config = workspace.getConfiguration();
|
|
26665
|
+
const filesExclude = config.get("files.exclude") || {};
|
|
26666
|
+
const searchExclude = config.get("search.exclude") || {};
|
|
26667
|
+
for (const [pattern, enabled] of Object.entries(filesExclude)) {
|
|
26668
|
+
if (enabled) {
|
|
26669
|
+
allExcludePatterns.push(pattern);
|
|
26670
|
+
}
|
|
26671
|
+
}
|
|
26672
|
+
for (const [pattern, enabled] of Object.entries(searchExclude)) {
|
|
26673
|
+
if (enabled) {
|
|
26674
|
+
allExcludePatterns.push(pattern);
|
|
26675
|
+
}
|
|
26676
|
+
}
|
|
26677
|
+
allExcludePatterns.push("**/.vscode/**");
|
|
26678
|
+
const excludePattern = allExcludePatterns.length > 0 ? `{${allExcludePatterns.join(",")}}` : "";
|
|
26679
|
+
return workspace.findFiles("**/*", excludePattern);
|
|
26680
|
+
}
|
|
26681
|
+
const excludeCache = /* @__PURE__ */ new Map();
|
|
26682
|
+
const fileWatchers = /* @__PURE__ */ new Map();
|
|
26683
|
+
function getCacheKey(workspaceFolder) {
|
|
26684
|
+
return (workspaceFolder == null ? void 0 : workspaceFolder.uri.toString()) ?? "no-workspace";
|
|
26685
|
+
}
|
|
26686
|
+
function setupFileWatcher(workspaceFolder) {
|
|
26687
|
+
const filename = ".sourcegraph/ignore";
|
|
26688
|
+
const watcherKey = `${workspaceFolder.uri.toString()}:${filename}`;
|
|
26689
|
+
if (fileWatchers.has(watcherKey)) {
|
|
26690
|
+
return;
|
|
26691
|
+
}
|
|
26692
|
+
const pattern = new RelativePattern(workspaceFolder, filename);
|
|
26693
|
+
const watcher = workspace.createFileSystemWatcher(pattern);
|
|
26694
|
+
const updateCache = async () => {
|
|
26695
|
+
const cacheKey = getCacheKey(workspaceFolder);
|
|
26696
|
+
const fileUri = Uri.joinPath(workspaceFolder.uri, filename);
|
|
26697
|
+
const ignoreData = await readIgnoreFile(fileUri);
|
|
26698
|
+
excludeCache.set(cacheKey, ignoreData);
|
|
26699
|
+
};
|
|
26700
|
+
watcher.onDidChange(updateCache);
|
|
26701
|
+
watcher.onDidCreate(updateCache);
|
|
26702
|
+
watcher.onDidDelete(async () => {
|
|
26703
|
+
const cacheKey = getCacheKey(workspaceFolder);
|
|
26704
|
+
excludeCache.set(cacheKey, {});
|
|
26705
|
+
});
|
|
26706
|
+
fileWatchers.set(watcherKey, watcher);
|
|
26707
|
+
}
|
|
26708
|
+
async function initializeCache(workspaceFolder) {
|
|
26709
|
+
const cacheKey = getCacheKey(workspaceFolder);
|
|
26710
|
+
if (excludeCache.has(cacheKey)) {
|
|
26711
|
+
return;
|
|
26712
|
+
}
|
|
26713
|
+
let sgignoreExclude = {};
|
|
26714
|
+
if (workspaceFolder) {
|
|
26715
|
+
sgignoreExclude = await readIgnoreFile(
|
|
26716
|
+
Uri.joinPath(workspaceFolder.uri, ".sourcegraph", "ignore")
|
|
26717
|
+
);
|
|
26718
|
+
setupFileWatcher(workspaceFolder);
|
|
26719
|
+
}
|
|
26720
|
+
excludeCache.set(cacheKey, sgignoreExclude);
|
|
26721
|
+
}
|
|
26722
|
+
async function getExcludePattern(workspaceFolder) {
|
|
26723
|
+
await initializeCache(workspaceFolder);
|
|
26724
|
+
const cacheKey = getCacheKey(workspaceFolder);
|
|
26725
|
+
const cached2 = excludeCache.get(cacheKey);
|
|
26726
|
+
const sgignoreExclude = cached2 ?? {};
|
|
26727
|
+
const mergedExclude = {
|
|
26728
|
+
...sgignoreExclude
|
|
26729
|
+
};
|
|
26730
|
+
const excludePatterns = Object.keys(mergedExclude).filter((key2) => mergedExclude[key2] === true);
|
|
26731
|
+
if (excludePatterns.length === 0) {
|
|
26732
|
+
return "";
|
|
26733
|
+
}
|
|
26734
|
+
if (excludePatterns.length === 1) {
|
|
26735
|
+
return excludePatterns[0];
|
|
26736
|
+
}
|
|
26737
|
+
return `{${excludePatterns.join(",")}}`;
|
|
26738
|
+
}
|
|
26739
|
+
async function readIgnoreFile(uri) {
|
|
26740
|
+
const ignore = {};
|
|
26741
|
+
try {
|
|
26742
|
+
const data = await workspace.fs.readFile(uri);
|
|
26743
|
+
const content = Buffer.from(data).toString("utf-8");
|
|
26744
|
+
for (let line of content.split("\n")) {
|
|
26745
|
+
if (line.startsWith("!")) {
|
|
26746
|
+
continue;
|
|
26747
|
+
}
|
|
26748
|
+
line = line.replace(/\s*(#.*)?$/, "").trim();
|
|
26749
|
+
if (line === "") {
|
|
26750
|
+
continue;
|
|
26751
|
+
}
|
|
26752
|
+
if (line.includes(",")) {
|
|
26753
|
+
line = line.replace(/,/g, ".");
|
|
26754
|
+
}
|
|
26755
|
+
if (line.endsWith("/")) {
|
|
26756
|
+
line = line.slice(0, -1);
|
|
26757
|
+
}
|
|
26758
|
+
if (!line.startsWith("/") && !line.startsWith("**/")) {
|
|
26759
|
+
line = `**/${line}`;
|
|
26760
|
+
}
|
|
26761
|
+
ignore[line] = true;
|
|
26762
|
+
}
|
|
26763
|
+
} catch (error) {
|
|
26764
|
+
}
|
|
26765
|
+
return ignore;
|
|
26766
|
+
}
|
|
26767
|
+
function disposeFileWatchers() {
|
|
26768
|
+
for (const watcher of fileWatchers.values()) {
|
|
26769
|
+
watcher.dispose();
|
|
26770
|
+
}
|
|
26771
|
+
fileWatchers.clear();
|
|
26772
|
+
excludeCache.clear();
|
|
26773
|
+
}
|
|
25263
26774
|
function ignoreReason(isIgnore) {
|
|
25264
26775
|
if (lodashExports.isError(isIgnore)) {
|
|
25265
26776
|
return isIgnore.message;
|
|
@@ -25291,6 +26802,15 @@ async function isUriIgnoredByContextFilterWithNotification(uri, feature2) {
|
|
|
25291
26802
|
}
|
|
25292
26803
|
return isIgnored;
|
|
25293
26804
|
}
|
|
26805
|
+
function initializeContextFiltersProvider() {
|
|
26806
|
+
ContextFiltersProvider.excludePatternGetter = {
|
|
26807
|
+
getExcludePattern,
|
|
26808
|
+
getWorkspaceFolder: (uri) => workspace.getWorkspaceFolder(uri) ?? null
|
|
26809
|
+
};
|
|
26810
|
+
return {
|
|
26811
|
+
dispose: disposeFileWatchers
|
|
26812
|
+
};
|
|
26813
|
+
}
|
|
25294
26814
|
const executeChat = async (args2) => {
|
|
25295
26815
|
const clientConfig = await ClientConfigSingleton.getInstance().getConfig();
|
|
25296
26816
|
const isCommand = Boolean(args2.command);
|
|
@@ -26887,7 +28407,8 @@ var treeSitter = { exports: {} };
|
|
|
26887
28407
|
setValue(lengthAddress, 0, "i32");
|
|
26888
28408
|
}
|
|
26889
28409
|
}
|
|
26890
|
-
var
|
|
28410
|
+
var runtimeKeepaliveCounter = 0;
|
|
28411
|
+
var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
|
|
26891
28412
|
var _proc_exit = (code18) => {
|
|
26892
28413
|
var _a3;
|
|
26893
28414
|
EXITSTATUS = code18;
|
|
@@ -27622,14 +29143,14 @@ var treeSitter = { exports: {} };
|
|
|
27622
29143
|
}
|
|
27623
29144
|
return this._namedChildren;
|
|
27624
29145
|
}
|
|
27625
|
-
descendantsOfType(
|
|
27626
|
-
if (!Array.isArray(
|
|
29146
|
+
descendantsOfType(types2, startPosition, endPosition) {
|
|
29147
|
+
if (!Array.isArray(types2)) types2 = [types2];
|
|
27627
29148
|
if (!startPosition) startPosition = ZERO_POINT;
|
|
27628
29149
|
if (!endPosition) endPosition = ZERO_POINT;
|
|
27629
29150
|
const symbols = [];
|
|
27630
29151
|
const typesBySymbol = this.tree.language.types;
|
|
27631
29152
|
for (let i2 = 0, n = typesBySymbol.length; i2 < n; i2++) {
|
|
27632
|
-
if (
|
|
29153
|
+
if (types2.includes(typesBySymbol[i2])) {
|
|
27633
29154
|
symbols.push(i2);
|
|
27634
29155
|
}
|
|
27635
29156
|
}
|
|
@@ -33145,7 +34666,7 @@ async function createParser$1(settings) {
|
|
|
33145
34666
|
if (cachedParser) {
|
|
33146
34667
|
return cachedParser;
|
|
33147
34668
|
}
|
|
33148
|
-
const wasmPath = path.resolve(grammarDirectory, DOCUMENT_LANGUAGE_TO_GRAMMAR[language]);
|
|
34669
|
+
const wasmPath = path$1.resolve(grammarDirectory, DOCUMENT_LANGUAGE_TO_GRAMMAR[language]);
|
|
33149
34670
|
if (!await isRegularFile(Uri.file(wasmPath))) {
|
|
33150
34671
|
return void 0;
|
|
33151
34672
|
}
|
|
@@ -35371,10 +36892,10 @@ function getSearchPatternForTestFiles(file, currentDirectoryOnly, fileNameMatche
|
|
|
35371
36892
|
return root2 + osSep + testPattern;
|
|
35372
36893
|
}
|
|
35373
36894
|
function isValidTestFile(uri) {
|
|
35374
|
-
const
|
|
35375
|
-
const fileNameWithoutExt = uriBasename(uri,
|
|
36895
|
+
const ext2 = uriExtname(uri);
|
|
36896
|
+
const fileNameWithoutExt = uriBasename(uri, ext2);
|
|
35376
36897
|
const prefixTest = /\.(?:py|rb)$/;
|
|
35377
|
-
if (prefixTest.test(
|
|
36898
|
+
if (prefixTest.test(ext2)) {
|
|
35378
36899
|
if (fileNameWithoutExt.startsWith("test_")) {
|
|
35379
36900
|
return true;
|
|
35380
36901
|
}
|
|
@@ -35781,7 +37302,7 @@ async function executeDefaultCommand(id, args2) {
|
|
|
35781
37302
|
case DefaultEditCommands.Doc:
|
|
35782
37303
|
return executeDocCommand(args2);
|
|
35783
37304
|
case DefaultEditCommands.Edit:
|
|
35784
|
-
return { task: await executeEdit(args2), type: "edit" };
|
|
37305
|
+
return { task: await executeEdit(args2 || {}), type: "edit" };
|
|
35785
37306
|
default:
|
|
35786
37307
|
console.log("not a default command");
|
|
35787
37308
|
return void 0;
|
|
@@ -36378,7 +37899,7 @@ async function resolveRelativeOrAbsoluteUri(baseDirUri, uri, fallbackUri) {
|
|
|
36378
37899
|
if (!isFileProvided) {
|
|
36379
37900
|
return fallbackUri;
|
|
36380
37901
|
}
|
|
36381
|
-
const rootDir = Uri.parse(path.join(...uri.split(separatorsRegex).slice(0, 2)));
|
|
37902
|
+
const rootDir = Uri.parse(path$1.join(...uri.split(separatorsRegex).slice(0, 2)));
|
|
36382
37903
|
const hasExistingRoot = await doesFileExist(rootDir);
|
|
36383
37904
|
if (hasExistingRoot) {
|
|
36384
37905
|
return Uri.file(uri);
|
|
@@ -36386,7 +37907,7 @@ async function resolveRelativeOrAbsoluteUri(baseDirUri, uri, fallbackUri) {
|
|
|
36386
37907
|
if (!baseDirUri) {
|
|
36387
37908
|
return fallbackUri;
|
|
36388
37909
|
}
|
|
36389
|
-
const filepath = path.join(baseDirUri.path, uri);
|
|
37910
|
+
const filepath = path$1.join(baseDirUri.path, uri);
|
|
36390
37911
|
const hasExistingFile = await doesFileExist(Uri.file(filepath));
|
|
36391
37912
|
if (hasExistingFile) {
|
|
36392
37913
|
return Uri.file(filepath);
|
|
@@ -36399,7 +37920,7 @@ function smartJoinPath(baseDirUri, relativeFileUri) {
|
|
|
36399
37920
|
const commonPartLength = filePath.findIndex((segment) => segment === workspacePath.at(-1)) + 1;
|
|
36400
37921
|
const hasCommonPart = commonPartLength > 0 && isEqual(workspacePath.slice(-commonPartLength), filePath.slice(0, commonPartLength));
|
|
36401
37922
|
const uniqueFilePath = hasCommonPart ? filePath.slice(commonPartLength) : filePath;
|
|
36402
|
-
const resultPath = path.join(baseDirUri.path, ...uniqueFilePath);
|
|
37923
|
+
const resultPath = path$1.join(baseDirUri.path, ...uniqueFilePath);
|
|
36403
37924
|
return Uri.file(resultPath);
|
|
36404
37925
|
}
|
|
36405
37926
|
const defaultLastStoredCode = {
|
|
@@ -36525,6 +38046,10 @@ async function handleSmartApply({
|
|
|
36525
38046
|
}
|
|
36526
38047
|
const document2 = uri ? await workspace.openTextDocument(uri) : activeEditor == null ? void 0 : activeEditor.document;
|
|
36527
38048
|
if (!document2) {
|
|
38049
|
+
if (!window$1.activeTextEditor && !uri) {
|
|
38050
|
+
console.warn("Smart apply operation cancelled - no active editor available");
|
|
38051
|
+
return;
|
|
38052
|
+
}
|
|
36528
38053
|
throw new Error("No editor found to insert text");
|
|
36529
38054
|
}
|
|
36530
38055
|
if (isPrefetch) {
|
|
@@ -37981,9 +39506,9 @@ const ruleFileInteractiveChanges = defer$2(
|
|
|
37981
39506
|
merge$2(
|
|
37982
39507
|
fromVSCodeEvent(workspace.onDidCreateFiles),
|
|
37983
39508
|
fromVSCodeEvent(workspace.onDidDeleteFiles)
|
|
37984
|
-
).pipe(filter$
|
|
39509
|
+
).pipe(filter$2((e) => e.files.some(isRuleFile))),
|
|
37985
39510
|
fromVSCodeEvent(workspace.onDidChangeTextDocument).pipe(
|
|
37986
|
-
filter$
|
|
39511
|
+
filter$2((e) => isRuleFile(e.document.uri))
|
|
37987
39512
|
)
|
|
37988
39513
|
).pipe(debounceTime(1e3))
|
|
37989
39514
|
);
|
|
@@ -39029,57 +40554,6 @@ function toVSCodeRange(range) {
|
|
|
39029
40554
|
}
|
|
39030
40555
|
return new Range(range.start.line, range.start.character, range.end.line, range.end.character);
|
|
39031
40556
|
}
|
|
39032
|
-
async function findWorkspaceFiles() {
|
|
39033
|
-
var _a3;
|
|
39034
|
-
const excludePatterns = await Promise.all(
|
|
39035
|
-
((_a3 = workspace.workspaceFolders) == null ? void 0 : _a3.flatMap((workspaceFolder) => {
|
|
39036
|
-
return getExcludePattern(workspaceFolder);
|
|
39037
|
-
})) ?? []
|
|
39038
|
-
);
|
|
39039
|
-
return workspace.findFiles("**/*", `{${excludePatterns.join(",")}}`);
|
|
39040
|
-
}
|
|
39041
|
-
async function getExcludePattern(workspaceFolder) {
|
|
39042
|
-
const config = workspace.getConfiguration("", workspaceFolder);
|
|
39043
|
-
const filesExclude = config.get("files.exclude", {});
|
|
39044
|
-
const searchExclude = config.get("search.exclude", {});
|
|
39045
|
-
const useIgnoreFiles = config.get("search.useIgnoreFiles");
|
|
39046
|
-
const gitignoreExclude = useIgnoreFiles && workspaceFolder ? await readIgnoreFile(Uri.joinPath(workspaceFolder.uri, ".gitignore")) : {};
|
|
39047
|
-
const ignoreExclude = useIgnoreFiles && workspaceFolder ? await readIgnoreFile(Uri.joinPath(workspaceFolder.uri, ".ignore")) : {};
|
|
39048
|
-
const mergedExclude = {
|
|
39049
|
-
...filesExclude,
|
|
39050
|
-
...searchExclude,
|
|
39051
|
-
...gitignoreExclude,
|
|
39052
|
-
...ignoreExclude
|
|
39053
|
-
};
|
|
39054
|
-
return Object.keys(mergedExclude).filter((key2) => mergedExclude[key2] === true);
|
|
39055
|
-
}
|
|
39056
|
-
async function readIgnoreFile(uri) {
|
|
39057
|
-
const ignore = {};
|
|
39058
|
-
try {
|
|
39059
|
-
const data = await workspace.fs.readFile(uri);
|
|
39060
|
-
for (let line of Buffer.from(data).toString("utf-8").split("\n")) {
|
|
39061
|
-
if (line.startsWith("!")) {
|
|
39062
|
-
continue;
|
|
39063
|
-
}
|
|
39064
|
-
line = line.replace(/\s*(#.*)?$/, "").trim();
|
|
39065
|
-
if (line === "") {
|
|
39066
|
-
continue;
|
|
39067
|
-
}
|
|
39068
|
-
if (line.includes(",")) {
|
|
39069
|
-
line = line.replace(",", ".");
|
|
39070
|
-
}
|
|
39071
|
-
if (line.endsWith("/")) {
|
|
39072
|
-
line = line.slice(0, -1);
|
|
39073
|
-
}
|
|
39074
|
-
if (!line.startsWith("/") && !line.startsWith("**/")) {
|
|
39075
|
-
line = `**/${line}`;
|
|
39076
|
-
}
|
|
39077
|
-
ignore[line] = true;
|
|
39078
|
-
}
|
|
39079
|
-
} catch {
|
|
39080
|
-
}
|
|
39081
|
-
return ignore;
|
|
39082
|
-
}
|
|
39083
40557
|
const lowScoringPathSegments = ["bin"];
|
|
39084
40558
|
const throttledFindFiles = throttle$1(() => findWorkspaceFiles(), 1e4);
|
|
39085
40559
|
async function getFileContextFiles(options) {
|
|
@@ -39142,7 +40616,9 @@ async function getFileContextFiles(options) {
|
|
|
39142
40616
|
}
|
|
39143
40617
|
const LARGE_SCORE = 1e5;
|
|
39144
40618
|
const adjustedResults = [...results].map((result) => {
|
|
39145
|
-
|
|
40619
|
+
const isVSCodeConfigFile = result.obj.uri.path.includes("/.vscode/");
|
|
40620
|
+
const isOpenDoc = openDocuments.has(result.obj.uri.path);
|
|
40621
|
+
if (isOpenDoc && !isVSCodeConfigFile) {
|
|
39146
40622
|
return {
|
|
39147
40623
|
...result,
|
|
39148
40624
|
score: result.score + LARGE_SCORE
|
|
@@ -39157,6 +40633,13 @@ async function getFileContextFiles(options) {
|
|
|
39157
40633
|
};
|
|
39158
40634
|
}
|
|
39159
40635
|
}
|
|
40636
|
+
if (result.obj.uri.path.includes("/.vscode/")) {
|
|
40637
|
+
return {
|
|
40638
|
+
...result,
|
|
40639
|
+
score: result.score - LARGE_SCORE * 10
|
|
40640
|
+
// Increase penalty significantly to prevent .vscode files from showing up
|
|
40641
|
+
};
|
|
40642
|
+
}
|
|
39160
40643
|
return result;
|
|
39161
40644
|
});
|
|
39162
40645
|
const sortedResults = (await Promise.all(
|
|
@@ -39260,6 +40743,7 @@ async function createContextFileFromUri(uri, source, type, selectionRange, kind2
|
|
|
39260
40743
|
const range = toRangeData(selectionRange);
|
|
39261
40744
|
const repoNames = await firstResultFromOperation(repoNameResolver.getRepoNamesContainingUri(uri));
|
|
39262
40745
|
const repoName = repoNames[0];
|
|
40746
|
+
const isIgnored = await contextFiltersProvider.isUriIgnored(uri);
|
|
39263
40747
|
return [
|
|
39264
40748
|
type === "file" ? {
|
|
39265
40749
|
type,
|
|
@@ -39267,7 +40751,7 @@ async function createContextFileFromUri(uri, source, type, selectionRange, kind2
|
|
|
39267
40751
|
range,
|
|
39268
40752
|
source,
|
|
39269
40753
|
repoName,
|
|
39270
|
-
isIgnored: Boolean(
|
|
40754
|
+
isIgnored: Boolean(isIgnored)
|
|
39271
40755
|
} : {
|
|
39272
40756
|
type,
|
|
39273
40757
|
symbolName,
|
|
@@ -39376,7 +40860,10 @@ async function resolveFileOrSymbolContextItem(contextItem, editor, signal2) {
|
|
|
39376
40860
|
if (contextItem.remoteRepositoryName) {
|
|
39377
40861
|
const repository = contextItem.remoteRepositoryName;
|
|
39378
40862
|
const path2 = contextItem.uri.path.slice(repository.length + 1, contextItem.uri.path.length);
|
|
39379
|
-
const ranges2 = contextItem.range ? {
|
|
40863
|
+
const ranges2 = contextItem.range ? {
|
|
40864
|
+
startLine: contextItem.range.start.line,
|
|
40865
|
+
endLine: contextItem.range.end.line + 1
|
|
40866
|
+
} : void 0;
|
|
39380
40867
|
const { auth: auth2 } = await currentResolvedConfig();
|
|
39381
40868
|
const resultOrError = await graphqlClient.getFileContent(repository, path2, ranges2, signal2);
|
|
39382
40869
|
if (!isErrorLike(resultOrError)) {
|
|
@@ -40322,10 +41809,10 @@ const getInput = async (document2, initialValues, source) => {
|
|
|
40322
41809
|
const disposables = [];
|
|
40323
41810
|
disposables.push(editFlow);
|
|
40324
41811
|
const updateTitle = (newTitle) => {
|
|
40325
|
-
modelInput.input.title = newTitle;
|
|
40326
|
-
rangeSymbolsInput.input.title = newTitle;
|
|
40327
|
-
rangeInput.input.title = newTitle;
|
|
40328
|
-
editInput.input.title = newTitle;
|
|
41812
|
+
if (modelInput) modelInput.input.title = newTitle;
|
|
41813
|
+
if (rangeSymbolsInput) rangeSymbolsInput.input.title = newTitle;
|
|
41814
|
+
if (rangeInput) rangeInput.input.title = newTitle;
|
|
41815
|
+
if (editInput) editInput.input.title = newTitle;
|
|
40329
41816
|
};
|
|
40330
41817
|
const titleListenerCallback = (newTitle) => {
|
|
40331
41818
|
editor.setDecorations(PREVIEW_RANGE_DECORATION, []);
|
|
@@ -41934,7 +43421,7 @@ function getMapping() {
|
|
|
41934
43421
|
return mapping;
|
|
41935
43422
|
}
|
|
41936
43423
|
function getLanguageForFileName(filePath) {
|
|
41937
|
-
const fileName = path.basename(filePath);
|
|
43424
|
+
const fileName = path$1.basename(filePath);
|
|
41938
43425
|
const extension = fileName.split(".").pop() || fileName;
|
|
41939
43426
|
const language = getMapping().get(extension);
|
|
41940
43427
|
return language || extension;
|
|
@@ -42933,9 +44420,11 @@ function registerNativeWebviewHandlers(agent2, webviewBundleLocalPrefix, config)
|
|
|
42933
44420
|
);
|
|
42934
44421
|
webviewProtocolDelegate.registerWebview(panel2.handle, {
|
|
42935
44422
|
didReceiveMessage(message) {
|
|
44423
|
+
console.log("[Cody] webviewProtocolDelegate didReceiveMessage");
|
|
42936
44424
|
panel2.webview.didReceiveMessageEmitter.fire(message);
|
|
42937
44425
|
},
|
|
42938
44426
|
didDispose() {
|
|
44427
|
+
console.log("[Cody] webviewProtocolDelegate didDispose");
|
|
42939
44428
|
panel2.didDispose();
|
|
42940
44429
|
}
|
|
42941
44430
|
});
|
|
@@ -42946,13 +44435,13 @@ function vscodeEnableCommandUrisToAgentEnableOnlyCommandUris(enableCommandUris)
|
|
|
42946
44435
|
return Array.isArray(enableCommandUris) ? enableCommandUris : !enableCommandUris ? [] : null;
|
|
42947
44436
|
}
|
|
42948
44437
|
class NativeWebview {
|
|
42949
|
-
constructor(delegate, handle2,
|
|
44438
|
+
constructor(delegate, handle2, _options2) {
|
|
42950
44439
|
__publicField2(this, "didReceiveMessageEmitter", new AgentEventEmitter());
|
|
42951
44440
|
__publicField2(this, "onDidReceiveMessage", this.didReceiveMessageEmitter.event);
|
|
42952
44441
|
__publicField2(this, "_html", "");
|
|
42953
44442
|
this.delegate = delegate;
|
|
42954
44443
|
this.handle = handle2;
|
|
42955
|
-
this._options =
|
|
44444
|
+
this._options = _options2;
|
|
42956
44445
|
}
|
|
42957
44446
|
get html() {
|
|
42958
44447
|
return this._html;
|
|
@@ -43066,10 +44555,12 @@ class NativeWebviewPanel {
|
|
|
43066
44555
|
this.delegate.reveal(this.handle, viewColumn, preserveFocus);
|
|
43067
44556
|
}
|
|
43068
44557
|
dispose() {
|
|
44558
|
+
console.log("[Cody] dispose weview panel");
|
|
43069
44559
|
this.delegate.dispose(this.handle);
|
|
43070
44560
|
}
|
|
43071
44561
|
// Called when the client disposes the webview.
|
|
43072
44562
|
didDispose() {
|
|
44563
|
+
console.log("[Cody] didDispose weview panel");
|
|
43073
44564
|
this.disposeEmitter.fire();
|
|
43074
44565
|
}
|
|
43075
44566
|
}
|
|
@@ -44171,7 +45662,7 @@ class LocalStorageDB {
|
|
|
44171
45662
|
constructor(ide, dir) {
|
|
44172
45663
|
__publicField2(this, "storage");
|
|
44173
45664
|
const quota = 1024 * 1024 * 256;
|
|
44174
|
-
this.storage = new LocalStorage_2(path.join(dir, `${ide}-globalState`), quota);
|
|
45665
|
+
this.storage = new LocalStorage_2(path$1.join(dir, `${ide}-globalState`), quota);
|
|
44175
45666
|
}
|
|
44176
45667
|
clear() {
|
|
44177
45668
|
this.storage.clear();
|
|
@@ -44335,8 +45826,8 @@ var define_process_default$8 = { env: {} };
|
|
|
44335
45826
|
function copyExtensionRelativeResources(extensionPath, extensionClient) {
|
|
44336
45827
|
var _a3, _b2, _c2;
|
|
44337
45828
|
const copySources = (relativeSource) => {
|
|
44338
|
-
const source = path.join("/tmp/__dirname", relativeSource);
|
|
44339
|
-
const target = path.join(extensionPath, "dist", relativeSource);
|
|
45829
|
+
const source = path$1.join("/tmp/__dirname", relativeSource);
|
|
45830
|
+
const target = path$1.join(extensionPath, "dist", relativeSource);
|
|
44340
45831
|
try {
|
|
44341
45832
|
const stat2 = statSync(source);
|
|
44342
45833
|
if (!(stat2.isFile() || stat2.isDirectory())) {
|
|
@@ -44347,7 +45838,7 @@ function copyExtensionRelativeResources(extensionPath, extensionClient) {
|
|
|
44347
45838
|
return;
|
|
44348
45839
|
}
|
|
44349
45840
|
try {
|
|
44350
|
-
mkdirSync(path.dirname(target), { recursive: true });
|
|
45841
|
+
mkdirSync(path$1.dirname(target), { recursive: true });
|
|
44351
45842
|
copySync(source, target);
|
|
44352
45843
|
} catch (err2) {
|
|
44353
45844
|
logDebug$1("copyExtensionRelativeResources", `Failed to copy ${source} to dist ${target}`, err2);
|
|
@@ -45252,7 +46743,7 @@ class Agent extends MessageHandler {
|
|
|
45252
46743
|
this.registerAuthenticatedRequest("chat/models", async ({ modelUsage }) => {
|
|
45253
46744
|
const clientConfig = await ClientConfigSingleton.getInstance().getConfig();
|
|
45254
46745
|
return {
|
|
45255
|
-
readOnly: !(
|
|
46746
|
+
readOnly: !(clientConfig == null ? void 0 : clientConfig.modelsAPIEnabled),
|
|
45256
46747
|
models: await modelsService.getModelsAvailabilityStatus(modelUsage)
|
|
45257
46748
|
};
|
|
45258
46749
|
});
|
|
@@ -46764,7 +48255,7 @@ class CommandsProvider {
|
|
|
46764
48255
|
if (!isFileURI(uri)) {
|
|
46765
48256
|
throw new Error("history only supported on local file paths");
|
|
46766
48257
|
}
|
|
46767
|
-
const { getContextFileFromGitLog } = await import("./git-log-
|
|
48258
|
+
const { getContextFileFromGitLog } = await import("./git-log-7kbEzZhk.mjs");
|
|
46768
48259
|
return getContextFileFromGitLog(uri, options);
|
|
46769
48260
|
}
|
|
46770
48261
|
dispose() {
|
|
@@ -46881,7 +48372,7 @@ class ExtensionApi {
|
|
|
46881
48372
|
this.extensionMode = extensionMode;
|
|
46882
48373
|
}
|
|
46883
48374
|
}
|
|
46884
|
-
const uninstallMarker = path.join(codyPaths().config, "uninstall-marker");
|
|
48375
|
+
const uninstallMarker = path$1.join(codyPaths().config, "uninstall-marker");
|
|
46885
48376
|
let isReinstall = void 0;
|
|
46886
48377
|
const isReinstalling = async () => {
|
|
46887
48378
|
if (typeof isReinstall === "boolean") {
|
|
@@ -147118,7 +148609,8 @@ function readDocType$1(xmlData, i2) {
|
|
|
147118
148609
|
} else if (hasBody && isElement(xmlData, i2)) i2 += 8;
|
|
147119
148610
|
else if (hasBody && isAttlist(xmlData, i2)) i2 += 8;
|
|
147120
148611
|
else if (hasBody && isNotation(xmlData, i2)) i2 += 9;
|
|
147121
|
-
else comment2 = true;
|
|
148612
|
+
else if (isComment) comment2 = true;
|
|
148613
|
+
else throw new Error("Invalid DOCTYPE");
|
|
147122
148614
|
angleBracketsCount++;
|
|
147123
148615
|
exp = "";
|
|
147124
148616
|
} else if (xmlData[i2] === ">") {
|
|
@@ -147161,6 +148653,10 @@ function readEntityExp(xmlData, i2) {
|
|
|
147161
148653
|
}
|
|
147162
148654
|
return [entityName2, val2, i2];
|
|
147163
148655
|
}
|
|
148656
|
+
function isComment(xmlData, i2) {
|
|
148657
|
+
if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "-" && xmlData[i2 + 3] === "-") return true;
|
|
148658
|
+
return false;
|
|
148659
|
+
}
|
|
147164
148660
|
function isEntity(xmlData, i2) {
|
|
147165
148661
|
if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "E" && xmlData[i2 + 3] === "N" && xmlData[i2 + 4] === "T" && xmlData[i2 + 5] === "I" && xmlData[i2 + 6] === "T" && xmlData[i2 + 7] === "Y") return true;
|
|
147166
148662
|
return false;
|
|
@@ -158515,7 +160011,7 @@ var canvaskit = { exports: {} };
|
|
|
158515
160011
|
Object.assign(c, arguments);
|
|
158516
160012
|
if (a.includes("j")) {
|
|
158517
160013
|
var f = w["dynCall_" + a];
|
|
158518
|
-
f = c.length ? f.apply(null, [b].concat(c)) : f.call(null, b);
|
|
160014
|
+
f = c && c.length ? f.apply(null, [b].concat(c)) : f.call(null, b);
|
|
158519
160015
|
} else f = Xa.get(b).apply(null, c);
|
|
158520
160016
|
return f;
|
|
158521
160017
|
};
|
|
@@ -158857,6 +160353,7 @@ var canvaskit = { exports: {} };
|
|
|
158857
160353
|
return !(a && !Z);
|
|
158858
160354
|
}
|
|
158859
160355
|
function yd(a) {
|
|
160356
|
+
a || (a = A);
|
|
158860
160357
|
if (!a.Xf) {
|
|
158861
160358
|
a.Xf = true;
|
|
158862
160359
|
var b = a.fe;
|
|
@@ -160815,7 +162312,7 @@ let canvasKitInitPromise = null;
|
|
|
160815
162312
|
let canvasKit = null;
|
|
160816
162313
|
let fontCache = null;
|
|
160817
162314
|
async function initFont() {
|
|
160818
|
-
const fontPath = path.join("/tmp/__dirname", "DejaVuSansMono.ttf");
|
|
162315
|
+
const fontPath = path$1.join("/tmp/__dirname", "DejaVuSansMono.ttf");
|
|
160819
162316
|
const buffer2 = await fs.readFile(fontPath);
|
|
160820
162317
|
return new Uint8Array(buffer2).buffer;
|
|
160821
162318
|
}
|
|
@@ -161597,13 +163094,13 @@ var CachedFn = class {
|
|
|
161597
163094
|
}
|
|
161598
163095
|
};
|
|
161599
163096
|
var Theme = class {
|
|
161600
|
-
constructor(_colorMap, _defaults,
|
|
163097
|
+
constructor(_colorMap, _defaults, _root2) {
|
|
161601
163098
|
__publicField2(this, "_cachedMatchRoot", new CachedFn(
|
|
161602
163099
|
(scopeName) => this._root.match(scopeName)
|
|
161603
163100
|
));
|
|
161604
163101
|
this._colorMap = _colorMap;
|
|
161605
163102
|
this._defaults = _defaults;
|
|
161606
|
-
this._root =
|
|
163103
|
+
this._root = _root2;
|
|
161607
163104
|
}
|
|
161608
163105
|
static createFromRawTheme(source, colorMap) {
|
|
161609
163106
|
return this.createFromParsedTheme(parseTheme(source), colorMap);
|
|
@@ -161852,13 +163349,13 @@ function resolveParsedThemeRules(parsedThemeRules, _colorMap) {
|
|
|
161852
163349
|
}
|
|
161853
163350
|
}
|
|
161854
163351
|
let colorMap = new ColorMap(_colorMap);
|
|
161855
|
-
let
|
|
163352
|
+
let defaults2 = new StyleAttributes(defaultFontStyle, colorMap.getId(defaultForeground), colorMap.getId(defaultBackground));
|
|
161856
163353
|
let root2 = new ThemeTrieElement(new ThemeTrieElementRule(0, null, -1, 0, 0), []);
|
|
161857
163354
|
for (let i2 = 0, len2 = parsedThemeRules.length; i2 < len2; i2++) {
|
|
161858
163355
|
let rule = parsedThemeRules[i2];
|
|
161859
163356
|
root2.insert(0, rule.scope, rule.parentScopes, rule.fontStyle, colorMap.getId(rule.foreground), colorMap.getId(rule.background));
|
|
161860
163357
|
}
|
|
161861
|
-
return new Theme(colorMap,
|
|
163358
|
+
return new Theme(colorMap, defaults2, root2);
|
|
161862
163359
|
}
|
|
161863
163360
|
var ColorMap = class {
|
|
161864
163361
|
constructor(_colorMap) {
|
|
@@ -166556,8 +168053,8 @@ function mergeToken(merged, variantsOrder, cssVariablePrefix, defaultColor) {
|
|
|
166556
168053
|
function codeToHast(internal, code18, options, transformerContext = {
|
|
166557
168054
|
meta: {},
|
|
166558
168055
|
options,
|
|
166559
|
-
codeToHast: (_code,
|
|
166560
|
-
codeToTokens: (_code,
|
|
168056
|
+
codeToHast: (_code, _options2) => codeToHast(internal, _code, _options2),
|
|
168057
|
+
codeToTokens: (_code, _options2) => codeToTokens(internal, _code, _options2)
|
|
166561
168058
|
}) {
|
|
166562
168059
|
var _a3, _b2;
|
|
166563
168060
|
let input = code18;
|
|
@@ -166796,8 +168293,8 @@ function codeToHtml(internal, code18, options) {
|
|
|
166796
168293
|
const context2 = {
|
|
166797
168294
|
meta: {},
|
|
166798
168295
|
options,
|
|
166799
|
-
codeToHast: (_code,
|
|
166800
|
-
codeToTokens: (_code,
|
|
168296
|
+
codeToHast: (_code, _options2) => codeToHast(internal, _code, _options2),
|
|
168297
|
+
codeToTokens: (_code, _options2) => codeToTokens(internal, _code, _options2)
|
|
166801
168298
|
};
|
|
166802
168299
|
let result = toHtml(codeToHast(internal, code18, options, context2));
|
|
166803
168300
|
for (const transformer of getTransformers(options))
|
|
@@ -172399,7 +173896,7 @@ function filterLocallyModifiedFilesOutOfRemoteContext(roots, localFilesByRoot, r
|
|
|
172399
173896
|
const relLocalFiles = /* @__PURE__ */ new Set();
|
|
172400
173897
|
const localFiles = localFilesByRoot[i2] || [];
|
|
172401
173898
|
for (const localFile of localFiles) {
|
|
172402
|
-
relLocalFiles.add(path.relative(localRoot.fsPath, localFile));
|
|
173899
|
+
relLocalFiles.add(path$1.relative(localRoot.fsPath, localFile));
|
|
172403
173900
|
}
|
|
172404
173901
|
for (const remoteRepo of remoteRepos) {
|
|
172405
173902
|
repoNameToLocalFiles.set(remoteRepo.name, relLocalFiles);
|
|
@@ -172891,7 +174388,7 @@ class ChatHandler {
|
|
|
172891
174388
|
delegate.postError(contextResult.error, "transcript");
|
|
172892
174389
|
}
|
|
172893
174390
|
if (contextResult.abort) {
|
|
172894
|
-
delegate.postDone(
|
|
174391
|
+
delegate.postDone();
|
|
172895
174392
|
return;
|
|
172896
174393
|
}
|
|
172897
174394
|
const corpusContext = contextResult.contextItems ?? [];
|
|
@@ -173229,7 +174726,7 @@ async function getContextFileFromShell(command) {
|
|
|
173229
174726
|
return [];
|
|
173230
174727
|
}
|
|
173231
174728
|
const cwd = (_e2 = (_d2 = (_c2 = workspace.workspaceFolders) == null ? void 0 : _c2[0]) == null ? void 0 : _d2.uri) == null ? void 0 : _e2.fsPath;
|
|
173232
|
-
const filteredCommand = command.replaceAll(/(\s~\/)/g, ` ${HOME_DIR}${path.sep}`);
|
|
174729
|
+
const filteredCommand = command.replaceAll(/(\s~\/)/g, ` ${HOME_DIR}${path$1.sep}`);
|
|
173233
174730
|
const allowList = new Set((agenticShellConfig == null ? void 0 : agenticShellConfig.allow) ?? []);
|
|
173234
174731
|
const blockList = /* @__PURE__ */ new Set([...BASE_DISALLOWED_COMMANDS, ...(agenticShellConfig == null ? void 0 : agenticShellConfig.block) ?? []]);
|
|
173235
174732
|
try {
|
|
@@ -175846,9 +177343,9 @@ class ZodUnion extends ZodType {
|
|
|
175846
177343
|
return this._def.options;
|
|
175847
177344
|
}
|
|
175848
177345
|
}
|
|
175849
|
-
ZodUnion.create = (
|
|
177346
|
+
ZodUnion.create = (types2, params) => {
|
|
175850
177347
|
return new ZodUnion({
|
|
175851
|
-
options:
|
|
177348
|
+
options: types2,
|
|
175852
177349
|
typeName: ZodFirstPartyTypeKind.ZodUnion,
|
|
175853
177350
|
...processCreateParams(params)
|
|
175854
177351
|
});
|
|
@@ -177928,8 +179425,8 @@ class McpError extends Error {
|
|
|
177928
179425
|
}
|
|
177929
179426
|
const DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
|
|
177930
179427
|
class Protocol {
|
|
177931
|
-
constructor(
|
|
177932
|
-
this._options =
|
|
179428
|
+
constructor(_options2) {
|
|
179429
|
+
this._options = _options2;
|
|
177933
179430
|
this._requestMessageId = 0;
|
|
177934
179431
|
this._requestHandlers = /* @__PURE__ */ new Map();
|
|
177935
179432
|
this._requestHandlerAbortControllers = /* @__PURE__ */ new Map();
|
|
@@ -182209,6 +183706,10 @@ class ChatsController {
|
|
|
182209
183706
|
}),
|
|
182210
183707
|
commands$1.registerCommand("cody.chat.toggle", async () => this.toggleChatPanel()),
|
|
182211
183708
|
commands$1.registerCommand("cody.chat.history.export", () => this.exportHistory()),
|
|
183709
|
+
commands$1.registerCommand(
|
|
183710
|
+
"cody.chat.history.export.all",
|
|
183711
|
+
() => this.exportAllChatsUnauthenticated()
|
|
183712
|
+
),
|
|
182212
183713
|
commands$1.registerCommand("cody.chat.history.clear", (arg) => this.clearHistory(arg)),
|
|
182213
183714
|
commands$1.registerCommand("cody.chat.history.delete", (item) => this.clearHistory(item)),
|
|
182214
183715
|
commands$1.registerCommand("cody.chat.history.rename", (arg) => this.renameHistory(arg)),
|
|
@@ -182388,6 +183889,61 @@ class ChatsController {
|
|
|
182388
183889
|
}
|
|
182389
183890
|
}
|
|
182390
183891
|
}
|
|
183892
|
+
/**
|
|
183893
|
+
* Export all chat history to file system without authentication check
|
|
183894
|
+
* Useful for users who can't authenticate but still have local chat data
|
|
183895
|
+
*/
|
|
183896
|
+
async exportAllChatsUnauthenticated() {
|
|
183897
|
+
var _a3, _b2;
|
|
183898
|
+
telemetryRecorder.recordEvent("cody.exportAllChats", "clicked", {
|
|
183899
|
+
billingMetadata: {
|
|
183900
|
+
product: "cody",
|
|
183901
|
+
category: "billable"
|
|
183902
|
+
}
|
|
183903
|
+
});
|
|
183904
|
+
try {
|
|
183905
|
+
const allChatHistory = localStorage.getAllChatHistory();
|
|
183906
|
+
if (!allChatHistory || Object.keys(allChatHistory).length === 0) {
|
|
183907
|
+
void window$1.showInformationMessage("No chat history found to export.");
|
|
183908
|
+
return;
|
|
183909
|
+
}
|
|
183910
|
+
const allChats = Object.values(allChatHistory).flatMap(
|
|
183911
|
+
(userHistory) => Object.values(userHistory.chat || {})
|
|
183912
|
+
);
|
|
183913
|
+
if (allChats.length === 0) {
|
|
183914
|
+
void window$1.showInformationMessage("No chat history found to export.");
|
|
183915
|
+
return;
|
|
183916
|
+
}
|
|
183917
|
+
const workspaceFolder = (_b2 = (_a3 = workspace.workspaceFolders) == null ? void 0 : _a3[0]) == null ? void 0 : _b2.uri;
|
|
183918
|
+
const defaultDir = workspaceFolder || Uri.file(require("node:os").homedir());
|
|
183919
|
+
const filename = `cody-all-chats-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`;
|
|
183920
|
+
const exportPath = await window$1.showSaveDialog({
|
|
183921
|
+
title: "Cody: Export All Chat History",
|
|
183922
|
+
filters: { "Chat History": ["json"] },
|
|
183923
|
+
defaultUri: Uri.joinPath(defaultDir, filename)
|
|
183924
|
+
});
|
|
183925
|
+
if (!exportPath) {
|
|
183926
|
+
return;
|
|
183927
|
+
}
|
|
183928
|
+
const logContent = new TextEncoder().encode(JSON.stringify(allChats, null, 2));
|
|
183929
|
+
await workspace.fs.writeFile(exportPath, logContent);
|
|
183930
|
+
void window$1.showInformationMessage(
|
|
183931
|
+
`Successfully exported ${allChats.length} chat conversations.`,
|
|
183932
|
+
"Open"
|
|
183933
|
+
).then((choice) => {
|
|
183934
|
+
if (choice === "Open") {
|
|
183935
|
+
void commands$1.executeCommand("vscode.open", exportPath);
|
|
183936
|
+
}
|
|
183937
|
+
});
|
|
183938
|
+
} catch (error) {
|
|
183939
|
+
logError$1(
|
|
183940
|
+
"ChatsController:exportAllChatsUnauthenticated",
|
|
183941
|
+
"Failed to export all chat history",
|
|
183942
|
+
error
|
|
183943
|
+
);
|
|
183944
|
+
void window$1.showErrorMessage("Failed to export chat history. See output for details.");
|
|
183945
|
+
}
|
|
183946
|
+
}
|
|
182391
183947
|
async clearHistory(chatID) {
|
|
182392
183948
|
const ClearWithoutConfirmID = "clear-all-no-confirm";
|
|
182393
183949
|
const isClearAll = !chatID || chatID === ClearWithoutConfirmID;
|
|
@@ -183363,17 +184919,17 @@ const getDefaultOptions = (options) => ({
|
|
|
183363
184919
|
...options
|
|
183364
184920
|
});
|
|
183365
184921
|
const getRefs = (options) => {
|
|
183366
|
-
const
|
|
183367
|
-
const currentPath =
|
|
184922
|
+
const _options2 = getDefaultOptions(options);
|
|
184923
|
+
const currentPath = _options2.name !== void 0 ? [..._options2.basePath, _options2.definitionPath, _options2.name] : _options2.basePath;
|
|
183368
184924
|
return {
|
|
183369
|
-
...
|
|
184925
|
+
..._options2,
|
|
183370
184926
|
currentPath,
|
|
183371
184927
|
propertyPath: void 0,
|
|
183372
|
-
seen: new Map(Object.entries(
|
|
184928
|
+
seen: new Map(Object.entries(_options2.definitions).map(([name2, def]) => [
|
|
183373
184929
|
def._def,
|
|
183374
184930
|
{
|
|
183375
184931
|
def: def._def,
|
|
183376
|
-
path: [...
|
|
184932
|
+
path: [..._options2.basePath, _options2.definitionPath, name2],
|
|
183377
184933
|
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
183378
184934
|
jsonSchema: void 0
|
|
183379
184935
|
}
|
|
@@ -184035,15 +185591,15 @@ function parseUnionDef(def, refs) {
|
|
|
184035
185591
|
return asAnyOf(def, refs);
|
|
184036
185592
|
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
184037
185593
|
if (options.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
|
|
184038
|
-
const
|
|
185594
|
+
const types2 = options.reduce((types3, x) => {
|
|
184039
185595
|
const type = primitiveMappings[x._def.typeName];
|
|
184040
|
-
return type && !
|
|
185596
|
+
return type && !types3.includes(type) ? [...types3, type] : types3;
|
|
184041
185597
|
}, []);
|
|
184042
185598
|
return {
|
|
184043
|
-
type:
|
|
185599
|
+
type: types2.length > 1 ? types2 : types2[0]
|
|
184044
185600
|
};
|
|
184045
185601
|
} else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
184046
|
-
const
|
|
185602
|
+
const types2 = options.reduce((acc, x) => {
|
|
184047
185603
|
const type = typeof x._def.value;
|
|
184048
185604
|
switch (type) {
|
|
184049
185605
|
case "string":
|
|
@@ -184062,8 +185618,8 @@ function parseUnionDef(def, refs) {
|
|
|
184062
185618
|
return acc;
|
|
184063
185619
|
}
|
|
184064
185620
|
}, []);
|
|
184065
|
-
if (
|
|
184066
|
-
const uniqueTypes =
|
|
185621
|
+
if (types2.length === options.length) {
|
|
185622
|
+
const uniqueTypes = types2.filter((x, i2, a) => a.indexOf(x) === i2);
|
|
184067
185623
|
return {
|
|
184068
185624
|
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
184069
185625
|
enum: options.reduce((acc, x) => {
|
|
@@ -186497,15 +188053,6 @@ class ChatController {
|
|
|
186497
188053
|
async getConfigForWebview() {
|
|
186498
188054
|
var _a3, _b2, _c2, _d2;
|
|
186499
188055
|
const { configuration, auth: auth2 } = await currentResolvedConfig();
|
|
186500
|
-
const [experimentalPromptEditorEnabled, internalAgentModeEnabled] = await Promise.all([
|
|
186501
|
-
firstValueFrom$1(
|
|
186502
|
-
featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.CodyExperimentalPromptEditor)
|
|
186503
|
-
),
|
|
186504
|
-
firstValueFrom$1(
|
|
186505
|
-
featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.NextAgenticChatInternal)
|
|
186506
|
-
)
|
|
186507
|
-
]);
|
|
186508
|
-
const experimentalAgenticChatEnabled = internalAgentModeEnabled && isS2(auth2.serverEndpoint);
|
|
186509
188056
|
const sidebarViewOnly = ((_b2 = (_a3 = this.extensionClient.capabilities) == null ? void 0 : _a3.webviewNativeConfig) == null ? void 0 : _b2.view) === "single";
|
|
186510
188057
|
const isEditorViewType = ((_c2 = this.webviewPanelOrView) == null ? void 0 : _c2.viewType) === "cody.editorPanel";
|
|
186511
188058
|
const webviewType = isEditorViewType && !sidebarViewOnly ? "editor" : "sidebar";
|
|
@@ -186525,8 +188072,6 @@ class ChatController {
|
|
|
186525
188072
|
internalDebugContext: configuration.internalDebugContext,
|
|
186526
188073
|
internalDebugTokenUsage: configuration.internalDebugTokenUsage,
|
|
186527
188074
|
allowEndpointChange: configuration.overrideServerEndpoint === void 0,
|
|
186528
|
-
experimentalPromptEditorEnabled,
|
|
186529
|
-
experimentalAgenticChatEnabled,
|
|
186530
188075
|
attribution
|
|
186531
188076
|
};
|
|
186532
188077
|
}
|
|
@@ -186744,16 +188289,14 @@ class ChatController {
|
|
|
186744
188289
|
});
|
|
186745
188290
|
return confirmation;
|
|
186746
188291
|
},
|
|
186747
|
-
postDone: async (
|
|
188292
|
+
postDone: async () => {
|
|
188293
|
+
var _a3;
|
|
186748
188294
|
span2.end();
|
|
186749
|
-
if ((
|
|
186750
|
-
|
|
188295
|
+
if ((_a3 = this.chatBuilder) == null ? void 0 : _a3.isEmpty()) {
|
|
188296
|
+
this.postViewTranscript();
|
|
188297
|
+
return;
|
|
186751
188298
|
}
|
|
186752
|
-
if (
|
|
186753
|
-
this.saveSession();
|
|
186754
|
-
} else if (messageInProgress && (["search", "insert", "edit"].includes((messageInProgress == null ? void 0 : messageInProgress.intent) ?? "") || (messageInProgress == null ? void 0 : messageInProgress.search) || (messageInProgress == null ? void 0 : messageInProgress.error))) {
|
|
186755
|
-
this.chatBuilder.addBotMessage(messageInProgress, model2);
|
|
186756
|
-
} else if (messageInProgress.subMessages && messageInProgress.subMessages.length > 0) {
|
|
188299
|
+
if (["search", "insert", "edit"].includes((messageInProgress == null ? void 0 : messageInProgress.intent) ?? "") || (messageInProgress == null ? void 0 : messageInProgress.search) || (messageInProgress == null ? void 0 : messageInProgress.error) || messageInProgress.subMessages && messageInProgress.subMessages.length > 0) {
|
|
186757
188300
|
this.chatBuilder.addBotMessage(messageInProgress, model2);
|
|
186758
188301
|
} else if (messageInProgress == null ? void 0 : messageInProgress.text) {
|
|
186759
188302
|
this.addBotMessage(
|
|
@@ -186764,6 +188307,7 @@ class ChatController {
|
|
|
186764
188307
|
);
|
|
186765
188308
|
}
|
|
186766
188309
|
this.postViewTranscript();
|
|
188310
|
+
void this.saveSession();
|
|
186767
188311
|
}
|
|
186768
188312
|
}
|
|
186769
188313
|
);
|
|
@@ -187192,7 +188736,6 @@ class ChatController {
|
|
|
187192
188736
|
async addBotMessage(requestID, rawResponse, didYouMeanQuery, model2) {
|
|
187193
188737
|
const messageText = reformatBotMessageForChat(rawResponse);
|
|
187194
188738
|
this.chatBuilder.addBotMessage({ text: messageText, didYouMeanQuery }, model2);
|
|
187195
|
-
void this.saveSession();
|
|
187196
188739
|
this.postViewTranscript();
|
|
187197
188740
|
const authStatus2 = currentAuthStatus();
|
|
187198
188741
|
const generatedCode = countGeneratedCode(messageText.toString());
|
|
@@ -187288,12 +188831,13 @@ class ChatController {
|
|
|
187288
188831
|
}
|
|
187289
188832
|
clearAndRestartSession(chatMessages) {
|
|
187290
188833
|
var _a3;
|
|
187291
|
-
this.cancelSubmitOrEditOperation();
|
|
187292
188834
|
if (!((_a3 = this.chatBuilder) == null ? void 0 : _a3.isEmpty())) {
|
|
188835
|
+
this.saveSession();
|
|
187293
188836
|
this.chatBuilder = new ChatBuilder(this.chatBuilder.selectedModel, void 0, chatMessages);
|
|
187294
188837
|
this.lastKnownTokenUsage = void 0;
|
|
187295
188838
|
this.postViewTranscript();
|
|
187296
188839
|
}
|
|
188840
|
+
this.cancelSubmitOrEditOperation();
|
|
187297
188841
|
}
|
|
187298
188842
|
get webviewPanelOrView() {
|
|
187299
188843
|
return this._webviewPanelOrView;
|
|
@@ -189079,8 +190623,8 @@ function parseMentionURI(uri) {
|
|
|
189079
190623
|
}
|
|
189080
190624
|
}
|
|
189081
190625
|
async function execFileAsync(program2, args2, { cwd }) {
|
|
189082
|
-
const { promisify } = await import("./util-
|
|
189083
|
-
const { execFile } = await import("./vscode-shim-
|
|
190626
|
+
const { promisify } = await import("./util-CCLzYWyF.mjs").then((n) => n.u);
|
|
190627
|
+
const { execFile } = await import("./vscode-shim-DpWxvTpJ.mjs").then((n) => n.fR);
|
|
189084
190628
|
return promisify(execFile)(program2, args2, { cwd });
|
|
189085
190629
|
}
|
|
189086
190630
|
var __create = Object.create;
|
|
@@ -189573,7 +191117,8 @@ var require_DocTypeReader = __commonJS({
|
|
|
189573
191117
|
} else if (hasBody && isElement2(xmlData, i2)) i2 += 8;
|
|
189574
191118
|
else if (hasBody && isAttlist2(xmlData, i2)) i2 += 8;
|
|
189575
191119
|
else if (hasBody && isNotation2(xmlData, i2)) i2 += 9;
|
|
189576
|
-
else comment2 = true;
|
|
191120
|
+
else if (isComment2) comment2 = true;
|
|
191121
|
+
else throw new Error("Invalid DOCTYPE");
|
|
189577
191122
|
angleBracketsCount++;
|
|
189578
191123
|
exp = "";
|
|
189579
191124
|
} else if (xmlData[i2] === ">") {
|
|
@@ -189616,6 +191161,10 @@ var require_DocTypeReader = __commonJS({
|
|
|
189616
191161
|
}
|
|
189617
191162
|
return [entityName2, val2, i2];
|
|
189618
191163
|
}
|
|
191164
|
+
function isComment2(xmlData, i2) {
|
|
191165
|
+
if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "-" && xmlData[i2 + 3] === "-") return true;
|
|
191166
|
+
return false;
|
|
191167
|
+
}
|
|
189619
191168
|
function isEntity2(xmlData, i2) {
|
|
189620
191169
|
if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "E" && xmlData[i2 + 3] === "N" && xmlData[i2 + 4] === "T" && xmlData[i2 + 5] === "I" && xmlData[i2 + 6] === "T" && xmlData[i2 + 7] === "Y") return true;
|
|
189621
191170
|
return false;
|
|
@@ -190916,8 +192465,8 @@ async function getAccessTokenLinearConnect() {
|
|
|
190916
192465
|
if (!vscode2) {
|
|
190917
192466
|
return void 0;
|
|
190918
192467
|
}
|
|
190919
|
-
const
|
|
190920
|
-
if (!
|
|
192468
|
+
const ext2 = vscode2.extensions.getExtension(LINEAR_AUTHENTICATION_EXTENSION_ID);
|
|
192469
|
+
if (!ext2) {
|
|
190921
192470
|
vscode2.window.showWarningMessage(
|
|
190922
192471
|
"Cody requires the Linear Connect extension to be installed and activated."
|
|
190923
192472
|
);
|
|
@@ -191474,14 +193023,14 @@ async function getViewerSettingsProviders() {
|
|
|
191474
193023
|
}
|
|
191475
193024
|
}
|
|
191476
193025
|
async function warnIfOpenCtxExtensionConflict() {
|
|
191477
|
-
const
|
|
191478
|
-
if (!
|
|
193026
|
+
const ext2 = extensions.getExtension("sourcegraph.openctx");
|
|
193027
|
+
if (!ext2) {
|
|
191479
193028
|
return;
|
|
191480
193029
|
}
|
|
191481
193030
|
window$1.showWarningMessage(
|
|
191482
193031
|
"Cody directly provides OpenCtx support, please disable the Sourcegraph OpenCtx extension."
|
|
191483
193032
|
);
|
|
191484
|
-
await commands$1.executeCommand("workbench.extensions.action.showExtensionsWithIds", [[
|
|
193033
|
+
await commands$1.executeCommand("workbench.extensions.action.showExtensionsWithIds", [[ext2.id]]);
|
|
191485
193034
|
}
|
|
191486
193035
|
const logger = new Logger();
|
|
191487
193036
|
const LOG_LABEL = "Guardrails";
|
|
@@ -191828,7 +193377,7 @@ he.exports;
|
|
|
191828
193377
|
(function(module2, exports2) {
|
|
191829
193378
|
(function(root2) {
|
|
191830
193379
|
var freeExports = exports2;
|
|
191831
|
-
var freeModule = module2.exports == freeExports && module2;
|
|
193380
|
+
var freeModule = module2 && module2.exports == freeExports && module2;
|
|
191832
193381
|
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal;
|
|
191833
193382
|
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
|
|
191834
193383
|
root2 = freeGlobal;
|
|
@@ -191878,14 +193427,14 @@ he.exports;
|
|
|
191878
193427
|
}
|
|
191879
193428
|
return false;
|
|
191880
193429
|
};
|
|
191881
|
-
var merge2 = function(options,
|
|
193430
|
+
var merge2 = function(options, defaults2) {
|
|
191882
193431
|
if (!options) {
|
|
191883
|
-
return
|
|
193432
|
+
return defaults2;
|
|
191884
193433
|
}
|
|
191885
193434
|
var result = {};
|
|
191886
193435
|
var key3;
|
|
191887
|
-
for (key3 in
|
|
191888
|
-
result[key3] = has2(options, key3) ? options[key3] :
|
|
193436
|
+
for (key3 in defaults2) {
|
|
193437
|
+
result[key3] = has2(options, key3) ? options[key3] : defaults2[key3];
|
|
191889
193438
|
}
|
|
191890
193439
|
return result;
|
|
191891
193440
|
};
|
|
@@ -198691,7 +200240,7 @@ async function start(context2, platform2) {
|
|
|
198691
200240
|
setResolvedConfigurationObservable(
|
|
198692
200241
|
combineLatest$1(
|
|
198693
200242
|
fromVSCodeEvent(workspace.onDidChangeConfiguration).pipe(
|
|
198694
|
-
filter$
|
|
200243
|
+
filter$2(
|
|
198695
200244
|
(event2) => event2.affectsConfiguration("cody") || event2.affectsConfiguration("openctx") || event2.affectsConfiguration("http")
|
|
198696
200245
|
),
|
|
198697
200246
|
startWith$1(void 0),
|
|
@@ -198838,6 +200387,7 @@ const register = async (context2, platform2, isExtensionModeDevOrTest) => {
|
|
|
198838
200387
|
})
|
|
198839
200388
|
)
|
|
198840
200389
|
);
|
|
200390
|
+
disposables.push(initializeContextFiltersProvider());
|
|
198841
200391
|
return Disposable.from(...disposables);
|
|
198842
200392
|
};
|
|
198843
200393
|
async function initializeSingletons(platform2, disposables) {
|
|
@@ -198950,12 +200500,22 @@ async function registerCodyCommands({
|
|
|
198950
200500
|
(a) => unifiedPromptsEnabled ? executeTestChatCommand(a) : executeTestEditCommand(a)
|
|
198951
200501
|
)
|
|
198952
200502
|
];
|
|
198953
|
-
const unifiedPromptsCommands = [
|
|
198954
|
-
|
|
198955
|
-
|
|
198956
|
-
(
|
|
198957
|
-
|
|
198958
|
-
|
|
200503
|
+
const unifiedPromptsCommands = [];
|
|
200504
|
+
try {
|
|
200505
|
+
unifiedPromptsCommands.push(
|
|
200506
|
+
commands$1.registerCommand(
|
|
200507
|
+
"cody.command.prompt-document-code",
|
|
200508
|
+
(a) => executeDocChatCommand(a)
|
|
200509
|
+
)
|
|
200510
|
+
);
|
|
200511
|
+
} catch (error) {
|
|
200512
|
+
if (false !== "true") {
|
|
200513
|
+
throw error;
|
|
200514
|
+
}
|
|
200515
|
+
console.warn(
|
|
200516
|
+
"Command cody.command.prompt-document-code already registered (testing mode)"
|
|
200517
|
+
);
|
|
200518
|
+
}
|
|
198959
200519
|
return unifiedPromptsEnabled ? [
|
|
198960
200520
|
...chatCommands,
|
|
198961
200521
|
...editCommands,
|
|
@@ -199032,7 +200592,7 @@ function registerAuthCommands(disposables) {
|
|
|
199032
200592
|
)
|
|
199033
200593
|
);
|
|
199034
200594
|
}
|
|
199035
|
-
async function registerTestCommands(
|
|
200595
|
+
async function registerTestCommands(_context, disposables) {
|
|
199036
200596
|
await commands$1.executeCommand("setContext", "cody.devOrTest", true);
|
|
199037
200597
|
disposables.push(
|
|
199038
200598
|
commands$1.registerCommand("cody.test.set-context-filters", async () => {
|
|
@@ -199153,7 +200713,7 @@ function registerAutocomplete(platform2, statusBar, disposables) {
|
|
|
199153
200713
|
if (res === NEVER$1 && !authStatus2.pendingValidation) {
|
|
199154
200714
|
finishLoading();
|
|
199155
200715
|
}
|
|
199156
|
-
return res.tap((
|
|
200716
|
+
return res.tap((_res) => {
|
|
199157
200717
|
finishLoading();
|
|
199158
200718
|
});
|
|
199159
200719
|
}),
|
|
@@ -199768,7 +201328,7 @@ const extractSafariExtensionDetails = (func2, filename) => {
|
|
|
199768
201328
|
const MAX_ALLOWED_STRING_LENGTH = 1024;
|
|
199769
201329
|
const INTEGRATION_NAME$5 = "Breadcrumbs";
|
|
199770
201330
|
const _breadcrumbsIntegration = (options = {}) => {
|
|
199771
|
-
const
|
|
201331
|
+
const _options2 = {
|
|
199772
201332
|
console: true,
|
|
199773
201333
|
dom: true,
|
|
199774
201334
|
fetch: true,
|
|
@@ -199784,22 +201344,22 @@ const _breadcrumbsIntegration = (options = {}) => {
|
|
|
199784
201344
|
},
|
|
199785
201345
|
// eslint-disable-line @typescript-eslint/no-empty-function
|
|
199786
201346
|
setup(client) {
|
|
199787
|
-
if (
|
|
201347
|
+
if (_options2.console) {
|
|
199788
201348
|
addConsoleInstrumentationHandler(_getConsoleBreadcrumbHandler(client));
|
|
199789
201349
|
}
|
|
199790
|
-
if (
|
|
199791
|
-
addClickKeypressInstrumentationHandler(_getDomBreadcrumbHandler(client,
|
|
201350
|
+
if (_options2.dom) {
|
|
201351
|
+
addClickKeypressInstrumentationHandler(_getDomBreadcrumbHandler(client, _options2.dom));
|
|
199792
201352
|
}
|
|
199793
|
-
if (
|
|
201353
|
+
if (_options2.xhr) {
|
|
199794
201354
|
addXhrInstrumentationHandler(_getXhrBreadcrumbHandler(client));
|
|
199795
201355
|
}
|
|
199796
|
-
if (
|
|
201356
|
+
if (_options2.fetch) {
|
|
199797
201357
|
addFetchInstrumentationHandler(_getFetchBreadcrumbHandler(client));
|
|
199798
201358
|
}
|
|
199799
|
-
if (
|
|
201359
|
+
if (_options2.history) {
|
|
199800
201360
|
addHistoryInstrumentationHandler(_getHistoryBreadcrumbHandler(client));
|
|
199801
201361
|
}
|
|
199802
|
-
if (
|
|
201362
|
+
if (_options2.sentry && client.on) {
|
|
199803
201363
|
client.on("beforeSendEvent", _getSentryBreadcrumbHandler(client));
|
|
199804
201364
|
}
|
|
199805
201365
|
}
|
|
@@ -200142,7 +201702,7 @@ function _getFramesFromEvent(event2) {
|
|
|
200142
201702
|
}
|
|
200143
201703
|
const INTEGRATION_NAME$3 = "GlobalHandlers";
|
|
200144
201704
|
const _globalHandlersIntegration = (options = {}) => {
|
|
200145
|
-
const
|
|
201705
|
+
const _options2 = {
|
|
200146
201706
|
onerror: true,
|
|
200147
201707
|
onunhandledrejection: true,
|
|
200148
201708
|
...options
|
|
@@ -200153,11 +201713,11 @@ const _globalHandlersIntegration = (options = {}) => {
|
|
|
200153
201713
|
Error.stackTraceLimit = 50;
|
|
200154
201714
|
},
|
|
200155
201715
|
setup(client) {
|
|
200156
|
-
if (
|
|
201716
|
+
if (_options2.onerror) {
|
|
200157
201717
|
_installGlobalOnErrorHandler(client);
|
|
200158
201718
|
globalHandlerLog("onerror");
|
|
200159
201719
|
}
|
|
200160
|
-
if (
|
|
201720
|
+
if (_options2.onunhandledrejection) {
|
|
200161
201721
|
_installGlobalOnUnhandledRejectionHandler(client);
|
|
200162
201722
|
globalHandlerLog("onunhandledrejection");
|
|
200163
201723
|
}
|
|
@@ -200381,7 +201941,7 @@ const DEFAULT_EVENT_TARGET = [
|
|
|
200381
201941
|
];
|
|
200382
201942
|
const INTEGRATION_NAME = "TryCatch";
|
|
200383
201943
|
const _browserApiErrorsIntegration = (options = {}) => {
|
|
200384
|
-
const
|
|
201944
|
+
const _options2 = {
|
|
200385
201945
|
XMLHttpRequest: true,
|
|
200386
201946
|
eventTarget: true,
|
|
200387
201947
|
requestAnimationFrame: true,
|
|
@@ -200394,19 +201954,19 @@ const _browserApiErrorsIntegration = (options = {}) => {
|
|
|
200394
201954
|
// TODO: This currently only works for the first client this is setup
|
|
200395
201955
|
// We may want to adjust this to check for client etc.
|
|
200396
201956
|
setupOnce() {
|
|
200397
|
-
if (
|
|
201957
|
+
if (_options2.setTimeout) {
|
|
200398
201958
|
fill(WINDOW, "setTimeout", _wrapTimeFunction);
|
|
200399
201959
|
}
|
|
200400
|
-
if (
|
|
201960
|
+
if (_options2.setInterval) {
|
|
200401
201961
|
fill(WINDOW, "setInterval", _wrapTimeFunction);
|
|
200402
201962
|
}
|
|
200403
|
-
if (
|
|
201963
|
+
if (_options2.requestAnimationFrame) {
|
|
200404
201964
|
fill(WINDOW, "requestAnimationFrame", _wrapRAF);
|
|
200405
201965
|
}
|
|
200406
|
-
if (
|
|
201966
|
+
if (_options2.XMLHttpRequest && "XMLHttpRequest" in WINDOW) {
|
|
200407
201967
|
fill(XMLHttpRequest.prototype, "send", _wrapXHR);
|
|
200408
201968
|
}
|
|
200409
|
-
const eventTargetOption =
|
|
201969
|
+
const eventTargetOption = _options2.eventTarget;
|
|
200410
201970
|
if (eventTargetOption) {
|
|
200411
201971
|
const eventTarget = Array.isArray(eventTargetOption) ? eventTargetOption : DEFAULT_EVENT_TARGET;
|
|
200412
201972
|
eventTarget.forEach(_wrapEventTarget);
|
|
@@ -200546,7 +202106,7 @@ const defaultIntegrations = [
|
|
|
200546
202106
|
dedupeIntegration(),
|
|
200547
202107
|
httpContextIntegration()
|
|
200548
202108
|
];
|
|
200549
|
-
function getDefaultIntegrations(
|
|
202109
|
+
function getDefaultIntegrations(_options2) {
|
|
200550
202110
|
return [
|
|
200551
202111
|
// eslint-disable-next-line deprecation/deprecation
|
|
200552
202112
|
...defaultIntegrations
|