browser-git-ops 0.0.4 → 0.0.7
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.md +346 -67
- package/dist/git/abstractAdapter.d.ts +25 -21
- package/dist/git/abstractAdapter.d.ts.map +1 -1
- package/dist/git/githubAdapter.d.ts +16 -83
- package/dist/git/githubAdapter.d.ts.map +1 -1
- package/dist/git/gitlabAdapter.d.ts +26 -102
- package/dist/git/gitlabAdapter.d.ts.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1742 -1341
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +1739 -1338
- package/dist/index.mjs.map +3 -3
- package/dist/virtualfs/changeTracker.d.ts +1 -0
- package/dist/virtualfs/changeTracker.d.ts.map +1 -1
- package/dist/virtualfs/conflictManager.d.ts +3 -1
- package/dist/virtualfs/conflictManager.d.ts.map +1 -1
- package/dist/virtualfs/indexedDatabaseStorage.d.ts.map +1 -1
- package/dist/virtualfs/inmemoryStorage.d.ts.map +1 -1
- package/dist/virtualfs/localChangeApplier.d.ts +6 -3
- package/dist/virtualfs/localChangeApplier.d.ts.map +1 -1
- package/dist/virtualfs/localFileManager.d.ts.map +1 -1
- package/dist/virtualfs/metadataManager.d.ts +0 -4
- package/dist/virtualfs/metadataManager.d.ts.map +1 -1
- package/dist/virtualfs/opfsStorage.d.ts.map +1 -1
- package/dist/virtualfs/remoteSynchronizer.d.ts +117 -20
- package/dist/virtualfs/remoteSynchronizer.d.ts.map +1 -1
- package/dist/virtualfs/storageBackend.d.ts +18 -18
- package/dist/virtualfs/storageBackend.d.ts.map +1 -1
- package/dist/virtualfs/types.d.ts +5 -4
- package/dist/virtualfs/types.d.ts.map +1 -1
- package/dist/virtualfs/utils/urlParser.d.ts +14 -0
- package/dist/virtualfs/utils/urlParser.d.ts.map +1 -0
- package/dist/virtualfs/virtualfs.d.ts +254 -42
- package/dist/virtualfs/virtualfs.d.ts.map +1 -1
- package/package.json +9 -10
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IndexFile } from './types.ts';
|
|
1
|
+
import { IndexFile, AdapterMeta } from './types.ts';
|
|
2
2
|
import { StorageBackend } from './storageBackend.ts';
|
|
3
3
|
import { Logger } from '../git/abstractAdapter.ts';
|
|
4
4
|
import type { CommitHistoryQuery, CommitHistoryPage } from '../git/adapter.ts';
|
|
5
5
|
import type { BranchListQuery, BranchListPage } from './types.ts';
|
|
6
|
-
type RemoteSnapshotDescriptor = {
|
|
6
|
+
export type RemoteSnapshotDescriptor = {
|
|
7
7
|
headSha: string;
|
|
8
8
|
shas: Record<string, string>;
|
|
9
9
|
fetchContent: (_paths: string[]) => Promise<Record<string, string>>;
|
|
@@ -22,7 +22,9 @@ export declare class VirtualFS {
|
|
|
22
22
|
private remoteSynchronizer;
|
|
23
23
|
/**
|
|
24
24
|
* VirtualFS のインスタンスを初期化します。
|
|
25
|
-
* @param options
|
|
25
|
+
* @param {Object} [options] - オプションセット
|
|
26
|
+
* @param {StorageBackend} [options.backend] - ストレージバックエンド
|
|
27
|
+
* @param {Logger} [options.logger] - ロガーインスタンス
|
|
26
28
|
* @returns {void}
|
|
27
29
|
*/
|
|
28
30
|
constructor(options?: {
|
|
@@ -51,18 +53,6 @@ export declare class VirtualFS {
|
|
|
51
53
|
* @returns {void}
|
|
52
54
|
*/
|
|
53
55
|
set lastCommitKey(k: string | undefined);
|
|
54
|
-
/**
|
|
55
|
-
* SHA-1 helper wrapper (delegates to ./hashUtils)
|
|
56
|
-
* @param {string} content - ハッシュ対象の文字列
|
|
57
|
-
* @returns {Promise<string>} SHA-1 ハッシュの16進表現
|
|
58
|
-
*/
|
|
59
|
-
shaOf(content: string): Promise<string>;
|
|
60
|
-
/**
|
|
61
|
-
* SHA helper for Git blob formatting
|
|
62
|
-
* @param {string} content - blob コンテンツ
|
|
63
|
-
* @returns {Promise<string>} SHA-1 ハッシュの16進表現(git blob 用)
|
|
64
|
-
*/
|
|
65
|
-
shaOfGitBlob(content: string): Promise<string>;
|
|
66
56
|
/**
|
|
67
57
|
* VirtualFS の初期化を行います(バックエンド初期化と index 読み込み)。
|
|
68
58
|
* @returns {Promise<void>}
|
|
@@ -75,11 +65,23 @@ export declare class VirtualFS {
|
|
|
75
65
|
private loadIndex;
|
|
76
66
|
/**
|
|
77
67
|
* Set adapter instance and persist adapter metadata into index file.
|
|
78
|
-
*
|
|
79
|
-
*
|
|
68
|
+
* Supports overloads:
|
|
69
|
+
* - setAdapter(meta: AdapterMeta)
|
|
70
|
+
* - setAdapter(type: string, url: string, token?: string)
|
|
71
|
+
* - setAdapter(url: string)
|
|
72
|
+
* @param {AdapterMeta|string} metaOrTypeOrUrl
|
|
80
73
|
* @returns {Promise<void>}
|
|
81
74
|
*/
|
|
82
|
-
setAdapter(
|
|
75
|
+
setAdapter(metaOrTypeOrUrl?: AdapterMeta | string): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Parse arguments for `setAdapter` and return normalized meta object.
|
|
78
|
+
* Accepts AdapterMeta, (type, url, token?), or (url).
|
|
79
|
+
* @param metaOrTypeOrUrl AdapterMeta or type or url
|
|
80
|
+
* @param urlOrUndefined optional url when first arg is type
|
|
81
|
+
* @param tokenOrUndefined optional token
|
|
82
|
+
* @returns normalized meta object
|
|
83
|
+
*/
|
|
84
|
+
private _parseAdapterArgs;
|
|
83
85
|
/**
|
|
84
86
|
* Try to inject the configured logger into the adapter instance (best-effort).
|
|
85
87
|
* @returns {Promise<void>}
|
|
@@ -109,11 +111,140 @@ export declare class VirtualFS {
|
|
|
109
111
|
private _ensureAdapterMetaLoaded;
|
|
110
112
|
/**
|
|
111
113
|
* Create adapter instance for given type and options. Returns null on failure.
|
|
112
|
-
* @param type adapter type string
|
|
113
|
-
* @param
|
|
114
|
+
* @param {string} type - adapter type string
|
|
115
|
+
* @param {any} options - adapter options
|
|
114
116
|
* @returns {any|null}
|
|
115
117
|
*/
|
|
116
118
|
private _instantiateAdapter;
|
|
119
|
+
/**
|
|
120
|
+
* Helper: obtain backend listFilesRaw in a safe manner.
|
|
121
|
+
* @returns {Promise<any[]>}
|
|
122
|
+
*/
|
|
123
|
+
private _getBackendFilesRaw;
|
|
124
|
+
/**
|
|
125
|
+
* Helper: apply parsed info text into stats object when possible.
|
|
126
|
+
* @param infoTxt raw info text
|
|
127
|
+
* @param stats stats object to mutate
|
|
128
|
+
* @returns {void}
|
|
129
|
+
*/
|
|
130
|
+
private _applyInfoTxtToStats;
|
|
131
|
+
/**
|
|
132
|
+
* Find a matched backend entry for the given filepath.
|
|
133
|
+
* @param filepath target filepath
|
|
134
|
+
* @param filesRaw backend raw listing
|
|
135
|
+
* @returns {any|null}
|
|
136
|
+
*/
|
|
137
|
+
private _findMatchedFile;
|
|
138
|
+
/**
|
|
139
|
+
* Create default stats object with consistent shape.
|
|
140
|
+
* @param now current Date
|
|
141
|
+
* @returns {any}
|
|
142
|
+
*/
|
|
143
|
+
private _createDefaultStats;
|
|
144
|
+
/**
|
|
145
|
+
* Populate stats.gitCommitSha from adapterMeta if available.
|
|
146
|
+
* @param stats stats object to mutate
|
|
147
|
+
* @returns {void}
|
|
148
|
+
*/
|
|
149
|
+
private _populateCommitShaFromMeta;
|
|
150
|
+
/**
|
|
151
|
+
* Try to resolve commit SHA from an instantiated adapter when needed.
|
|
152
|
+
* @param stats stats object to mutate
|
|
153
|
+
* @returns {Promise<void>}
|
|
154
|
+
*/
|
|
155
|
+
private _resolveCommitShaFromAdapter;
|
|
156
|
+
/**
|
|
157
|
+
* Safely get adapter instance, returning null on error.
|
|
158
|
+
* @returns {Promise<any|null>}
|
|
159
|
+
*/
|
|
160
|
+
private _safeGetAdapterInstance;
|
|
161
|
+
/**
|
|
162
|
+
* Helper: populate stats.gitCommitSha using adapterMeta or adapter.resolveRef when available.
|
|
163
|
+
* @param stats stats object to mutate
|
|
164
|
+
* @returns {Promise<void>}
|
|
165
|
+
*/
|
|
166
|
+
private _resolveAdapterCommitShaIfNeeded;
|
|
167
|
+
/**
|
|
168
|
+
* Determine whether a normalized path is an exact file entry in the provided entries.
|
|
169
|
+
* @param normalizedDirectory normalized directory string
|
|
170
|
+
* @param keys index keys array
|
|
171
|
+
* @param entries index entries object
|
|
172
|
+
* @returns {boolean}
|
|
173
|
+
*/
|
|
174
|
+
private _isExactFile;
|
|
175
|
+
/**
|
|
176
|
+
* Collect immediate child names from index entries for given directory.
|
|
177
|
+
* @param normalizedDirectory normalized directory string
|
|
178
|
+
* @param entries index entries object
|
|
179
|
+
* @returns {Set<string>} set of immediate child names
|
|
180
|
+
*/
|
|
181
|
+
private _collectNamesFromIndex;
|
|
182
|
+
/**
|
|
183
|
+
* Process a single index key for a non-root directory and add immediate child when applicable.
|
|
184
|
+
* @param key index key
|
|
185
|
+
* @param normalizedDirectory normalized directory string
|
|
186
|
+
* @param outNames set to mutate
|
|
187
|
+
* @returns {void}
|
|
188
|
+
*/
|
|
189
|
+
private _processIndexKeyForDirectory;
|
|
190
|
+
/**
|
|
191
|
+
* Safe wrapper for backend.listFiles returning [] on failure.
|
|
192
|
+
* @param normalizedDirectory directory path
|
|
193
|
+
* @returns {Promise<any[]>}
|
|
194
|
+
*/
|
|
195
|
+
private _getBackendList;
|
|
196
|
+
/**
|
|
197
|
+
* Helper for collecting names when scanning root directory entries.
|
|
198
|
+
* @param key index key
|
|
199
|
+
* @param outNames set to mutate
|
|
200
|
+
* @returns {void}
|
|
201
|
+
*/
|
|
202
|
+
private _collectNamesFromIndexRoot;
|
|
203
|
+
/**
|
|
204
|
+
* Check whether normalizedDirectory corresponds to an exact file entry.
|
|
205
|
+
* @param normalizedDirectory normalized directory string
|
|
206
|
+
* @param entries index entries object
|
|
207
|
+
* @returns {boolean}
|
|
208
|
+
*/
|
|
209
|
+
private _hasExactEntry;
|
|
210
|
+
/**
|
|
211
|
+
* Consult backend.listFiles to collect immediate child names for given directory.
|
|
212
|
+
/**
|
|
213
|
+
* Best-effort: logs and returns empty set on failure.
|
|
214
|
+
* @param {string} normalizedDirectory - normalized directory string
|
|
215
|
+
* @returns {Promise<Set<string>>}
|
|
216
|
+
*/
|
|
217
|
+
private _collectNamesFromBackend;
|
|
218
|
+
/**
|
|
219
|
+
* Return true when backend supports listFiles
|
|
220
|
+
* @returns {boolean}
|
|
221
|
+
*/
|
|
222
|
+
private _backendSupportsListFiles;
|
|
223
|
+
/**
|
|
224
|
+
* Process a single backend listFiles entry and add immediate child name to outNames when applicable.
|
|
225
|
+
* @param it backend entry
|
|
226
|
+
* @param normalizedDirectory normalized directory string
|
|
227
|
+
* @param outNames set to mutate
|
|
228
|
+
* @returns {void}
|
|
229
|
+
*/
|
|
230
|
+
private _processBackendEntry;
|
|
231
|
+
/**
|
|
232
|
+
* Build Dirent-like lightweight objects for given names.
|
|
233
|
+
* @param names array of names
|
|
234
|
+
* @param keys array of index keys
|
|
235
|
+
* @param entries index entries object
|
|
236
|
+
* @param normalizedDirectory normalized directory string
|
|
237
|
+
* @returns {Array<any>} array of Dirent-like objects
|
|
238
|
+
*/
|
|
239
|
+
private _buildDirentTypes;
|
|
240
|
+
/**
|
|
241
|
+
* Determine whether a childPath corresponds to a file, directory, or both.
|
|
242
|
+
* @param childPath path of child
|
|
243
|
+
* @param keys index keys
|
|
244
|
+
* @param entries index entries
|
|
245
|
+
* @returns {{isFile:boolean,isDirectory:boolean}}
|
|
246
|
+
*/
|
|
247
|
+
private _determineChildType;
|
|
117
248
|
/**
|
|
118
249
|
* Return persisted adapter metadata (if any).
|
|
119
250
|
* @returns {any|null}
|
|
@@ -126,12 +257,6 @@ export declare class VirtualFS {
|
|
|
126
257
|
* @returns {Promise<void>}
|
|
127
258
|
*/
|
|
128
259
|
writeFile(filepath: string, content: string): Promise<void>;
|
|
129
|
-
/**
|
|
130
|
-
* ファイルを削除します(トゥームストーン作成を含む)。
|
|
131
|
-
* @param {string} filepath ファイルパス
|
|
132
|
-
* @returns {Promise<void>}
|
|
133
|
-
*/
|
|
134
|
-
deleteFile(filepath: string): Promise<void>;
|
|
135
260
|
/**
|
|
136
261
|
* rename を delete + create の合成で行うヘルパ
|
|
137
262
|
* @param from 元パス
|
|
@@ -150,6 +275,80 @@ export declare class VirtualFS {
|
|
|
150
275
|
* @returns {Promise<string|null>} ファイル内容または null
|
|
151
276
|
*/
|
|
152
277
|
readConflict(filepath: string): Promise<string | null>;
|
|
278
|
+
/**
|
|
279
|
+
* fs.stat 互換: 指定ファイルのメタ情報を返す
|
|
280
|
+
* ワークスペース上の情報を優先し、未取得時は Git のメタ情報で補完する。
|
|
281
|
+
* @param {string} filepath - ファイルパス
|
|
282
|
+
* @returns {Promise<any>} stats オブジェクト
|
|
283
|
+
*/
|
|
284
|
+
stat(filepath: string): Promise<any>;
|
|
285
|
+
/**
|
|
286
|
+
* fs.unlink 互換: ファイルを削除する
|
|
287
|
+
* @param {string} filepath - ファイルパス
|
|
288
|
+
* @returns {Promise<void>}
|
|
289
|
+
*/
|
|
290
|
+
unlink(filepath: string): Promise<void>;
|
|
291
|
+
/**
|
|
292
|
+
* fs.mkdir 互換 (簡易実装): workspace 側にディレクトリ情報を書き込む
|
|
293
|
+
* @param {string} dirpath - ディレクトリパス
|
|
294
|
+
* @param {Object} [_options] - optional options
|
|
295
|
+
* @param {boolean} [_options.recursive] - recursive flag
|
|
296
|
+
* @param {number} [_options.mode] - mode flag
|
|
297
|
+
* @returns {Promise<void>}
|
|
298
|
+
*/
|
|
299
|
+
mkdir(dirpath: string, _options?: {
|
|
300
|
+
recursive?: boolean;
|
|
301
|
+
mode?: number;
|
|
302
|
+
}): Promise<void>;
|
|
303
|
+
/**
|
|
304
|
+
* fs.rmdir 互換 (簡易実装)
|
|
305
|
+
* @param {string} dirpath - ディレクトリパス
|
|
306
|
+
* @param {Object} [options] - optional options
|
|
307
|
+
* @param {boolean} [options.recursive] - recursive delete flag
|
|
308
|
+
* @returns {Promise<void>}
|
|
309
|
+
*/
|
|
310
|
+
rmdir(dirpath: string, options?: {
|
|
311
|
+
recursive?: boolean;
|
|
312
|
+
}): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Return list of child paths for given dirpath based on index entries.
|
|
315
|
+
* @param {string} dirpath - directory path
|
|
316
|
+
* @returns {Promise<string[]>} array of child paths
|
|
317
|
+
*/
|
|
318
|
+
private _listChildrenOfDir;
|
|
319
|
+
/**
|
|
320
|
+
* Delete array of children using localFileManager, logging failures per-child.
|
|
321
|
+
* @param {string[]} children - array of paths to delete
|
|
322
|
+
* @returns {Promise<void>}
|
|
323
|
+
*/
|
|
324
|
+
private _deleteChildrenRecursive;
|
|
325
|
+
/**
|
|
326
|
+
* fs.readdir 互換 (簡易実装)
|
|
327
|
+
* @param {string} dirpath - ディレクトリパス
|
|
328
|
+
* @param {Object} [options] - optional options
|
|
329
|
+
* @param {boolean} [options.withFileTypes] - withFileTypes flag
|
|
330
|
+
* @returns {Promise<string[]|Array<any>>} file names or Dirent array
|
|
331
|
+
*/
|
|
332
|
+
readdir(dirpath: string, options?: {
|
|
333
|
+
withFileTypes?: boolean;
|
|
334
|
+
}): Promise<any[]>;
|
|
335
|
+
/**
|
|
336
|
+
* Return an empty array when names is empty according to options, else null to continue.
|
|
337
|
+
* @param {string[]|null|undefined} names - array of names
|
|
338
|
+
* @param {Object} [options] - readdir options
|
|
339
|
+
* @param {boolean} [options.withFileTypes] - withFileTypes flag
|
|
340
|
+
* @returns {Array<any>|null} empty array or null
|
|
341
|
+
*/
|
|
342
|
+
private _returnIfNoNames;
|
|
343
|
+
/**
|
|
344
|
+
* Gather immediate child names for a directory using index and backend as fallback.
|
|
345
|
+
* Throws ENOTDIR when the path represents a file.
|
|
346
|
+
* @param {string} dirpath - original directory path
|
|
347
|
+
* @param {any} entries - index entries object
|
|
348
|
+
* @param {string[]} keys - array of index keys
|
|
349
|
+
* @returns {Promise<string[]>} immediate child names
|
|
350
|
+
*/
|
|
351
|
+
private _gatherDirectoryNames;
|
|
153
352
|
/**
|
|
154
353
|
* 指定パスのリモート衝突ファイル (.git-conflict/) を削除して
|
|
155
354
|
* 競合を解消済とマークします。
|
|
@@ -163,10 +362,10 @@ export declare class VirtualFS {
|
|
|
163
362
|
* @param {string} headSha リモート HEAD
|
|
164
363
|
* @returns {Promise<void>}
|
|
165
364
|
*/
|
|
166
|
-
applyBaseSnapshot
|
|
365
|
+
private applyBaseSnapshot;
|
|
167
366
|
/**
|
|
168
367
|
* 指定エラーが non-fast-forward を示すか判定します。
|
|
169
|
-
* @param {any}
|
|
368
|
+
* @param {any} error - 例外オブジェクト
|
|
170
369
|
* @returns {boolean}
|
|
171
370
|
*/
|
|
172
371
|
private _isNonFastForwardError;
|
|
@@ -179,11 +378,11 @@ export declare class VirtualFS {
|
|
|
179
378
|
* 登録されているパス一覧を返します。
|
|
180
379
|
* @returns {string[]}
|
|
181
380
|
*/
|
|
182
|
-
listPaths
|
|
381
|
+
private listPaths;
|
|
183
382
|
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
383
|
+
* ワークスペースとインデックスから変更セットを生成します。
|
|
384
|
+
* @returns {Promise<Array<{type:string,path:string,content?:string,baseSha?:string}>>} 変更リスト
|
|
385
|
+
*/
|
|
187
386
|
getChangeSet(): Promise<any[]>;
|
|
188
387
|
/**
|
|
189
388
|
* ローカルに対する変更(create/update/delete)を適用するヘルパー
|
|
@@ -193,35 +392,49 @@ export declare class VirtualFS {
|
|
|
193
392
|
private _applyChangeLocally;
|
|
194
393
|
/**
|
|
195
394
|
* GitLab 風の actions ベースコミットフローで push を実行します。
|
|
395
|
+
* @param {any} adapter - adapter instance
|
|
396
|
+
* @param {any} input - push input
|
|
397
|
+
* @param {string} branch - branch name
|
|
196
398
|
* @returns {Promise<{commitSha:string}>}
|
|
197
399
|
*/
|
|
198
400
|
private _pushWithActions;
|
|
199
401
|
/**
|
|
200
402
|
* GitHub 風の blob/tree/commit フローで push を実行します。
|
|
403
|
+
* @param {any} adapter - adapter instance
|
|
404
|
+
* @param {any} input - push input
|
|
405
|
+
* @param {string} branch - branch name
|
|
201
406
|
* @returns {Promise<{commitSha:string}>}
|
|
202
407
|
*/
|
|
203
408
|
private _pushWithGitHubFlow;
|
|
204
409
|
/**
|
|
205
410
|
* Try to update remote ref and handle common non-fast-forward errors.
|
|
206
411
|
* Throws when the remote reports a non-fast-forward conflict.
|
|
412
|
+
* @param {any} adapter - adapter instance
|
|
413
|
+
* @param {string} branch - branch name
|
|
414
|
+
* @param {string} commitSha - commit SHA
|
|
415
|
+
* @returns {Promise<void>}
|
|
207
416
|
*/
|
|
208
417
|
private _tryUpdateRef;
|
|
209
418
|
/**
|
|
210
419
|
* Apply changes locally, update index head and persist index.
|
|
211
420
|
* Returns the commit result object for callers.
|
|
421
|
+
* @param {string} commitSha - commit SHA
|
|
422
|
+
* @param {any} input - push input
|
|
212
423
|
* @returns {Promise<{commitSha:string}>}
|
|
213
424
|
*/
|
|
214
425
|
private _applyChangesAndFinalize;
|
|
215
426
|
/**
|
|
216
427
|
* Handle push when an adapter is provided (delegates to _pushWithActions/_pushWithGitHubFlow).
|
|
217
428
|
* Records commitKey in index metadata and returns the push result.
|
|
429
|
+
* @param {any} input - push input
|
|
430
|
+
* @param {any} adapter - adapter instance
|
|
218
431
|
* @returns {Promise<{commitSha:string}>}
|
|
219
432
|
*/
|
|
220
433
|
private _handlePushWithAdapter;
|
|
221
434
|
/**
|
|
222
435
|
* リモートのスナップショットを取り込み、コンフリクト情報を返します。
|
|
223
|
-
* @param {string}
|
|
224
|
-
* @param {
|
|
436
|
+
* @param {RemoteSnapshotDescriptor|string|Object} remote - リモート情報
|
|
437
|
+
* @param {Record<string,string>} [baseSnapshot] - path->content マップ
|
|
225
438
|
* @returns {Promise<{conflicts:Array<import('./types').ConflictEntry>}>}
|
|
226
439
|
*/
|
|
227
440
|
pull(remote: RemoteSnapshotDescriptor | string | {
|
|
@@ -250,8 +463,9 @@ export declare class VirtualFS {
|
|
|
250
463
|
private _handlePullNoArgs;
|
|
251
464
|
/**
|
|
252
465
|
* Persist the requested branch into adapter metadata (best-effort).
|
|
253
|
-
* @param {string} branch branch name to persist
|
|
254
|
-
|
|
466
|
+
* @param {string} branch - branch name to persist
|
|
467
|
+
* @param {any} [_adapterInstance] - optional adapter instance (unused)
|
|
468
|
+
* @returns {Promise<void>}
|
|
255
469
|
*/
|
|
256
470
|
private _persistAdapterBranchMeta;
|
|
257
471
|
/**
|
|
@@ -282,6 +496,7 @@ export declare class VirtualFS {
|
|
|
282
496
|
* compute simple diffs against the current index.
|
|
283
497
|
* Returns an object containing the resolved `remote` descriptor (or null),
|
|
284
498
|
* `remoteShas` map and `diffs` array (strings like `added: path` / `updated: path`).
|
|
499
|
+
* @param {RemoteSnapshotDescriptor|string|Object} [remote] - remote descriptor
|
|
285
500
|
* @returns {Promise<{remote: RemoteSnapshotDescriptor|null, remoteShas: Record<string,string>, diffs: string[]}>}
|
|
286
501
|
*/
|
|
287
502
|
getRemoteDiffs(remote?: RemoteSnapshotDescriptor | string | {
|
|
@@ -328,20 +543,17 @@ export declare class VirtualFS {
|
|
|
328
543
|
/**
|
|
329
544
|
* Convenience to get default branch name from adapter repository metadata.
|
|
330
545
|
* Returns null when adapter not available.
|
|
331
|
-
|
|
546
|
+
* @returns {Promise<string|null>}
|
|
332
547
|
*/
|
|
333
548
|
getDefaultBranch(): Promise<string | null>;
|
|
334
549
|
/**
|
|
335
550
|
* Persist repository metadata into IndexFile.adapter.opts for session persistence.
|
|
551
|
+
/**
|
|
336
552
|
* Best-effort: failures are ignored.
|
|
553
|
+
* @param {RepositoryMetadata} md - metadata to persist
|
|
337
554
|
* @returns {Promise<void>}
|
|
338
555
|
*/
|
|
339
556
|
private _persistRepositoryMetadata;
|
|
340
|
-
/**
|
|
341
|
-
* Normalize a resolved descriptor (string headSha or object) into a
|
|
342
|
-
* RemoteSnapshotDescriptor or null. Helper to reduce cognitive complexity.
|
|
343
|
-
* @returns {Promise<RemoteSnapshotDescriptor|null>} 正規化された descriptor または null
|
|
344
|
-
*/
|
|
345
557
|
/**
|
|
346
558
|
* Try persisting repository metadata when available. Best-effort.
|
|
347
559
|
* @param instAdapter adapter instance or null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtualfs.d.ts","sourceRoot":"","sources":["../../src/virtualfs/virtualfs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"virtualfs.d.ts","sourceRoot":"","sources":["../../src/virtualfs/virtualfs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAIpD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAsB,MAAM,YAAY,CAAA;AASrF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACpE,CAAA;AAED,sDAAsD;AACtD,qBAAa,SAAS;IAEpB,OAAO,CAAC,OAAO,CAAmB;IAElC,OAAO,CAAC,MAAM,CAAC,CAAQ;IAEvB,OAAO,CAAC,WAAW,CAA2B;IAG9C,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,kBAAkB,CAAoB;IAE9C;;;;;;OAM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,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQxE;;;;OAIG;IACG,YAAY,CAAC,KAAK,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAapE;;;;OAIG;IACG,YAAY,CAAC,KAAK,EAAE,OAAO,YAAY,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,YAAY,EAAE,kBAAkB,CAAC;IAgBnH;;;;;;;OAOG;YACW,wBAAwB;IAoBtC;;;;OAIG;YACW,4BAA4B;IAc1C;;;;OAIG;IACG,gBAAgB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAahD;;;;;;OAMG;YACW,0BAA0B;IAexC;;;;;OAKG;YACW,+BAA+B;IAa7C;;;;OAIG;YACW,8BAA8B;IAW5C;;;;;OAKG;YACW,uBAAuB;IAWrC;;;;;;;OAOG;YACW,kBAAkB;IAsBhC;;;OAGG;YACW,iCAAiC;IAW/C;;;;OAIG;IACG,IAAI,CAAC,KAAK,EAAE,OAAO,YAAY,EAAE,WAAW;;;IAyBlD;;;OAGG;YACW,gBAAgB;CAY/B;AAED,eAAe,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browser-git-ops",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"virtualfs",
|
|
19
19
|
"git",
|
|
20
20
|
"github",
|
|
21
|
+
"gitlab",
|
|
21
22
|
"vfs",
|
|
22
23
|
"apigit"
|
|
23
24
|
],
|
|
@@ -42,15 +43,13 @@
|
|
|
42
43
|
"pretest:e2e": "npm run build",
|
|
43
44
|
"test:e2e": "playwright test --config=playwright.config.cjs",
|
|
44
45
|
"test:ci": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --coverage --runInBand",
|
|
45
|
-
"migrate:tests": "node ./scripts/migrate-tests.js",
|
|
46
46
|
"lint": "eslint \"src/**/*.{ts,js}\"",
|
|
47
|
-
"lint2": "eslint \"src/**/*.{ts,js}\" --config .eslintrc.cjs --rule \"unicorn/prevent-abbreviations:off\" --rule \"unicorn/filename-case:off\" --rule \"unicorn/prefer-early-return:off\" --rule \"unicorn/no-duplicated-branches:off\"",
|
|
48
47
|
"depcruise": "depcruise --config .dependency-cruiser.cjs src || exit 0",
|
|
49
48
|
"build:types": "tsc -p tsconfig.json --emitDeclarationOnly",
|
|
50
49
|
"build:browser": "esbuild ./src/index.ts --bundle --outfile=dist/index.js --format=iife --global-name=APIGitLib --platform=browser --sourcemap",
|
|
51
50
|
"build:browser:esm": "esbuild ./src/index.ts --bundle --outfile=dist/index.mjs --format=esm --platform=browser --sourcemap",
|
|
52
51
|
"build": "npm run build:browser && npm run build:browser:esm && npm run build:types",
|
|
53
|
-
"docs": "typedoc --options typedoc.json && npx depcruise src --output-type dot > ./docs/dependency-cruiser.dot"
|
|
52
|
+
"docs": "typedoc --options typedoc.json && npx depcruise --config .dependency-cruiser.cjs src --output-type dot > ./docs/dependency-cruiser.dot"
|
|
54
53
|
},
|
|
55
54
|
"devDependencies": {
|
|
56
55
|
"@playwright/test": "^1.40.0",
|
|
@@ -59,18 +58,18 @@
|
|
|
59
58
|
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
60
59
|
"@typescript-eslint/parser": "^7.0.0",
|
|
61
60
|
"dependency-cruiser": "^17.3.6",
|
|
62
|
-
"esbuild": "^0.
|
|
61
|
+
"esbuild": "^0.27.3",
|
|
63
62
|
"eslint": "^8.56.0",
|
|
64
|
-
"eslint-plugin-jsdoc": "^
|
|
65
|
-
"eslint-plugin-sonarjs": "^0.
|
|
66
|
-
"eslint-plugin-unicorn": "^
|
|
63
|
+
"eslint-plugin-jsdoc": "^3.7.1",
|
|
64
|
+
"eslint-plugin-sonarjs": "^0.24.0",
|
|
65
|
+
"eslint-plugin-unicorn": "^39.0.0",
|
|
67
66
|
"fake-indexeddb": "^3.1.7",
|
|
68
67
|
"http-server": "^14.1.1",
|
|
69
68
|
"jest": "^29.6.1",
|
|
70
69
|
"opfs-mock": "^2.5.1",
|
|
71
70
|
"ts-jest": "^29.1.0",
|
|
72
|
-
"typedoc": "
|
|
73
|
-
"typedoc-plugin-markdown": "^
|
|
71
|
+
"typedoc": "0.25.13",
|
|
72
|
+
"typedoc-plugin-markdown": "^3.17.1",
|
|
74
73
|
"typescript": "5.3.3"
|
|
75
74
|
}
|
|
76
75
|
}
|