1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", {
|
3 | value: true
|
4 | });
|
5 | Object.defineProperty(exports, "default", {
|
6 | enumerable: true,
|
7 | get: ()=>resolveConfigPath
|
8 | });
|
9 | const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
10 | const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
11 | function _interopRequireDefault(obj) {
|
12 | return obj && obj.__esModule ? obj : {
|
13 | default: obj
|
14 | };
|
15 | }
|
16 | function isObject(value) {
|
17 | return typeof value === "object" && value !== null;
|
18 | }
|
19 | function isEmpty(obj) {
|
20 | return Object.keys(obj).length === 0;
|
21 | }
|
22 | function isString(value) {
|
23 | return typeof value === "string" || value instanceof String;
|
24 | }
|
25 | function resolveConfigPath(pathOrConfig) {
|
26 |
|
27 | if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
|
28 | return null;
|
29 | }
|
30 |
|
31 | if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isString(pathOrConfig.config)) {
|
32 | return _path.default.resolve(pathOrConfig.config);
|
33 | }
|
34 |
|
35 | if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isObject(pathOrConfig.config)) {
|
36 | return null;
|
37 | }
|
38 |
|
39 | if (isString(pathOrConfig)) {
|
40 | return _path.default.resolve(pathOrConfig);
|
41 | }
|
42 |
|
43 | for (const configFile of [
|
44 | "./tailwind.config.js",
|
45 | "./tailwind.config.cjs"
|
46 | ]){
|
47 | try {
|
48 | const configPath = _path.default.resolve(configFile);
|
49 | _fs.default.accessSync(configPath);
|
50 | return configPath;
|
51 | } catch (err) {}
|
52 | }
|
53 | return null;
|
54 | }
|