@altostra/core
Version:
Core library for shared types and logic
1 lines • 971 B
JavaScript
;var __awaiter=this&&this.__awaiter||function(e,t,i,o){return new(i||(i=Promise))((function(r,a){function n(e){try{s(o.next(e))}catch(e){a(e)}}function c(e){try{s(o.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,c)}s((o=o.apply(e,t||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.projectDirFilesSourceValidator=void 0;const path_1=require("path"),Common_1=require("./Common"),projectDirFilesSourceValidator=(e,{projectDir:t,checkExistence:i})=>__awaiter(void 0,void 0,void 0,(function*(){var o;const r=(0,path_1.normalize)((0,path_1.resolve)(t,e.path));return r.startsWith(t)?null!==(o=yield(0,Common_1.existenceValidation)(r,i))&&void 0!==o?o:{isValid:!0,validFiles:[r]}:{isValid:!1,validFiles:[],invalidFiles:[{path:e.path,reason:"Path is outside of project directory"}]}}));exports.projectDirFilesSourceValidator=projectDirFilesSourceValidator;