mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 00:09:30 +01:00
Revert "Port github extension to use esbuild" (#298920)
This commit is contained in:
@@ -33,7 +33,6 @@ async function tryBuild(options: BuildOptions, didBuild?: (outDir: string) => un
|
||||
|
||||
interface RunConfig {
|
||||
readonly platform: 'node' | 'browser';
|
||||
readonly format?: 'cjs' | 'esm';
|
||||
readonly srcDir: string;
|
||||
readonly outdir: string;
|
||||
readonly entryPoints: string[] | Record<string, string> | { in: string; out: string }[];
|
||||
@@ -49,7 +48,6 @@ function resolveOptions(config: RunConfig, outdir: string): BuildOptions {
|
||||
sourcemap: true,
|
||||
target: ['es2024'],
|
||||
external: ['vscode'],
|
||||
format: config.format ?? 'cjs',
|
||||
entryPoints: config.entryPoints,
|
||||
outdir,
|
||||
logOverride: {
|
||||
@@ -59,8 +57,10 @@ function resolveOptions(config: RunConfig, outdir: string): BuildOptions {
|
||||
};
|
||||
|
||||
if (config.platform === 'node') {
|
||||
options.format = 'cjs';
|
||||
options.mainFields = ['module', 'main'];
|
||||
} else if (config.platform === 'browser') {
|
||||
options.format = 'cjs';
|
||||
options.mainFields = ['browser', 'module', 'main'];
|
||||
options.alias = {
|
||||
'path': 'path-browserify',
|
||||
|
||||
@@ -2,7 +2,7 @@ src/**
|
||||
!src/common/config.json
|
||||
out/**
|
||||
build/**
|
||||
esbuild*.mts
|
||||
extension.webpack.config.js
|
||||
tsconfig*.json
|
||||
package-lock.json
|
||||
testWorkspace/**
|
||||
|
||||
@@ -2,18 +2,22 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as path from 'node:path';
|
||||
import { run } from '../esbuild-extension-common.mts';
|
||||
// @ts-check
|
||||
import withDefaults from '../shared.webpack.config.mjs';
|
||||
|
||||
const srcDir = path.join(import.meta.dirname, 'src');
|
||||
const outDir = path.join(import.meta.dirname, 'dist');
|
||||
|
||||
run({
|
||||
platform: 'node',
|
||||
format: 'esm',
|
||||
entryPoints: {
|
||||
'extension': path.join(srcDir, 'extension.ts'),
|
||||
export default withDefaults({
|
||||
context: import.meta.dirname,
|
||||
entry: {
|
||||
extension: './src/extension.ts'
|
||||
},
|
||||
srcDir,
|
||||
outdir: outDir,
|
||||
}, process.argv);
|
||||
output: {
|
||||
libraryTarget: 'module',
|
||||
chunkFormat: 'module',
|
||||
},
|
||||
externals: {
|
||||
'vscode': 'module vscode',
|
||||
},
|
||||
experiments: {
|
||||
outputModule: true
|
||||
}
|
||||
});
|
||||
@@ -19,7 +19,8 @@
|
||||
"extensionDependencies": [
|
||||
"vscode.git-base"
|
||||
],
|
||||
"main": "./dist/extension.js",
|
||||
"main": "./out/extension.js",
|
||||
"type": "module",
|
||||
"capabilities": {
|
||||
"virtualWorkspaces": true,
|
||||
"untrustedWorkspaces": {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { EventEmitter, LogOutputChannel, Memento, Uri, workspace } from 'vscode';
|
||||
import { Repository as GitHubRepository, RepositoryRuleset } from '@octokit/graphql-schema';
|
||||
import { AuthenticationError, OctokitService } from './auth.js';
|
||||
import type { API, BranchProtection, BranchProtectionProvider, BranchProtectionRule, Repository } from './typings/git.d.ts';
|
||||
import { API, BranchProtection, BranchProtectionProvider, BranchProtectionRule, Repository } from './typings/git.js';
|
||||
import { DisposableStore, getRepositoryFromUrl } from './util.js';
|
||||
import { TelemetryReporter } from '@vscode/extension-telemetry';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { CancellationToken, CanonicalUriProvider, CanonicalUriRequestOptions, Disposable, ProviderResult, Uri, workspace } from 'vscode';
|
||||
import type { API } from './typings/git.d.ts';
|
||||
import { API } from './typings/git.js';
|
||||
|
||||
const SUPPORTED_SCHEMES = ['ssh', 'https', 'file'];
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { RefType } from './typings/git.constants.js';
|
||||
import type { API as GitAPI, Repository } from './typings/git.d.ts';
|
||||
import { API as GitAPI, RefType, Repository } from './typings/git.js';
|
||||
import { publishRepository } from './publish.js';
|
||||
import { DisposableStore, getRepositoryFromUrl } from './util.js';
|
||||
import { LinkContext, getCommitLink, getLink, getVscodeDevHost } from './links.js';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import type { CredentialsProvider, Credentials, API as GitAPI } from './typings/git.d.ts';
|
||||
import { CredentialsProvider, Credentials, API as GitAPI } from './typings/git.js';
|
||||
import { workspace, Uri, Disposable } from 'vscode';
|
||||
import { getSession } from './auth.js';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { commands, Disposable, ExtensionContext, extensions, l10n, LogLevel, LogOutputChannel, window } from 'vscode';
|
||||
import { TelemetryReporter } from '@vscode/extension-telemetry';
|
||||
import { GithubRemoteSourceProvider } from './remoteSourceProvider.js';
|
||||
import type { API, GitExtension } from './typings/git.d.ts';
|
||||
import { API, GitExtension } from './typings/git.js';
|
||||
import { registerCommands } from './commands.js';
|
||||
import { GithubCredentialProviderManager } from './credentialProvider.js';
|
||||
import { DisposableStore, repositoryHasGitHubRemote } from './util.js';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { Command, l10n, LogOutputChannel, workspace } from 'vscode';
|
||||
import { Commit, Repository as GitHubRepository, Maybe } from '@octokit/graphql-schema';
|
||||
import type { API, AvatarQuery, AvatarQueryCommit, Repository, SourceControlHistoryItemDetailsProvider } from './typings/git.d.ts';
|
||||
import { API, AvatarQuery, AvatarQueryCommit, Repository, SourceControlHistoryItemDetailsProvider } from './typings/git.js';
|
||||
import { DisposableStore, getRepositoryDefaultRemote, getRepositoryDefaultRemoteUrl, getRepositoryFromUrl, groupBy, sequentialize } from './util.js';
|
||||
import { AuthenticationError, OctokitService } from './auth.js';
|
||||
import { getAvatarLink } from './links.js';
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { RefType } from './typings/git.constants.js';
|
||||
import type { API as GitAPI, Repository } from './typings/git.d.ts';
|
||||
import { API as GitAPI, RefType, Repository } from './typings/git.js';
|
||||
import { getRepositoryFromUrl, repositoryHasGitHubRemote } from './util.js';
|
||||
|
||||
export function isFileInRepo(repository: Repository, file: vscode.Uri): boolean {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import type { API as GitAPI, Repository } from './typings/git.d.ts';
|
||||
import { API as GitAPI, Repository } from './typings/git.js';
|
||||
import { getOctokit } from './auth.js';
|
||||
import { TextEncoder } from 'util';
|
||||
import { basename } from 'path';
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
import { TextDecoder } from 'util';
|
||||
import { commands, env, ProgressLocation, Uri, window, workspace, QuickPickOptions, FileType, l10n, Disposable, TextDocumentContentProvider } from 'vscode';
|
||||
import { getOctokit } from './auth.js';
|
||||
import { GitErrorCodes } from './typings/git.constants.js';
|
||||
import type { PushErrorHandler, Remote, Repository } from './typings/git.d.ts';
|
||||
import { GitErrorCodes, PushErrorHandler, Remote, Repository } from './typings/git.js';
|
||||
import * as path from 'path';
|
||||
import { TelemetryReporter } from '@vscode/extension-telemetry';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { publishRepository } from './publish.js';
|
||||
import type { API as GitAPI, RemoteSourcePublisher, Repository } from './typings/git.d.ts';
|
||||
import { API as GitAPI, RemoteSourcePublisher, Repository } from './typings/git.js';
|
||||
|
||||
export class GithubRemoteSourcePublisher implements RemoteSourcePublisher {
|
||||
readonly name = 'GitHub';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import type { API } from './typings/git.d.ts';
|
||||
import { API } from './typings/git.js';
|
||||
import { getRepositoryFromUrl, repositoryHasGitHubRemote } from './util.js';
|
||||
import { encodeURIComponentExceptSlashes, ensurePublished, getRepositoryForFile, notebookCellRangeString, rangeString } from './links.js';
|
||||
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import type * as git from './git';
|
||||
|
||||
export type ForcePushMode = git.ForcePushMode;
|
||||
export type RefType = git.RefType;
|
||||
export type Status = git.Status;
|
||||
export type GitErrorCodes = git.GitErrorCodes;
|
||||
|
||||
export const ForcePushMode = Object.freeze({
|
||||
Force: 0,
|
||||
ForceWithLease: 1,
|
||||
ForceWithLeaseIfIncludes: 2,
|
||||
}) satisfies typeof git.ForcePushMode;
|
||||
|
||||
export const RefType = Object.freeze({
|
||||
Head: 0,
|
||||
RemoteHead: 1,
|
||||
Tag: 2,
|
||||
}) satisfies typeof git.RefType;
|
||||
|
||||
export const Status = Object.freeze({
|
||||
INDEX_MODIFIED: 0,
|
||||
INDEX_ADDED: 1,
|
||||
INDEX_DELETED: 2,
|
||||
INDEX_RENAMED: 3,
|
||||
INDEX_COPIED: 4,
|
||||
|
||||
MODIFIED: 5,
|
||||
DELETED: 6,
|
||||
UNTRACKED: 7,
|
||||
IGNORED: 8,
|
||||
INTENT_TO_ADD: 9,
|
||||
INTENT_TO_RENAME: 10,
|
||||
TYPE_CHANGED: 11,
|
||||
|
||||
ADDED_BY_US: 12,
|
||||
ADDED_BY_THEM: 13,
|
||||
DELETED_BY_US: 14,
|
||||
DELETED_BY_THEM: 15,
|
||||
BOTH_ADDED: 16,
|
||||
BOTH_DELETED: 17,
|
||||
BOTH_MODIFIED: 18,
|
||||
}) satisfies typeof git.Status;
|
||||
|
||||
export const GitErrorCodes = Object.freeze({
|
||||
BadConfigFile: 'BadConfigFile',
|
||||
BadRevision: 'BadRevision',
|
||||
AuthenticationFailed: 'AuthenticationFailed',
|
||||
NoUserNameConfigured: 'NoUserNameConfigured',
|
||||
NoUserEmailConfigured: 'NoUserEmailConfigured',
|
||||
NoRemoteRepositorySpecified: 'NoRemoteRepositorySpecified',
|
||||
NotAGitRepository: 'NotAGitRepository',
|
||||
NotASafeGitRepository: 'NotASafeGitRepository',
|
||||
NotAtRepositoryRoot: 'NotAtRepositoryRoot',
|
||||
Conflict: 'Conflict',
|
||||
StashConflict: 'StashConflict',
|
||||
UnmergedChanges: 'UnmergedChanges',
|
||||
PushRejected: 'PushRejected',
|
||||
ForcePushWithLeaseRejected: 'ForcePushWithLeaseRejected',
|
||||
ForcePushWithLeaseIfIncludesRejected: 'ForcePushWithLeaseIfIncludesRejected',
|
||||
RemoteConnectionError: 'RemoteConnectionError',
|
||||
DirtyWorkTree: 'DirtyWorkTree',
|
||||
CantOpenResource: 'CantOpenResource',
|
||||
GitNotFound: 'GitNotFound',
|
||||
CantCreatePipe: 'CantCreatePipe',
|
||||
PermissionDenied: 'PermissionDenied',
|
||||
CantAccessRemote: 'CantAccessRemote',
|
||||
RepositoryNotFound: 'RepositoryNotFound',
|
||||
RepositoryIsLocked: 'RepositoryIsLocked',
|
||||
BranchNotFullyMerged: 'BranchNotFullyMerged',
|
||||
NoRemoteReference: 'NoRemoteReference',
|
||||
InvalidBranchName: 'InvalidBranchName',
|
||||
BranchAlreadyExists: 'BranchAlreadyExists',
|
||||
NoLocalChanges: 'NoLocalChanges',
|
||||
NoStashFound: 'NoStashFound',
|
||||
LocalChangesOverwritten: 'LocalChangesOverwritten',
|
||||
NoUpstreamBranch: 'NoUpstreamBranch',
|
||||
IsInSubmodule: 'IsInSubmodule',
|
||||
WrongCase: 'WrongCase',
|
||||
CantLockRef: 'CantLockRef',
|
||||
CantRebaseMultipleBranches: 'CantRebaseMultipleBranches',
|
||||
PatchDoesNotApply: 'PatchDoesNotApply',
|
||||
NoPathFound: 'NoPathFound',
|
||||
UnknownPath: 'UnknownPath',
|
||||
EmptyCommitMessage: 'EmptyCommitMessage',
|
||||
BranchFastForwardRejected: 'BranchFastForwardRejected',
|
||||
BranchNotYetBorn: 'BranchNotYetBorn',
|
||||
TagConflict: 'TagConflict',
|
||||
CherryPickEmpty: 'CherryPickEmpty',
|
||||
CherryPickConflict: 'CherryPickConflict',
|
||||
WorktreeContainsChanges: 'WorktreeContainsChanges',
|
||||
WorktreeAlreadyExists: 'WorktreeAlreadyExists',
|
||||
WorktreeBranchAlreadyUsed: 'WorktreeBranchAlreadyUsed',
|
||||
}) satisfies Record<keyof typeof git.GitErrorCodes, string>;
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import type { Repository } from './typings/git.d.ts';
|
||||
import { Repository } from './typings/git.js';
|
||||
|
||||
export class DisposableStore {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user