@kubohiroya/turbowarp-plus-editor-git 0.16.1 → 0.18.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/README.ja.md +18 -2
- package/README.md +17 -1
- package/dist/branch-button.d.ts +32 -0
- package/dist/filesystem.d.ts +2 -2
- package/dist/github-pull-requests.d.ts +20 -0
- package/dist/index.d.ts +12 -6
- package/dist/index.js +739 -158
- package/dist/local-operations.d.ts +8 -1
- package/dist/messages.d.ts +16 -2
- package/dist/{project-asset-paths-KV715791.js → project-asset-paths-BzwVf9HE.js} +653 -1
- package/dist/{project-comparison-1rggIJse.js → project-comparison-BXOQcZ73.js} +10 -654
- package/dist/project-source-diff.js +2 -1
- package/dist/pull-request-panel.d.ts +25 -1
- package/dist/remote-operations.d.ts +23 -0
- package/dist/{repository-BYno-5f8.js → repository-ByKRBftJ.js} +370 -14
- package/dist/repository.d.ts +39 -0
- package/dist/repository.js +1 -1
- package/dist/style.css +28 -0
- package/package.json +1 -1
- package/src/branch-button.tsx +216 -0
- package/src/filesystem.ts +2 -1
- package/src/github-pull-requests.ts +7 -0
- package/src/index.tsx +213 -67
- package/src/local-operations.ts +23 -3
- package/src/messages.ts +14 -4
- package/src/pull-request-panel.tsx +125 -14
- package/src/remote-operations.ts +84 -3
- package/src/repository.ts +155 -9
- package/src/style.css +28 -0
- package/test/smart-http-fixture.js +20 -0
package/README.ja.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md)
|
|
4
4
|
|
|
5
|
-
TurboWarp Plus Editor
|
|
5
|
+
TurboWarp Plus Editor に「ローカル Git」パネルを追加します。リポジトリルートを一度選び、配下の sb3-toolchain v1 作品フォルダをパネルから開きます。作品の編集と保存には Editor の project-folder 接続を使います。
|
|
6
|
+
|
|
7
|
+
パネルは、Editor のメニューバーのブランチのボタンから開きます。`mountGitPanel({vm, document, host})` はパネルを組み込み、`{open(locale), refresh(), dispose()}` を返します。`renderBranchButton(createElement, {vm, locale})` は、`vm` に組み込んだパネルのボタンを描きます。パネルがないとき(ホストがローカル Git を出さないときなど)は何も描きません。ボタンはブランチのアイコン、現在のブランチ名、▾ を表示します。リポジトリを選ぶ前は **Git** と表示し、**リポジトリを選択…** に進みます。detached HEAD ではコミットの短い ID を、記録がまだないブランチではそのことを表示します。メニュー(`role="menu"`。矢印キー・Home・End・Enter で操作し、Escape でボタンに戻ります)には、ローカルブランチ(現在のブランチに印)、`origin` にあってローカルにないブランチの **… を作って切り替える**、**新しいブランチ…**(HEAD からブランチを作る小さな欄。既定で作ったら切り替えます)、**ローカル Git を開く** を並べます。ボタンとパネルは同じリポジトリと同じ操作を使うので、メニューからの切り替えも、パネルのボタンと同じく確かめ、同じ理由で断ります。切り替えた後は、パネルを開いて結果(**作品を再読込** の案内など)を示します。`localWrite` がなければ、メニューはブランチを示すだけです。ボタンは、パネルやほかのツールでのブランチの変更に追従します。パネルが見えていない間は、下のパネルの確認と同じ契機で、HEAD とブランチの参照だけを読みます。`BranchButton` は、状態をホストが持つ場合のためのボタン単体です。
|
|
6
8
|
|
|
7
9
|
ステージ済み・未ステージ・未追跡の変更、現在のブランチ、HEAD、ローカルブランチと履歴を表示します。ファイルを選ぶとテキスト差分またはバイナリのサイズを確認できます。作品データ(`project.source.json`)は、ホストがブロックの描画関数を渡していればステージ・スプライト別、コード別のブロックで比べ、「テキスト」に切り替えると行単位の差分を表示します。ステージ・スプライトの見出しには、その版の現在のコスチューム(ステージは背景)のサムネイルを添えます。素材は比較する版から読みます(ステージ済みは HEAD とインデックス、未ステージはインデックスと作業ツリー、未追跡は作業ツリー、コミットは第一親とそのコミット)。素材のフォルダはその版の `sb3-source.json` の `assetsDirectory`(既定は `assets`)です。読めない版では名前だけを示します。コミットを選ぶと第一親との差分を表示します。作品を選んでいるときは、変更一覧と差分をそのフォルダに絞ります。
|
|
8
10
|
|
|
@@ -14,7 +16,7 @@ TurboWarp Plus Editor のファイルメニューに「ローカル Git」を追
|
|
|
14
16
|
|
|
15
17
|
File System Access に対応する Chromium 系ブラウザーが必要です。初版は通常の `.git` ディレクトリとファイル内容の変更を扱います。linked worktree、サブモジュール、シンボリックリンクは対象外です。作業ツリーの実行権限の変更はブラウザーから検出できません。Git に記録済みのファイルモードは表示します。バイナリアセットはサイズを示し、テキスト差分の生成には上限があります。
|
|
16
18
|
|
|
17
|
-
Node.js 26 で `npm ci` と `npm test` を実行します。Vite でライブラリとスタイルシート、TypeScript で型宣言を生成します。`npm pack` で Editor 用の配布物を作成します。`npm run test:browser` は、最小 editor runtime(`@kubohiroya/turbowarp-plus-editor-test-runtime
|
|
19
|
+
Node.js 26 で `npm ci` と `npm test` を実行します。Vite でライブラリとスタイルシート、TypeScript で型宣言を生成します。`npm pack` で Editor 用の配布物を作成します。`npm run test:browser` は、最小 editor runtime(`@kubohiroya/turbowarp-plus-editor-test-runtime`)の上で、ブランチのボタンのメニューとキーボード操作(実際のリポジトリでパネルと並べた場合も)、履歴グラフのキーボード操作と操作メニュー、比較ダイアログのブロックの描画を Chromium で試します。Editor が固定する VM と Scratch Blocks を使い、Editor のビルドは要りません。Editor では既定で有効です。起動 URL に `twPlusLocalGit=0` を指定するとパネルの接続を解除でき、ブランチのボタンも出ません。
|
|
18
20
|
|
|
19
21
|
パネルの構成とローカル Git の扱いは [duff](https://github.com/chigichan24/duff) を参考にしました。実装には [isomorphic-git](https://github.com/isomorphic-git/isomorphic-git) と [react-diff-view](https://github.com/otakustay/react-diff-view) を使用し、同梱依存のライセンスはビルド時の第三者ライセンス一覧に収録します。
|
|
20
22
|
|
|
@@ -41,6 +43,20 @@ receive-pack の POST ごとに UUID v4 を発行し、`Git-Push-Id` に設定
|
|
|
41
43
|
|
|
42
44
|
Editor のホストが接続設定を渡すと、ローカル Git パネルで、現在のブランチと既存の GitHub HTTPS リモート `origin` に対して fetch、fast-forward pull、push ができます。push には接続時の明示許可が必要です。fetch は Git のメタデータを更新します。pull は作品を停止し、作業ツリーがクリーンで通常の実行権限なしファイルだけを扱える場合に使えます。変更を一時領域に組み立て、ローカルの状態を再確認してから適用します。pull 後はパネルから作品を再読込できます。
|
|
43
45
|
|
|
46
|
+
### 接続を使って PR を読む
|
|
47
|
+
|
|
48
|
+
GitHub 接続が接続済みのとき、PR レビューは PR の中身を GitHub API ではなく同じ Git Smart HTTP の経路で読みます。非公開リポジトリの PR も読め、中身の取得には API の利用上限を使いません。`repository.fetchPullRequest(number, getSession, guard, signal)` は GitHub の `refs/pull/<番号>/head` を、すべてのブランチと一緒に fetch します(広告と pack の 2 件)。フォークからの PR も base のリポジトリのこの ref で取れます。ブランチは fetch と同じく `refs/remotes/origin/*` を更新します。`repository.readPullRequest(head, {sha, branch})` は、手元の Git オブジェクトから、ベースとの merge base と head を比べます。変更されたパス(内容が同じ移動は名前の変更として対にします)、`project.source.json` ごとのブロック差分、同じコミットから読むサムネイルを返します。プロキシの経路と GitHub App の権限は変えません。
|
|
49
|
+
|
|
50
|
+
取得した head は `refs/pull/origin/<番号>/head` に置き、同じ PR を取得するたびに置き換えます(head は force-push されることがあるため)。`refs/heads`・`refs/remotes`・`refs/tags` の外にあるので、Git CLI では `git for-each-ref refs/pull` と `git log --all` に出て、`git branch -a` と `git tag` には出ません。`refs/remotes/origin/` の下に置くと GitHub のブランチに見え、`git fetch --prune` で消えます。ref を作らずに取得すると、オブジェクトがどこからも参照されず `git gc` で消えます。要らなくなった ref は `git update-ref -d refs/pull/origin/<番号>/head` で消せます。取得で書くのはオブジェクトと ref だけで、fetch・pull と同じ一時領域とロック(`tw-plus-git-mutation`)を通します。作業ツリー、インデックス、HEAD、`.git/config` は書きません。
|
|
51
|
+
|
|
52
|
+
一覧と、公開リポジトリの題名・本文・ベースは、引き続き公開 API から読みます(PR ごとに 1 件)。API のベースのコミットが取得で手元に来ていればそれと比べ、なければベースのブランチと比べます。非公開リポジトリではベースのブランチが API でしかわからないため、GitHub の既定のブランチと比べ、別のブランチを選べるようにします。失敗したときは、未接続またはセッション切れ、接続にリポジトリを読む権限がない、その番号の PR がない、ネットワーク、のどれかを示します。接続しているときに中身を公開 API から読むことはありません。接続していないときは、従来どおり公開 API を読みます。選んだブランチにすでにマージされた PR は、API がベースのコミットを返さない限り、変更なしと表示されます。
|
|
53
|
+
|
|
54
|
+
#### PR の版を手元で動かす
|
|
55
|
+
|
|
56
|
+
`localWrite` があるとき、接続で読んだ PR に「pr/<番号> として手元で開く」が出ます。取得した head にローカルブランチ `pr/<番号>` を作り(`pullRequestBranch(number)`。`refs/pull/origin/<番号>/head` はそのまま残します)、ブランチ一覧と同じ確認付きの経路で切り替え、選んでいる作品フォルダをそのブランチから開き直します。これで PR の版を Editor で実行できます。作品の実行中、Editor に保存していない編集があるとき、作業ツリーに変更(ステージ済み・未ステージ・未追跡)があるときは行わず、何も書きません。開いている作品フォルダが PR にないときは、先に確かめます。`pr/<番号>` がすでに同じコミットにあるときは、それに切り替えます。別のコミットを指しているとき(そのブランチで記録した、または PR が更新された)は、ブランチを動かさずに断ります。「ローカルの変更」でそのブランチに切り替えるか、Git で名前を変えるか消して(`git branch -m pr/<番号> <名前>`、`git branch -D pr/<番号>`)、もう一度開いてください。公開 API で読んだ PR は Git のオブジェクトが手元にないため、ボタンを出しません。`localWrite` がないときも出しません。
|
|
57
|
+
|
|
58
|
+
元のブランチはそのまま残ります。戻るときは「ローカルの変更」でそのブランチに切り替えます(開いた後に、パネルがブランチ名を示します)。`pr/<番号>` は追跡の設定を持たない通常のローカルブランチです。パネルは消さず、pull と push もほかのブランチと同じに扱うので、意図しない限り push しないでください。要らなくなったら `git branch -D pr/<番号>` で消せます。
|
|
59
|
+
|
|
44
60
|
## 作品ソースのブロック差分
|
|
45
61
|
|
|
46
62
|
`@kubohiroya/turbowarp-plus-editor-git/project-source-diff` の `createProjectSourceDiff` に、変更前後の `project.source.json` の文字列を渡します。戻り値を `project.diff` として保存できます。生成した unified diff には全行の文脈が入るので、ビューへ渡すときは `.diff` だけで変更前後を復元できます。既存のコンパクトな Git 差分を使う場合は、`beforeSource` に対応する変更前の JSON も渡します。
|
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Local Git adds a panel to the TurboWarp Plus Editor File menu. Select the repository root once, then browse to an sb3-toolchain v1 project folder inside it. Project editing and saving are supplied by the Editor's project-folder integration.
|
|
6
6
|
|
|
7
|
+
The panel opens from a branch button in the Editor's menu bar. `mountGitPanel({vm, document, host})` mounts the panel and returns `{open(locale), refresh(), dispose()}`; `renderBranchButton(createElement, {vm, locale})` renders the button for the panel mounted for `vm`, and renders nothing while there is none (such as when the host does not offer local Git). The button shows a branch icon, the current branch and ▾. Before a repository is chosen it reads **Git** and offers **Choose Repository…**; a detached HEAD shows its short commit ID, and a branch without records yet says so. Its menu (`role="menu"`; arrow keys, Home and End, Enter, Escape back to the button) lists the local branches with the current one checked, then **Create and switch to …** for `origin` branches without a local one, **New Branch…** (a small form that creates a branch at HEAD, switching to it by default) and **Open Local Git**. The button and the panel share one repository and the same operations, so switching from the menu asks and refuses exactly as the panel's own buttons do; the panel then opens with the result, such as the hint to **Reload Project**. Without `localWrite` the menu lists the branches only. The button follows branch changes made in the panel or by other tools: while the panel is out of view, the panel's checks below read only HEAD and the branch refs. `BranchButton` is the button on its own, for hosts that keep the state themselves.
|
|
8
|
+
|
|
7
9
|
The panel separates staged, unstaged, and untracked changes. It shows the current branch, HEAD, local branches, and the history. Select a file to inspect its text diff or binary size. When the host supplies a block renderer, project data (`project.source.json`) is compared as blocks by stage, sprite and code, and **Text** switches to the line diff. Each stage and sprite heading shows a thumbnail of its current costume (the backdrop for the stage) in each version. Assets are read from the compared versions: HEAD and the index for staged changes, the index and the working tree for unstaged changes, the working tree for untracked files, and the first parent and the commit for history. The assets folder is the `assetsDirectory` of that version's `sb3-source.json` (`assets` by default). When an asset cannot be read, only the name is shown. Pull request reviews read the same thumbnails from raw.githubusercontent.com at the merge base and head, without using the GitHub API rate limit. A review's **Reviewed** marks are kept in browser storage per repository and pull request, together with each script's content: they survive closing the panel and reloading the Editor, and only the marks of scripts whose content changed are cleared when the pull request head moves. They are never written to project files or Git. Select a commit to compare its files with its first parent. The selected project limits the file list and diffs to that folder.
|
|
8
10
|
|
|
9
11
|
While the panel is open, it checks the repository every two seconds, when the window regains focus, and on `FileSystemObserver` notifications where available. It compares the sizes and modification times of HEAD, the index, `packed-refs`, `config`, the current branch ref, and the files in the selected project folder (the whole work tree when no project is selected, up to 5,000 files). When something changed and no diff or commit is open, the panel reads the repository again. While a diff, a commit or a pull request review is open, it keeps the view and asks you to **Refresh** instead. Checks wait while Git holds a lock on its metadata. **Reload Project** opens the selected project again using the Editor's unsaved-edit confirmation. Git inspection uses a read-only adapter and isomorphic-git with index refresh disabled. If the repository changes during a read, refresh after the other operation completes.
|
|
@@ -14,7 +16,7 @@ The history is a graph of the commits reachable from the local branches, `origin
|
|
|
14
16
|
|
|
15
17
|
A Chromium-based browser with File System Access support is required. The first version supports ordinary `.git` directories and content changes. Linked worktrees, submodules, and symbolic links are outside this scope. The browser cannot detect working-tree executable-bit changes. Recorded index and tree modes remain visible. Binary assets show sizes, and text diff generation is bounded.
|
|
16
18
|
|
|
17
|
-
Use Node.js 26, run `npm ci`, then `npm test`. Vite builds the library and stylesheet, and TypeScript emits declarations. `npm pack` prepares the artifact used by the Editor build. `npm run test:browser` runs the history graph's keyboard and actions, and the comparison dialog's block drawing, in Chromium on the minimal editor runtime (`@kubohiroya/turbowarp-plus-editor-test-runtime`), with the Editor's pinned VM and Scratch Blocks and without building the Editor. The Editor enables the panel by default. Start it with `twPlusLocalGit=0` in its URL to disable the integration.
|
|
19
|
+
Use Node.js 26, run `npm ci`, then `npm test`. Vite builds the library and stylesheet, and TypeScript emits declarations. `npm pack` prepares the artifact used by the Editor build. `npm run test:browser` runs the branch button's menu and keyboard (also beside the panel on a real repository), the history graph's keyboard and actions, and the comparison dialog's block drawing, in Chromium on the minimal editor runtime (`@kubohiroya/turbowarp-plus-editor-test-runtime`), with the Editor's pinned VM and Scratch Blocks and without building the Editor. The Editor enables the panel by default. Start it with `twPlusLocalGit=0` in its URL to disable the integration; the branch button is then not shown.
|
|
18
20
|
|
|
19
21
|
The panel structure and local Git approach were informed by [duff](https://github.com/chigichan24/duff). The implementation uses [isomorphic-git](https://github.com/isomorphic-git/isomorphic-git) and [react-diff-view](https://github.com/otakustay/react-diff-view). Bundled licenses are listed in the build's third-party notices.
|
|
20
22
|
|
|
@@ -41,6 +43,20 @@ Each receive-pack POST carries a new UUID v4 in `Git-Push-Id`. A browser replay
|
|
|
41
43
|
|
|
42
44
|
When the Editor host supplies connection settings, the Local Git panel offers fetch, fast-forward pull and push for the current branch and its existing GitHub HTTPS `origin`. Authorize push when connecting to enable the explicit push action. Fetch updates Git metadata. Pull requires a stopped project, a clean worktree, and regular non-executable files. Pull stages the changes, rechecks the local state, and then applies them. Reopen the project from the panel after a successful pull.
|
|
43
45
|
|
|
46
|
+
### Pull requests over the connection
|
|
47
|
+
|
|
48
|
+
While the connection is connected, the pull request review reads a pull request's contents over the same Git Smart HTTP route instead of the GitHub API, so private repositories work and the API rate limit is not used for contents. `repository.fetchPullRequest(number, getSession, guard, signal)` fetches GitHub's `refs/pull/<number>/head`, which the base repository also exposes for pull requests from forks, together with every branch (two requests: one advertisement and one pack). The branches update `refs/remotes/origin/*` as fetch does. `repository.readPullRequest(head, {sha, branch})` then compares the head with its merge base against the base, from local Git objects: the changed paths (with exact renames paired), each `project.source.json` as a block diff, and thumbnails from the same commits. The proxy routes and the GitHub App permissions are unchanged.
|
|
49
|
+
|
|
50
|
+
The fetched head is kept at `refs/pull/origin/<number>/head`, replaced on each fetch of that pull request (heads can be force-pushed). Outside `refs/heads`, `refs/remotes` and `refs/tags`, Git CLI shows it in `git for-each-ref refs/pull` and `git log --all` but not in `git branch -a` or `git tag`; `git fetch --prune` does not remove it, unlike a ref under `refs/remotes/origin/`, which would also read as a branch on GitHub; and `git gc` keeps its objects, which a fetch without a ref would leave unreachable. Remove the refs with `git update-ref -d refs/pull/origin/<number>/head` when they are no longer needed. The fetch writes only objects and refs through the same staging and lock (`tw-plus-git-mutation`) as fetch and pull, never the work tree, the index, HEAD or `.git/config`.
|
|
51
|
+
|
|
52
|
+
The public API still provides the list, and the title, description and base of public repositories (one request per pull request). Its base commit is compared when the fetch brought it, else the base branch. For a private repository the panel compares with GitHub's default branch and lets the person choose another branch, since the base branch is only known to the API. Failures name the cause: no connection or an expired session, a connection without access to the repository, a number with no pull request, or the network. The contents are never read from the public API while the connection is connected; without a connection, the review reads the public API as before. A pull request already merged into the chosen branch shows no changes unless the API gave its base commit.
|
|
53
|
+
|
|
54
|
+
#### Running a pull request locally
|
|
55
|
+
|
|
56
|
+
With `localWrite`, a pull request read over the connection offers **Open here as pr/<number>**. It creates the local branch `pr/<number>` at the fetched head (`pullRequestBranch(number)`; `refs/pull/origin/<number>/head` stays as it is), switches to it through the same checked path as the branch list, and opens the selected project folder again from it, so the pull request's version can be run in the Editor. It is refused, and nothing is written, while the project runs, while the Editor has unsaved edits, or while the work tree has changes (staged, unstaged or untracked). It asks first when the open project folder is not in the pull request. If `pr/<number>` already exists at the same commit, the panel switches to it; if it points at another commit (you recorded on it, or the pull request moved), the panel refuses and leaves the branch unchanged. Switch to it from **Local changes**, or rename or delete it with Git (`git branch -m pr/<number> <name>`, `git branch -D pr/<number>`), and open the pull request again. The button is not shown for pull requests read from the public API, which brings no Git objects, nor without `localWrite`.
|
|
57
|
+
|
|
58
|
+
The branch you were on stays as it was. To go back, switch to it under **Local changes** (the panel names it after opening). `pr/<number>` is an ordinary local branch without tracking settings: the panel does not delete it, and pull and push treat it like any other branch, so do not push it unless you mean to. Delete it with `git branch -D pr/<number>` when it is no longer needed.
|
|
59
|
+
|
|
44
60
|
## Comparing before choosing
|
|
45
61
|
|
|
46
62
|
`openProjectComparison(document, options)` lays several titled comparisons of `project.source.json` texts in one modal and asks the user to choose an action. Each of `sections` takes the same `before` and `after` as `ProjectSourceComparison`. The promise resolves with the chosen action's `id`, or with `null` when the dialog is closed or Escape is pressed. The first action receives focus, so list the one that loses the least first. The project folder uses it to show "Your unsaved edits" next to "Changes in the folder" before replacing unsaved edits.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { HistoryActionResult } from './history-graph-view.js';
|
|
3
|
+
import type { BranchRefs } from './repository.js';
|
|
4
|
+
/** What the branch button shows: the branches of the chosen repository as the Git panel last read them. */
|
|
5
|
+
export interface BranchButtonState extends BranchRefs {
|
|
6
|
+
/** Whether a repository has been chosen. */
|
|
7
|
+
repository: boolean;
|
|
8
|
+
/** Whether the host lets the panel switch and create branches. */
|
|
9
|
+
writable: boolean;
|
|
10
|
+
/** Whether the panel is running an operation. */
|
|
11
|
+
busy: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** What the branch button asks the Git panel to do. Branch operations resolve as the panel's own buttons do. */
|
|
14
|
+
export interface BranchButtonActions {
|
|
15
|
+
open(): void;
|
|
16
|
+
choose(): void;
|
|
17
|
+
switchBranch(name: string): Promise<HistoryActionResult>;
|
|
18
|
+
/** Creates a branch at HEAD. */
|
|
19
|
+
createBranch(name: string, checkout: boolean): Promise<HistoryActionResult>;
|
|
20
|
+
/** Creates a local branch from `origin/<name>` and switches to it. */
|
|
21
|
+
createFromRemote(name: string): Promise<HistoryActionResult>;
|
|
22
|
+
}
|
|
23
|
+
export interface BranchButtonProps extends BranchButtonActions {
|
|
24
|
+
state: BranchButtonState;
|
|
25
|
+
locale?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The current branch as a menu button for the host's menu bar, with the menu of branches. Before a repository is
|
|
29
|
+
* chosen it reads "Git" and offers to choose one. A detached HEAD shows its short commit ID. The menu moves with the
|
|
30
|
+
* arrow keys, Home and End; Escape closes it and returns to the button. Without `writable` it lists the branches only.
|
|
31
|
+
*/
|
|
32
|
+
export declare function BranchButton({ state, locale, ...actions }: BranchButtonProps): React.JSX.Element;
|
package/dist/filesystem.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare class GitPanelError extends Error {
|
|
2
|
-
code: 'invalid' | 'changed' | 'large' | 'unsupported' | 'pullUnsafe' | 'diverged' | 'session' | 'pushUnknown' | 'pushRefresh' | 'rollbackFailed' | 'remoteFailed' | 'saveFirst' | 'author' | 'nothingStaged' | 'commitMessage' | 'switchUnsafe' | 'branchExists' | 'branchName' | 'locked';
|
|
3
|
-
constructor(code: 'invalid' | 'changed' | 'large' | 'unsupported' | 'pullUnsafe' | 'diverged' | 'session' | 'pushUnknown' | 'pushRefresh' | 'rollbackFailed' | 'remoteFailed' | 'saveFirst' | 'author' | 'nothingStaged' | 'commitMessage' | 'switchUnsafe' | 'branchExists' | 'branchName' | 'locked', message?: string);
|
|
2
|
+
code: 'invalid' | 'changed' | 'large' | 'unsupported' | 'pullUnsafe' | 'diverged' | 'session' | 'pushUnknown' | 'pushRefresh' | 'rollbackFailed' | 'remoteFailed' | 'saveFirst' | 'author' | 'nothingStaged' | 'commitMessage' | 'switchUnsafe' | 'branchExists' | 'branchConflict' | 'pullRequestBranch' | 'branchName' | 'locked' | 'pullRequestNotFound' | 'forbidden' | 'network' | 'baseMissing';
|
|
3
|
+
constructor(code: 'invalid' | 'changed' | 'large' | 'unsupported' | 'pullUnsafe' | 'diverged' | 'session' | 'pushUnknown' | 'pushRefresh' | 'rollbackFailed' | 'remoteFailed' | 'saveFirst' | 'author' | 'nothingStaged' | 'commitMessage' | 'switchUnsafe' | 'branchExists' | 'branchConflict' | 'pullRequestBranch' | 'branchName' | 'locked' | 'pullRequestNotFound' | 'forbidden' | 'network' | 'baseMissing', message?: string);
|
|
4
4
|
}
|
|
5
5
|
export declare const fileError: (code: string, path: string) => Error & {
|
|
6
6
|
code: string;
|
|
@@ -6,6 +6,26 @@ export declare class PullRequestError extends Error {
|
|
|
6
6
|
}
|
|
7
7
|
export declare function gitHubRepositoryFromOrigin(origin: string | undefined): string | null;
|
|
8
8
|
export declare function createGitHubPullRequests(repository: string, send?: typeof fetch): {
|
|
9
|
+
/** Reads one pull request's title, description, state and both revisions, without its files (one request). */
|
|
10
|
+
metadata(number: number, signal: AbortSignal): Promise<{
|
|
11
|
+
url: string;
|
|
12
|
+
author: string | undefined;
|
|
13
|
+
description: string;
|
|
14
|
+
base: {
|
|
15
|
+
sha: string;
|
|
16
|
+
ref: string;
|
|
17
|
+
repository: string | null;
|
|
18
|
+
};
|
|
19
|
+
head: {
|
|
20
|
+
sha: string;
|
|
21
|
+
ref: string;
|
|
22
|
+
repository: string | null;
|
|
23
|
+
};
|
|
24
|
+
state: "open" | "closed" | "merged" | "draft";
|
|
25
|
+
changedFiles: number;
|
|
26
|
+
number: number;
|
|
27
|
+
title: string;
|
|
28
|
+
}>;
|
|
9
29
|
list(page: number, signal: AbortSignal): Promise<{
|
|
10
30
|
items: {
|
|
11
31
|
number: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,17 +6,20 @@ export { createScratchBlocksDiffLocator } from './block-diff-location.js';
|
|
|
6
6
|
export { createEditorBlockLocator } from './editor-block-locator.js';
|
|
7
7
|
export { createScratchBlocksDiffRenderer } from './scratch-block-diff-renderer.js';
|
|
8
8
|
export type { ScratchBlockDiffRendererOptions, ScratchBlocksPort } from './scratch-block-diff-renderer.js';
|
|
9
|
-
export { openRepository, createReadOnlyFs, GitPanelError } from './repository.js';
|
|
9
|
+
export { openRepository, createReadOnlyFs, GitPanelError, pullRequestRef } from './repository.js';
|
|
10
10
|
export { openProjectComparison } from './project-comparison.js';
|
|
11
11
|
export { openProjectSourceTabs } from './project-source-tabs.js';
|
|
12
12
|
export type { ProjectSourceTabsFile, ProjectSourceTabsOptions } from './project-source-tabs.js';
|
|
13
13
|
export type { ProjectComparisonAction, ProjectComparisonOptions, ProjectComparisonSection } from './project-comparison.js';
|
|
14
|
-
export type { Repository, Snapshot, FileChange, FileDiff, HistoryCommit, HistoryCursor, HistoryPage, HistoryRef } from './repository.js';
|
|
14
|
+
export type { BranchRefs, PullRequestBase, PullRequestFetch, PullRequestFiles, Repository, Snapshot, FileChange, FileDiff, HistoryCommit, HistoryCursor, HistoryPage, HistoryRef } from './repository.js';
|
|
15
|
+
export { BranchButton } from './branch-button.js';
|
|
16
|
+
export type { BranchButtonActions, BranchButtonProps, BranchButtonState } from './branch-button.js';
|
|
15
17
|
export { HistoryGraph, laneColors } from './history-graph-view.js';
|
|
16
18
|
export type { HistoryActionResult, HistoryGraphProps } from './history-graph-view.js';
|
|
17
19
|
export { layoutHistory } from './history-graph.js';
|
|
18
20
|
export type { GraphCommit, GraphLayout, GraphRow, GraphSegment } from './history-graph.js';
|
|
19
21
|
export type { GitAuthor, LocalOperation } from './local-operations.js';
|
|
22
|
+
export { pullRequestBranch } from './local-operations.js';
|
|
20
23
|
export interface GitHost {
|
|
21
24
|
connectionSettings?: GitConnectionSettings;
|
|
22
25
|
renderReviewBlock?: ProjectBlockRenderer;
|
|
@@ -71,12 +74,15 @@ export declare function mountGitPanel({ vm, document, host }: {
|
|
|
71
74
|
host: GitHost;
|
|
72
75
|
}): {
|
|
73
76
|
refresh: () => Promise<void>;
|
|
77
|
+
open: (locale: string) => void;
|
|
74
78
|
dispose(): void;
|
|
75
79
|
} | null;
|
|
76
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Renders the button for the host's menu bar that shows the current branch of the panel mounted for `vm` and opens the
|
|
82
|
+
* menu of branches, the panel and the repository choice. It renders nothing while no panel is mounted for `vm`, such as
|
|
83
|
+
* when the host does not offer local Git, and shares the panel's repository, operations and checks.
|
|
84
|
+
*/
|
|
85
|
+
export declare function renderBranchButton(createElement: (component: any, props: any, ...children: any[]) => any, { vm, locale }: {
|
|
77
86
|
vm: object;
|
|
78
87
|
locale?: string;
|
|
79
|
-
MenuItem: any;
|
|
80
|
-
MenuSection: any;
|
|
81
|
-
onRequestClose(): void;
|
|
82
88
|
}): any;
|