@poveste/plugin-tailwind 0.8.0 → 0.8.1
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.d.ts +5 -0
- package/dist/index.js +21 -1
- package/package.json +6 -4
package/dist/index.d.ts
CHANGED
|
@@ -23,5 +23,10 @@ export interface TailwindTokensOptions {
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function isTailwindEntry(filePath: string): boolean;
|
|
25
25
|
export declare function HstTailwind(options?: TailwindTokensOptions): Plugin;
|
|
26
|
+
export declare const TAILWIND_V4_REQUIRED: string;
|
|
27
|
+
export declare function hasDesignSystemLoader(tailwind: unknown): boolean;
|
|
28
|
+
type LoadDesignSystem = typeof import('tailwindcss')['__unstable__loadDesignSystem'];
|
|
29
|
+
export declare function resolveDesignSystemLoader(importTailwind?: () => Promise<unknown>): Promise<LoadDesignSystem>;
|
|
26
30
|
/** @deprecated Use `HstTailwind`. Kept for books that named the old builtin. */
|
|
27
31
|
export declare const tailwindTokens: typeof HstTailwind;
|
|
32
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -159,8 +159,28 @@ async function resolveStylesheet(api, id, importBase) {
|
|
|
159
159
|
const packageJson = JSON.parse(await api.fs.readFile(packageJsonPath, 'utf8'));
|
|
160
160
|
return api.path.resolve(api.path.dirname(packageJsonPath), packageJson.style ?? 'index.css');
|
|
161
161
|
}
|
|
162
|
+
export const TAILWIND_V4_REQUIRED = '@poveste/plugin-tailwind needs Tailwind v4: the installed tailwindcss does not export '
|
|
163
|
+
+ '`__unstable__loadDesignSystem`. A v3 project has nothing for this plugin to read — install tailwindcss@^4.';
|
|
164
|
+
// `__unstable__loadDesignSystem` is Tailwind's own signal that this export may be
|
|
165
|
+
// renamed or dropped in any release. The `tailwindcss` peer range is the only thing
|
|
166
|
+
// bounding that, so whoever widens it re-checks this call site. Without the check the
|
|
167
|
+
// failure reads as `__unstable__loadDesignSystem is not a function`, which points at
|
|
168
|
+
// Poveste and says nothing about the version mismatch that caused it (#320).
|
|
169
|
+
export function hasDesignSystemLoader(tailwind) {
|
|
170
|
+
return typeof tailwind
|
|
171
|
+
?.__unstable__loadDesignSystem === 'function';
|
|
172
|
+
}
|
|
173
|
+
// The import is a parameter so the mismatch path is testable without a Tailwind v3
|
|
174
|
+
// installed alongside v4.
|
|
175
|
+
export async function resolveDesignSystemLoader(importTailwind = () => import('tailwindcss')) {
|
|
176
|
+
const tailwind = await importTailwind();
|
|
177
|
+
if (!hasDesignSystemLoader(tailwind)) {
|
|
178
|
+
throw new Error(TAILWIND_V4_REQUIRED);
|
|
179
|
+
}
|
|
180
|
+
return tailwind.__unstable__loadDesignSystem;
|
|
181
|
+
}
|
|
162
182
|
async function loadTailwindTheme(api, cssFile) {
|
|
163
|
-
const
|
|
183
|
+
const __unstable__loadDesignSystem = await resolveDesignSystemLoader();
|
|
164
184
|
const base = api.path.dirname(cssFile);
|
|
165
185
|
const designSystem = await __unstable__loadDesignSystem(await api.fs.readFile(cssFile, 'utf8'), {
|
|
166
186
|
base,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poveste/plugin-tailwind",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.1",
|
|
5
5
|
"description": "Poveste plugin that renders a Tailwind design system as a story",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Sorin Gitlan"
|
|
@@ -46,18 +46,20 @@
|
|
|
46
46
|
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"
|
|
49
|
+
"tailwindcss": "^4.0.0",
|
|
50
|
+
"poveste": "^0.8.1"
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
53
|
"pathe": "^1.1.2",
|
|
53
|
-
"@poveste/shared": "0.8.
|
|
54
|
+
"@poveste/shared": "0.8.1"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@types/node": "^22.10.1",
|
|
58
|
+
"tailwindcss": "^4.3.3",
|
|
57
59
|
"typescript": "5.6.3",
|
|
58
60
|
"vite": "^8.2.0",
|
|
59
61
|
"vitest": "^4.1.10",
|
|
60
|
-
"poveste": "0.8.
|
|
62
|
+
"poveste": "0.8.1"
|
|
61
63
|
},
|
|
62
64
|
"scripts": {
|
|
63
65
|
"build": "rimraf dist && tsc -d",
|