tailwindcss-config 0.0.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -28,13 +28,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  loadConfig: () => loadConfig
34
34
  });
35
- module.exports = __toCommonJS(src_exports);
35
+ module.exports = __toCommonJS(index_exports);
36
36
 
37
- // ../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.1_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js
37
+ // ../../node_modules/.pnpm/tsup@8.3.6_jiti@2.4.2_postcss@8.5.2_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
38
38
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
39
39
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
40
40
 
@@ -122,11 +122,14 @@ var defuOverrideArray = createDefu((obj, key, value) => {
122
122
 
123
123
  // src/index.ts
124
124
  var jiti = (0, import_jiti.createJiti)(importMetaUrl);
125
- var moduleName = "tailwind";
126
125
  async function loadConfig(options) {
127
- const { config, cwd } = defuOverrideArray(options, {
128
- cwd: import_node_process.default.cwd()
129
- });
126
+ const { config, cwd, moduleName } = defuOverrideArray(
127
+ options,
128
+ {
129
+ cwd: import_node_process.default.cwd(),
130
+ moduleName: "tailwind"
131
+ }
132
+ );
130
133
  const searcher = (0, import_lilconfig.lilconfig)("tailwindcss", {
131
134
  searchPlaces: [
132
135
  `${moduleName}.config.js`,
@@ -147,11 +150,9 @@ async function loadConfig(options) {
147
150
  });
148
151
  if (typeof config === "string" && config) {
149
152
  const configPath = import_node_path.default.isAbsolute(config) ? config : import_node_path.default.resolve(cwd, config);
150
- const result = await searcher.load(configPath);
151
- return result?.config;
153
+ return await searcher.load(configPath);
152
154
  } else {
153
- const result = await searcher.search(cwd);
154
- return result?.config;
155
+ return await searcher.search(cwd);
155
156
  }
156
157
  }
157
158
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.d.cts CHANGED
@@ -1,9 +1,15 @@
1
- import * as tailwindcss_types_config from 'tailwindcss/types/config';
1
+ import { Config } from 'tailwindcss';
2
2
 
3
3
  interface LoadConfigOptions {
4
4
  cwd: string;
5
5
  config: string;
6
+ moduleName: string;
6
7
  }
7
- declare function loadConfig(options?: Partial<LoadConfigOptions>): Promise<tailwindcss_types_config.Config | undefined>;
8
+ type LoadConfigResult = null | {
9
+ filepath: string;
10
+ config: Config;
11
+ isEmpty?: boolean;
12
+ };
13
+ declare function loadConfig(options?: Partial<LoadConfigOptions>): Promise<LoadConfigResult>;
8
14
 
9
- export { type LoadConfigOptions, loadConfig };
15
+ export { type LoadConfigOptions, type LoadConfigResult, loadConfig };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,15 @@
1
- import * as tailwindcss_types_config from 'tailwindcss/types/config';
1
+ import { Config } from 'tailwindcss';
2
2
 
3
3
  interface LoadConfigOptions {
4
4
  cwd: string;
5
5
  config: string;
6
+ moduleName: string;
6
7
  }
7
- declare function loadConfig(options?: Partial<LoadConfigOptions>): Promise<tailwindcss_types_config.Config | undefined>;
8
+ type LoadConfigResult = null | {
9
+ filepath: string;
10
+ config: Config;
11
+ isEmpty?: boolean;
12
+ };
13
+ declare function loadConfig(options?: Partial<LoadConfigOptions>): Promise<LoadConfigResult>;
8
14
 
9
- export { type LoadConfigOptions, loadConfig };
15
+ export { type LoadConfigOptions, type LoadConfigResult, loadConfig };
package/dist/index.js CHANGED
@@ -82,11 +82,14 @@ var defuOverrideArray = createDefu((obj, key, value) => {
82
82
 
83
83
  // src/index.ts
84
84
  var jiti = createJiti(import.meta.url);
85
- var moduleName = "tailwind";
86
85
  async function loadConfig(options) {
87
- const { config, cwd } = defuOverrideArray(options, {
88
- cwd: process.cwd()
89
- });
86
+ const { config, cwd, moduleName } = defuOverrideArray(
87
+ options,
88
+ {
89
+ cwd: process.cwd(),
90
+ moduleName: "tailwind"
91
+ }
92
+ );
90
93
  const searcher = lilconfig("tailwindcss", {
91
94
  searchPlaces: [
92
95
  `${moduleName}.config.js`,
@@ -107,11 +110,9 @@ async function loadConfig(options) {
107
110
  });
108
111
  if (typeof config === "string" && config) {
109
112
  const configPath = path.isAbsolute(config) ? config : path.resolve(cwd, config);
110
- const result = await searcher.load(configPath);
111
- return result?.config;
113
+ return await searcher.load(configPath);
112
114
  } else {
113
- const result = await searcher.search(cwd);
114
- return result?.config;
115
+ return await searcher.search(cwd);
115
116
  }
116
117
  }
117
118
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tailwindcss-config",
3
3
  "type": "module",
4
- "version": "0.0.0",
4
+ "version": "1.0.0",
5
5
  "description": "load tailwindcss config function",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "jiti": "^2.4.1",
33
+ "jiti": "^2.4.2",
34
34
  "lilconfig": "^3.1.3"
35
35
  },
36
36
  "scripts": {