@kimesh/tailwindcss 0.2.40 → 0.2.41
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.
|
@@ -2,7 +2,6 @@ import * as _kimesh_kit0 from "@kimesh/kit";
|
|
|
2
2
|
import { VitePlugin } from "@kimesh/kit";
|
|
3
3
|
|
|
4
4
|
//#region src/types.d.ts
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Configuration options for the Kimesh TailwindCSS module
|
|
8
7
|
*/
|
|
@@ -36,7 +35,6 @@ interface KimeshTailwindConfig {
|
|
|
36
35
|
}
|
|
37
36
|
//#endregion
|
|
38
37
|
//#region src/module.d.ts
|
|
39
|
-
|
|
40
38
|
/**
|
|
41
39
|
* @kimesh/tailwindcss module
|
|
42
40
|
*
|
|
@@ -95,4 +93,4 @@ declare function hasTailwindDirectives(content: string): boolean;
|
|
|
95
93
|
*/
|
|
96
94
|
declare function hasReferenceDirective(content: string): boolean;
|
|
97
95
|
//#endregion
|
|
98
|
-
export { type KimeshTailwindConfig, createReferenceTransformer, _default as default,
|
|
96
|
+
export { type KimeshTailwindConfig, createReferenceTransformer, _default as default, _default as tailwindcss, hasReferenceDirective, hasTailwindDirectives };
|
|
@@ -53,8 +53,7 @@ function createReferenceTransformer(alias) {
|
|
|
53
53
|
STYLE_BLOCK_RE.lastIndex = 0;
|
|
54
54
|
while ((match = STYLE_BLOCK_RE.exec(code)) !== null) {
|
|
55
55
|
const [, attributes, styleContent] = match;
|
|
56
|
-
const
|
|
57
|
-
const contentStart = matchStart + 6 + attributes.length + 1;
|
|
56
|
+
const contentStart = match.index + 6 + attributes.length + 1;
|
|
58
57
|
if (!TAILWIND_DIRECTIVE_RE.test(styleContent)) continue;
|
|
59
58
|
if (EXISTING_REFERENCE_RE.test(styleContent)) continue;
|
|
60
59
|
const insertPosition = contentStart;
|
|
@@ -96,13 +95,20 @@ function hasReferenceDirective(content) {
|
|
|
96
95
|
//#endregion
|
|
97
96
|
//#region src/module.ts
|
|
98
97
|
/**
|
|
98
|
+
* @kimesh/tailwindcss - Module Implementation (v2)
|
|
99
|
+
*
|
|
100
|
+
* Kimesh module for TailwindCSS integration.
|
|
101
|
+
* - Generates @source directives for all layer srcDirs
|
|
102
|
+
* - Creates physical CSS files for @tailwindcss/vite compatibility
|
|
103
|
+
* - Auto-injects @reference in Vue <style> blocks
|
|
104
|
+
*/
|
|
105
|
+
/**
|
|
99
106
|
* Build source entries from Kimesh layers
|
|
100
107
|
*/
|
|
101
108
|
function buildLayerSources(kimesh) {
|
|
102
109
|
return kimesh.layers.map((layer) => {
|
|
103
|
-
const srcPath = layer.path.endsWith("/src") || layer.path.endsWith("\\src") ? layer.path : `${layer.path}/src`;
|
|
104
110
|
return {
|
|
105
|
-
path:
|
|
111
|
+
path: layer.path.endsWith("/src") || layer.path.endsWith("\\src") ? layer.path : `${layer.path}/src`,
|
|
106
112
|
comment: `layer: ${layer.name}`
|
|
107
113
|
};
|
|
108
114
|
});
|
|
@@ -113,8 +119,7 @@ function buildLayerSources(kimesh) {
|
|
|
113
119
|
function generateSourcesCSS(kimesh, sources, additionalSources) {
|
|
114
120
|
const lines = ["/* Auto-generated by @kimesh/tailwindcss */", ""];
|
|
115
121
|
for (const source of sources) {
|
|
116
|
-
const
|
|
117
|
-
const normalizedPath = sourcePath.replace(/\\/g, "/");
|
|
122
|
+
const normalizedPath = relative(kimesh.buildDir, source.path).replace(/\\/g, "/");
|
|
118
123
|
const comment = source.comment ? ` /* ${source.comment} */` : "";
|
|
119
124
|
lines.push(`@source "${normalizedPath}";${comment}`);
|
|
120
125
|
}
|
|
@@ -132,14 +137,13 @@ function generateSourcesCSS(kimesh, sources, additionalSources) {
|
|
|
132
137
|
* Generate the main CSS content
|
|
133
138
|
*/
|
|
134
139
|
function generateMainCSS(kimesh, sources, additionalSources) {
|
|
135
|
-
const sourcesCSS = generateSourcesCSS(kimesh, sources, additionalSources);
|
|
136
140
|
return [
|
|
137
141
|
`/* Generated by @kimesh/tailwindcss - DO NOT EDIT */`,
|
|
138
142
|
``,
|
|
139
143
|
`@import 'tailwindcss';`,
|
|
140
144
|
``,
|
|
141
145
|
`/* Layer sources */`,
|
|
142
|
-
|
|
146
|
+
generateSourcesCSS(kimesh, sources, additionalSources) || "/* No layers configured */"
|
|
143
147
|
].join("\n");
|
|
144
148
|
}
|
|
145
149
|
/**
|
|
@@ -193,4 +197,4 @@ var module_default = defineKimeshModule({
|
|
|
193
197
|
});
|
|
194
198
|
|
|
195
199
|
//#endregion
|
|
196
|
-
export { createReferenceTransformer, module_default as default,
|
|
200
|
+
export { createReferenceTransformer, module_default as default, module_default as tailwindcss, hasReferenceDirective, hasTailwindDirectives };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kimesh/tailwindcss",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.41",
|
|
4
4
|
"description": "TailwindCSS module for Kimesh framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"augment.d.ts"
|
|
12
12
|
],
|
|
13
13
|
"type": "module",
|
|
14
|
-
"main": "./dist/index.
|
|
15
|
-
"types": "./dist/index.d.
|
|
14
|
+
"main": "./dist/index.mjs",
|
|
15
|
+
"types": "./dist/index.d.mts",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types": "./dist/index.d.
|
|
19
|
-
"import": "./dist/index.
|
|
20
|
-
"default": "./dist/index.
|
|
18
|
+
"types": "./dist/index.d.mts",
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"default": "./dist/index.mjs"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
"test:watch": "vitest"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"magic-string": "^0.30.
|
|
31
|
+
"magic-string": "^0.30.21"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@kimesh/kit": "0.2.
|
|
35
|
-
"tsdown": "^0.
|
|
36
|
-
"typescript": "^5.
|
|
37
|
-
"vite": "^8.0.0-beta.
|
|
34
|
+
"@kimesh/kit": "0.2.41",
|
|
35
|
+
"tsdown": "^0.20.3",
|
|
36
|
+
"typescript": "^5.9.3",
|
|
37
|
+
"vite": "^8.0.0-beta.15"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@kimesh/kit": "0.2.
|
|
40
|
+
"@kimesh/kit": "0.2.41",
|
|
41
41
|
"tailwindcss": "^4.0.0",
|
|
42
|
-
"vite": "^8.0.0-beta.
|
|
42
|
+
"vite": "^8.0.0-beta.15"
|
|
43
43
|
}
|
|
44
44
|
}
|