mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 17:57:36 +08:00
New snippets use file system instead of own mappings. R=lushnikov@chromium.org Bug: none Change-Id: I7c8e9c1f88f3a555ba98ba613658dbde39c3f0a0 Reviewed-on: https://chromium-review.googlesource.com/1173751 Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#584771} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 54feed0d242111c0fd08db4315bffccdcfdad749
195 lines
3.3 KiB
JavaScript
195 lines
3.3 KiB
JavaScript
// Copyright 2018 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
Persistence.PlatformFileSystem = class {
|
|
/**
|
|
* @param {string} path
|
|
* @param {string} type
|
|
*/
|
|
constructor(path, type) {
|
|
this._path = path;
|
|
this._type = type;
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
* @return {!Promise<?{modificationTime: !Date, size: number}>}
|
|
*/
|
|
getMetadata(path) {
|
|
return Promise.resolve(/** @type ?{modificationTime: !Date, size: number} */ (null));
|
|
}
|
|
|
|
/**
|
|
* @return {!Array<string>}
|
|
*/
|
|
initialFilePaths() {
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* @return {!Array<string>}
|
|
*/
|
|
initialGitFolders() {
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* @return {string}
|
|
*/
|
|
path() {
|
|
return this._path;
|
|
}
|
|
|
|
/**
|
|
* @return {string}
|
|
*/
|
|
embedderPath() {
|
|
throw new Error('Not implemented');
|
|
}
|
|
|
|
/**
|
|
* @return {string}
|
|
*/
|
|
type() {
|
|
// TODO(kozyatinskiy): remove type, overrides should implement this interface.
|
|
return this._type;
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
* @param {?string} name
|
|
* @return {!Promise<?string>}
|
|
*/
|
|
async createFile(path, name) {
|
|
return Promise.resolve(null);
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
* @return {!Promise<boolean>}
|
|
*/
|
|
deleteFile(path) {
|
|
return Promise.resolve(false);
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
* @return {!Promise<?Blob>}
|
|
*/
|
|
requestFileBlob(path) {
|
|
return Promise.resolve(/** @type {?Blob} */ (null));
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
* @param {function(?string,boolean)} callback
|
|
*/
|
|
requestFileContent(path, callback) {
|
|
callback(null, false);
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
* @param {string} content
|
|
* @param {boolean} isBase64
|
|
*/
|
|
setFileContent(path, content, isBase64) {
|
|
throw new Error('Not implemented');
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
* @param {string} newName
|
|
* @param {function(boolean, string=)} callback
|
|
*/
|
|
renameFile(path, newName, callback) {
|
|
callback(false);
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
*/
|
|
addExcludedFolder(path) {
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
*/
|
|
removeExcludedFolder(path) {
|
|
}
|
|
|
|
fileSystemRemoved() {
|
|
}
|
|
|
|
/**
|
|
* @param {string} folderPath
|
|
* @return {boolean}
|
|
*/
|
|
isFileExcluded(folderPath) {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* @return {!Set<string>}
|
|
*/
|
|
excludedFolders() {
|
|
return new Set();
|
|
}
|
|
|
|
/**
|
|
* @param {string} query
|
|
* @param {!Common.Progress} progress
|
|
* @return {!Promise<!Array<string>>}
|
|
*/
|
|
searchInPath(query, progress) {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
/**
|
|
* @param {!Common.Progress} progress
|
|
*/
|
|
indexContent(progress) {
|
|
setImmediate(() => progress.done());
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
* @return {string}
|
|
*/
|
|
mimeFromPath(path) {
|
|
throw new Error('Not implemented');
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
* @return {boolean}
|
|
*/
|
|
canExcludeFolder(path) {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* @param {string} path
|
|
* @return {!Common.ResourceType}
|
|
*/
|
|
contentType(path) {
|
|
throw new Error('Not implemented');
|
|
}
|
|
|
|
/**
|
|
* @param {string} url
|
|
* @return {string}
|
|
*/
|
|
tooltipForURL(url) {
|
|
throw new Error('Not implemented');
|
|
}
|
|
|
|
/**
|
|
* @return {boolean}
|
|
*/
|
|
supportsAutomapping() {
|
|
throw new Error('Not implemented');
|
|
}
|
|
};
|