UNPKG

eslint-plugin-better-tailwindcss

Version:

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

24 lines 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getShorthandClasses = getShorthandClasses; const node_path_1 = require("node:path"); const synckit_1 = require("synckit"); const config_js_1 = require("./config.js"); const version_js_1 = require("../async-utils/version.js"); const worker_js_1 = require("../async-utils/worker.js"); function getShorthandClasses({ classes, configPath, cwd }) { const { path, warning } = (0, config_js_1.getTailwindConfigPath)({ configPath, cwd }); const shorthandClasses = getShorthandClassesSync({ classes, configPath: path }); return { shorthandClasses, warnings: [warning] }; } const getShorthandClassesSync = (0, synckit_1.createSyncFn)(getWorkerPath(), (0, worker_js_1.getWorkerOptions)()); function getWorkerPath() { const { major } = (0, version_js_1.getTailwindcssVersion)(); return (0, node_path_1.resolve)(getCurrentDirectory(), `./shorthand-classes.async.worker.v${major}.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=shorthand-classes.js.map