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.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getConflictingClasses = getConflictingClasses;
// 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 getConflictingClassesSync = (0, synckit_1.createSyncFn)(workerPath, workerOptions);
function getConflictingClasses(request) {
if (!(0, version_js_1.isTailwindcssVersion4)(version.major)) {
throw new Error(`Unsupported Tailwind CSS version: ${version.major}`);
}
return getConflictingClassesSync(version.major, request);
}
function getWorkerPath() {
return (0, node_path_1.resolve)(getCurrentDirectory(), "./conflicting-classes.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=conflicting-classes.sync.js.map