UNPKG

scriptable-testlab

Version:

A lightweight, efficient tool designed to manage and update scripts for Scriptable.

114 lines 3.72 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var paths_exports = {}; __export(paths_exports, { DEFAULT_BASE_DIRECTORIES: () => DEFAULT_BASE_DIRECTORIES, DEFAULT_ROOT_PATH: () => DEFAULT_ROOT_PATH, FileManagerType: () => FileManagerType, FileUtils: () => FileUtils, getFileExtension: () => getFileExtension, getFileName: () => getFileName, getUTI: () => getUTI, joinPaths: () => joinPaths, normalizePath: () => normalizePath }); module.exports = __toCommonJS(paths_exports); var path = __toESM(require("path")); var FileManagerType = /* @__PURE__ */ ((FileManagerType2) => { FileManagerType2["LOCAL"] = "local"; FileManagerType2["ICLOUD"] = "icloud"; return FileManagerType2; })(FileManagerType || {}); const DEFAULT_ROOT_PATH = path.join(process.cwd(), ".scriptable-mock"); const DEFAULT_BASE_DIRECTORIES = { documents: "documents", library: "library", cache: "cache", temporary: "temp" }; function normalizePath(filePath) { const normalized = filePath.replace(/\\/g, "/"); const isAbsolute = normalized.startsWith("/"); const segments = normalized.split("/"); const result = []; for (const segment of segments) { if (segment === "." || segment === "") { continue; } if (segment === "..") { result.pop(); } else { result.push(segment); } } return isAbsolute ? "/" + result.join("/") : result.join("/"); } function joinPaths(...paths) { return path.join(...paths).replace(/\\/g, "/"); } function getFileName(filePath) { return path.basename(filePath); } function getFileExtension(filePath) { const ext = path.extname(filePath); return ext ? ext : ""; } function getUTI(extension) { const utiMap = { txt: "public.plain-text", json: "public.json", js: "com.netscape.javascript-source", ts: "public.typescript-source", png: "public.png", jpg: "public.jpeg", jpeg: "public.jpeg", gif: "public.gif", pdf: "com.adobe.pdf" }; return utiMap[extension.toLowerCase()] || "public.data"; } const FileUtils = { normalizePath, joinPaths, getFileName, getFileExtension, getUTI }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { DEFAULT_BASE_DIRECTORIES, DEFAULT_ROOT_PATH, FileManagerType, FileUtils, getFileExtension, getFileName, getUTI, joinPaths, normalizePath }); //# sourceMappingURL=paths.js.map