@stacksjs/dtsx
Version:
A modern, fast .d.ts generation tool, powered by Bun.
4 lines (3 loc) • 2.15 kB
JavaScript
// @bun
import{basename as w,dirname as x,isAbsolute as y,join as z,relative as B,resolve as C}from"path";function E(k){if(!k||typeof k!=="string")throw Error("Invalid file path: must be a non-empty string");return k}function F(k){if(!k||typeof k!=="string")throw Error("Invalid directory path: must be a non-empty string");return k}function H(k){if(!k||typeof k!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return k}function I(k){if(typeof k!=="string")throw TypeError("Invalid source code: must be a string");return k}function J(k){if(typeof k!=="string")throw TypeError("Invalid DTS content: must be a string");return k}function K(k){if(!k||typeof k!=="string")throw Error("Invalid module specifier: must be a non-empty string");return k}function L(k){if(!k||typeof k!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(k)&&!/^[A-Z_$]/.test(k));return k}function M(k){if(!k||typeof k!=="string")throw Error("Invalid declaration name: must be a non-empty string");return k}function N(k){if(!k||typeof k!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!k.startsWith("/")&&!/^[A-Z]:/i.test(k))throw Error("Invalid absolute path: must start with / or drive letter");return k}function O(k){if(!k||typeof k!=="string")throw Error("Invalid relative path: must be a non-empty string");if(k.startsWith("/")||/^[A-Z]:/i.test(k))throw Error("Invalid relative path: must not be absolute");return k}function P(k){if(typeof k!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(k)}catch{throw Error("Invalid JSON string: must be valid JSON")}return k}function Q(k,q){return typeof k==="string"||typeof k==="number"}function R(k){return k}var S={join(k,...q){return z(k,...q)},dirname(k){return x(k)},basename(k){return w(k)},resolve(...k){return C(...k)},isAbsolute(k){return y(k)},relative(k,q){return B(k,q)}};
export{E as da,F as ea,H as fa,I as ga,J as ha,K as ia,L as ja,M as ka,N as la,O as ma,P as na,Q as oa,R as pa,S as qa};