UNPKG

eslint-plugin-readable-tailwind

Version:

auto-wraps tailwind classes after a certain print width or class count into multiple lines to improve readability.

32 lines 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getClassVariant = getClassVariant; // runner.js const node_path_1 = require("node:path"); const node_process_1 = require("node:process"); const synckit_1 = require("synckit"); const version_js_1 = require("../utils/version.js"); const workerPath = getWorkerPath(); const version = (0, version_js_1.getTailwindcssVersion)(); const workerOptions = getWorkerOptions(); const getClassVariantSync = (0, synckit_1.createSyncFn)(workerPath, workerOptions); function getClassVariant(request) { if (!(0, version_js_1.isSupportedVersion)(version.major)) { throw new Error(`Unsupported Tailwind CSS version: ${version.major}`); } return getClassVariantSync(version.major, request); } function getWorkerPath() { return (0, node_path_1.resolve)(getCurrentDirectory(), "./class-variant.async.js"); } function getWorkerOptions() { if (node_process_1.env.NODE_ENV === "test") { return { execArgv: ["--import", synckit_1.TsRunner.TSX] }; } } function getCurrentDirectory() { // eslint-disable-next-line eslint-plugin-typescript/prefer-ts-expect-error // @ts-ignore - `import.meta` doesn't exist in CommonJS -> will be transformed in build step return __dirname; } //# sourceMappingURL=class-variant.sync.js.map