eslint-plugin-better-tailwindcss
Version:
auto-wraps tailwind classes after a certain print width or class count into multiple lines to improve readability.
25 lines • 1.26 kB
JavaScript
;
// runner.js
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCustomComponentClasses = getCustomComponentClasses;
const node_path_1 = require("node:path");
const synckit_1 = require("synckit");
const config_js_1 = require("./config.js");
const cache_js_1 = require("../utils/cache.js");
const worker_js_1 = require("../utils/worker.js");
function getCustomComponentClasses({ configPath, cwd }) {
const { path } = (0, config_js_1.getTailwindConfigPath)({ configPath, cwd });
return (0, cache_js_1.withCache)("custom-components", () => {
return getCustomComponentClassesSync({ configPath: path });
}, date => (0, cache_js_1.invalidateByModifiedDate)(date, path));
}
const getCustomComponentClassesSync = (0, synckit_1.createSyncFn)(getWorkerPath(), (0, worker_js_1.getWorkerOptions)());
function getWorkerPath() {
return (0, node_path_1.resolve)(getCurrentDirectory(), "./custom-component-classes.async.js");
}
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=custom-component-classes.js.map