UNPKG

tsdown-jsr-exports-lint

Version:
40 lines (37 loc) 1.34 kB
import { defineConfig } from "tsdown"; //#region src/types.d.ts /** * @author kazuya kawaguchi (a.k.a. @kazupon) * @license MIT */ /** * @author kazuya kawaguchi (a.k.a. @kazupon) * @license MIT */ type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never; type LastOf<U> = UnionToIntersection<U extends unknown ? () => U : never> extends () => infer R ? R : never; type UnionToTuple<T, L = LastOf<T>> = [T] extends [never] ? [] : [...UnionToTuple<Exclude<T, L>>, L]; //#endregion //#region src/index.d.ts type ArrayrableUserConfig = Parameters<typeof defineConfig>[0]; type UserConfig = UnionToTuple<ArrayrableUserConfig>[0]; type onSuccessHandler = NonNullable<UserConfig['onSuccess']>; /** * JSR `exports` field lint options. */ interface JsrExportsLintOptions { /** * The path to the `jsr.json` file. * This option specifies the path of the `jsr.json` file to be verified. */ jsrPath?: string; } /** * Lint the `exports` field of the JSR manifest file. * @param jsrPath The path to the `jsr.json` file. * @returns A handler for tsdown's `onSuccess` option. */ declare function jsrExportsLint(jsrPath?: string): onSuccessHandler; declare function error(message: string): void; //#endregion export { JsrExportsLintOptions, error, jsrExportsLint };