@dendronhq/common-server
Advanced tools
Comparing version
@@ -115,2 +115,9 @@ /// <reference types="node" /> | ||
export declare function tmpDir(): DirResult; | ||
/** Returns the path to where the notes are stored inside the vault. | ||
* | ||
* For self contained vaults, this is the `notes` folder inside of the vault. | ||
* For other vault types, this is the root of the vault itself. | ||
* | ||
* If you always need the root of the vault, use {@link pathForVaultRoot} instead. | ||
*/ | ||
export declare const vault2Path: ({ vault, wsRoot, }: { | ||
@@ -120,2 +127,12 @@ vault: DVault; | ||
}) => string; | ||
/** Returns the root of the vault. | ||
* | ||
* This is similar to {@link vault2Path}, the only difference is that for self | ||
* contained vaults `vault2Path` returns the `notes` folder inside the vault, | ||
* while this returns the root of the vault. | ||
*/ | ||
export declare function pathForVaultRoot({ vault, wsRoot, }: { | ||
vault: DVault; | ||
wsRoot: string; | ||
}): string; | ||
export declare function writeJSONWithCommentsSync(fpath: string, data: any): void; | ||
@@ -122,0 +139,0 @@ export declare function writeJSONWithComments(fpath: string, data: any): Promise<void>; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FileUtils = exports.tmp = exports.ExtensionUtils = exports.isSelfContainedVaultFolder = exports.findNonNoteFile = exports.fileExists = exports.dot2Slash = exports.writeJSONWithComments = exports.writeJSONWithCommentsSync = exports.vault2Path = exports.tmpDir = exports.readJSONWithCommentsSync = exports.readJSONWithComments = exports.assignJSONWithComment = exports.schemaModuleProps2File = exports.schemaModuleOpts2File = exports.note2File = exports.uniqueOutermostFolders = exports.isInsidePath = exports.findDownTo = exports.WS_FILE_MAX_SEARCH_DEPTH = exports.findUpTo = exports.goUpTo = exports.note2String = exports.file2Note = exports.string2Note = exports.string2Schema = exports.genHash = exports.file2Schema = exports.createFileWatcher = exports.COMMON_FOLDER_IGNORES = void 0; | ||
exports.FileUtils = exports.tmp = exports.ExtensionUtils = exports.isSelfContainedVaultFolder = exports.findNonNoteFile = exports.fileExists = exports.dot2Slash = exports.writeJSONWithComments = exports.writeJSONWithCommentsSync = exports.pathForVaultRoot = exports.vault2Path = exports.tmpDir = exports.readJSONWithCommentsSync = exports.readJSONWithComments = exports.assignJSONWithComment = exports.schemaModuleProps2File = exports.schemaModuleOpts2File = exports.note2File = exports.uniqueOutermostFolders = exports.isInsidePath = exports.findDownTo = exports.WS_FILE_MAX_SEARCH_DEPTH = exports.findUpTo = exports.goUpTo = exports.note2String = exports.file2Note = exports.string2Note = exports.string2Schema = exports.genHash = exports.file2Schema = exports.createFileWatcher = exports.COMMON_FOLDER_IGNORES = void 0; | ||
const common_all_1 = require("@dendronhq/common-all"); | ||
@@ -348,2 +348,9 @@ const anymatch_1 = __importDefault(require("anymatch")); | ||
exports.tmpDir = tmpDir; | ||
/** Returns the path to where the notes are stored inside the vault. | ||
* | ||
* For self contained vaults, this is the `notes` folder inside of the vault. | ||
* For other vault types, this is the root of the vault itself. | ||
* | ||
* If you always need the root of the vault, use {@link pathForVaultRoot} instead. | ||
*/ | ||
const vault2Path = ({ vault, wsRoot, }) => { | ||
@@ -353,2 +360,14 @@ return (0, files_1.resolvePath)(common_all_1.VaultUtils.getRelPath(vault), wsRoot); | ||
exports.vault2Path = vault2Path; | ||
/** Returns the root of the vault. | ||
* | ||
* This is similar to {@link vault2Path}, the only difference is that for self | ||
* contained vaults `vault2Path` returns the `notes` folder inside the vault, | ||
* while this returns the root of the vault. | ||
*/ | ||
function pathForVaultRoot({ vault, wsRoot, }) { | ||
if (common_all_1.VaultUtils.isSelfContained(vault)) | ||
return (0, files_1.resolvePath)(path_1.default.join(wsRoot, vault.fsPath)); | ||
return (0, exports.vault2Path)({ vault, wsRoot }); | ||
} | ||
exports.pathForVaultRoot = pathForVaultRoot; | ||
function writeJSONWithCommentsSync(fpath, data) { | ||
@@ -355,0 +374,0 @@ const payload = (0, comment_json_1.stringify)(data, null, 4); |
@@ -13,2 +13,1 @@ export * from "./files"; | ||
export * from "./yaml"; | ||
export * from "./abTesting"; |
@@ -25,3 +25,2 @@ "use strict"; | ||
__exportStar(require("./yaml"), exports); | ||
__exportStar(require("./abTesting"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@dendronhq/common-server", | ||
"version": "0.94.0", | ||
"version": "0.95.0", | ||
"description": "common-server", | ||
@@ -40,3 +40,3 @@ "license": "GPLv3", | ||
"dependencies": { | ||
"@dendronhq/common-all": "^0.94.0", | ||
"@dendronhq/common-all": "^0.95.0", | ||
"@sentry/integrations": "^6.13.3", | ||
@@ -89,3 +89,3 @@ "@sentry/node": "^6.13.3", | ||
}, | ||
"gitHead": "55b45881127469c79f9db55daef545b3327b8d99" | ||
"gitHead": "6f8c1d9960d0165a834ea4726a76dc305d492118" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
424415
-0.68%43
-6.52%3220
-2.22%+ Added
- Removed