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.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getClassOrder = getClassOrder; // 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 getClassOrderSync = (0, synckit_1.createSyncFn)(workerPath, workerOptions); function getClassOrder(request) { if (!(0, version_js_1.isSupportedVersion)(version.major)) { throw new Error(`Unsupported Tailwind CSS version: ${version.major}`); } return getClassOrderSync(version.major, request); } function getWorkerPath() { return (0, node_path_1.resolve)(getCurrentDirectory(), "./class-order.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-order.sync.js.map