@dmisdm/pandatail 0.3.0 → 0.4.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/README.md CHANGED
@@ -27,9 +27,13 @@ Panda v2 (ESM, Node >= 22) and Tailwind v4.
27
27
 
28
28
  ```sh
29
29
  npm i -D @dmisdm/pandatail @pandacss/dev @pandacss/compiler @pandacss/config \
30
- @pandacss/preset-base @pandacss/compiler-shared tailwindcss
30
+ @pandacss/preset-base @pandacss/compiler-shared tailwindcss @tailwindcss/node
31
31
  ```
32
32
 
33
+ Keep `@tailwindcss/node` on the same version as `tailwindcss` and your Tailwind
34
+ build plugin (such as `@tailwindcss/vite`). Pandatail uses Tailwind's Node adapter to resolve CSS imports and
35
+ load plugins, then reads the resolved theme before Tailwind emits CSS.
36
+
33
37
  ## CLI
34
38
 
35
39
  ```sh
@@ -106,6 +110,10 @@ Prefer your own `panda.config.ts`? `tailwindPreset({ cssPath })` is async and re
106
110
  - `@theme` changes need a rebuild; `watch` reloads the whole project when the CSS or config changes.
107
111
  - Panda's cascade layers (`reset, base, tokens, recipes, utilities`) are separate from Tailwind's; check ordering if both emit a `utilities` layer.
108
112
 
113
+ ## Changes in 0.4.0
114
+
115
+ Tailwind's Node adapter now resolves stylesheet imports and loads plugins and configs. This supports CSS-only package exports such as `tw-animate-css`. Add the `@tailwindcss/node` peer dependency at the same version as your Tailwind installation.
116
+
109
117
  ## Changes in 0.3.0
110
118
 
111
119
  Breaking: sync API (`tailwindPresetSync`) and the demo site removed; Panda peers are `^2.0.0`.
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import { bundleConfig, createConfigSnapshot, mergeConfigs } from "@pandacss/conf
10
10
  import { createCompilerFromSnapshot } from "@pandacss/compiler";
11
11
  import { applyConfigDefaults, formatDiagnostic } from "@pandacss/compiler-shared";
12
12
  import presetBase from "@pandacss/preset-base";
13
- import { createRequire as createRequire2 } from "node:module";
13
+ import { createRequire } from "node:module";
14
14
  import { existsSync as existsSync2, statSync } from "node:fs";
15
15
  import { relative, resolve as resolve4 } from "node:path";
16
16
 
@@ -20,11 +20,9 @@ import { readFile as readFile2 } from "node:fs/promises";
20
20
  import { dirname as dirname3, resolve as resolve3 } from "node:path";
21
21
 
22
22
  // src/extract.ts
23
- import { __unstable__loadDesignSystem } from "tailwindcss";
23
+ import { __unstable__loadDesignSystem } from "@tailwindcss/node";
24
24
  import { readFile } from "node:fs/promises";
25
- import { createRequire } from "node:module";
26
25
  import { dirname, resolve } from "node:path";
27
- import { pathToFileURL } from "node:url";
28
26
 
29
27
  // src/namespaces.ts
30
28
  var TAILWIND_NAMESPACES = [
@@ -164,34 +162,9 @@ function pushNamed(out) {
164
162
  }
165
163
 
166
164
  // src/extract.ts
167
- var requireFromHere = createRequire(`${process.cwd()}/__pandatail_anchor__`);
168
- function resolveStylesheet(id, basedir) {
169
- if (id.startsWith(".") || id.startsWith("/")) {
170
- return resolve(basedir, id);
171
- }
172
- const candidates = [`${id}/index.css`, `${id}.css`, id];
173
- for (const candidate of candidates) {
174
- try {
175
- return requireFromHere.resolve(candidate, { paths: [basedir] });
176
- } catch {}
177
- }
178
- throw new Error(`pandatail: cannot resolve stylesheet '${id}' from ${basedir}`);
179
- }
180
165
  async function extractTokens(opts) {
181
- const base = opts.base ?? process.cwd();
182
- const ds = await __unstable__loadDesignSystem(opts.css, {
183
- base,
184
- loadStylesheet: async (id, basedir) => {
185
- const path = resolveStylesheet(id, basedir);
186
- const content = await readFile(path, "utf8");
187
- return { path, base: dirname(path), content };
188
- },
189
- loadModule: async (id, basedir) => {
190
- const path = resolveStylesheet(id, basedir);
191
- const mod = await import(pathToFileURL(path).href);
192
- return { path, base: dirname(path), module: mod.default ?? mod };
193
- }
194
- });
166
+ const base = resolve(opts.base ?? process.cwd());
167
+ const ds = await __unstable__loadDesignSystem(opts.css, { base });
195
168
  const themeEntries = new Map;
196
169
  for (const [key, entry] of ds.theme.entries())
197
170
  themeEntries.set(key, entry.value);
@@ -498,7 +471,7 @@ async function loadPreset(entry, cwd) {
498
471
  const value = await entry;
499
472
  if (typeof value !== "string")
500
473
  return value;
501
- const req = createRequire2(resolve4(cwd, "__pandatail_anchor__"));
474
+ const req = createRequire(resolve4(cwd, "__pandatail_anchor__"));
502
475
  let mod;
503
476
  try {
504
477
  mod = await import(req.resolve(value));
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { bundleConfig, createConfigSnapshot, mergeConfigs } from "@pandacss/conf
3
3
  import { createCompilerFromSnapshot } from "@pandacss/compiler";
4
4
  import { applyConfigDefaults, formatDiagnostic } from "@pandacss/compiler-shared";
5
5
  import presetBase from "@pandacss/preset-base";
6
- import { createRequire as createRequire2 } from "node:module";
6
+ import { createRequire } from "node:module";
7
7
  import { existsSync as existsSync2, statSync } from "node:fs";
8
8
  import { relative, resolve as resolve4 } from "node:path";
9
9
 
@@ -13,11 +13,9 @@ import { readFile as readFile2 } from "node:fs/promises";
13
13
  import { dirname as dirname3, resolve as resolve3 } from "node:path";
14
14
 
15
15
  // src/extract.ts
16
- import { __unstable__loadDesignSystem } from "tailwindcss";
16
+ import { __unstable__loadDesignSystem } from "@tailwindcss/node";
17
17
  import { readFile } from "node:fs/promises";
18
- import { createRequire } from "node:module";
19
18
  import { dirname, resolve } from "node:path";
20
- import { pathToFileURL } from "node:url";
21
19
 
22
20
  // src/namespaces.ts
23
21
  var TAILWIND_NAMESPACES = [
@@ -157,34 +155,9 @@ function pushNamed(out) {
157
155
  }
158
156
 
159
157
  // src/extract.ts
160
- var requireFromHere = createRequire(`${process.cwd()}/__pandatail_anchor__`);
161
- function resolveStylesheet(id, basedir) {
162
- if (id.startsWith(".") || id.startsWith("/")) {
163
- return resolve(basedir, id);
164
- }
165
- const candidates = [`${id}/index.css`, `${id}.css`, id];
166
- for (const candidate of candidates) {
167
- try {
168
- return requireFromHere.resolve(candidate, { paths: [basedir] });
169
- } catch {}
170
- }
171
- throw new Error(`pandatail: cannot resolve stylesheet '${id}' from ${basedir}`);
172
- }
173
158
  async function extractTokens(opts) {
174
- const base = opts.base ?? process.cwd();
175
- const ds = await __unstable__loadDesignSystem(opts.css, {
176
- base,
177
- loadStylesheet: async (id, basedir) => {
178
- const path = resolveStylesheet(id, basedir);
179
- const content = await readFile(path, "utf8");
180
- return { path, base: dirname(path), content };
181
- },
182
- loadModule: async (id, basedir) => {
183
- const path = resolveStylesheet(id, basedir);
184
- const mod = await import(pathToFileURL(path).href);
185
- return { path, base: dirname(path), module: mod.default ?? mod };
186
- }
187
- });
159
+ const base = resolve(opts.base ?? process.cwd());
160
+ const ds = await __unstable__loadDesignSystem(opts.css, { base });
188
161
  const themeEntries = new Map;
189
162
  for (const [key, entry] of ds.theme.entries())
190
163
  themeEntries.set(key, entry.value);
@@ -491,7 +464,7 @@ async function loadPreset(entry, cwd) {
491
464
  const value = await entry;
492
465
  if (typeof value !== "string")
493
466
  return value;
494
- const req = createRequire2(resolve4(cwd, "__pandatail_anchor__"));
467
+ const req = createRequire(resolve4(cwd, "__pandatail_anchor__"));
495
468
  let mod;
496
469
  try {
497
470
  mod = await import(req.resolve(value));
package/dist/vite.js CHANGED
@@ -7,7 +7,7 @@ import { bundleConfig, createConfigSnapshot, mergeConfigs } from "@pandacss/conf
7
7
  import { createCompilerFromSnapshot } from "@pandacss/compiler";
8
8
  import { applyConfigDefaults, formatDiagnostic } from "@pandacss/compiler-shared";
9
9
  import presetBase from "@pandacss/preset-base";
10
- import { createRequire as createRequire2 } from "node:module";
10
+ import { createRequire } from "node:module";
11
11
  import { existsSync as existsSync2, statSync } from "node:fs";
12
12
  import { relative, resolve as resolve4 } from "node:path";
13
13
 
@@ -17,11 +17,9 @@ import { readFile as readFile2 } from "node:fs/promises";
17
17
  import { dirname as dirname3, resolve as resolve3 } from "node:path";
18
18
 
19
19
  // src/extract.ts
20
- import { __unstable__loadDesignSystem } from "tailwindcss";
20
+ import { __unstable__loadDesignSystem } from "@tailwindcss/node";
21
21
  import { readFile } from "node:fs/promises";
22
- import { createRequire } from "node:module";
23
22
  import { dirname, resolve } from "node:path";
24
- import { pathToFileURL } from "node:url";
25
23
 
26
24
  // src/namespaces.ts
27
25
  var TAILWIND_NAMESPACES = [
@@ -161,34 +159,9 @@ function pushNamed(out) {
161
159
  }
162
160
 
163
161
  // src/extract.ts
164
- var requireFromHere = createRequire(`${process.cwd()}/__pandatail_anchor__`);
165
- function resolveStylesheet(id, basedir) {
166
- if (id.startsWith(".") || id.startsWith("/")) {
167
- return resolve(basedir, id);
168
- }
169
- const candidates = [`${id}/index.css`, `${id}.css`, id];
170
- for (const candidate of candidates) {
171
- try {
172
- return requireFromHere.resolve(candidate, { paths: [basedir] });
173
- } catch {}
174
- }
175
- throw new Error(`pandatail: cannot resolve stylesheet '${id}' from ${basedir}`);
176
- }
177
162
  async function extractTokens(opts) {
178
- const base = opts.base ?? process.cwd();
179
- const ds = await __unstable__loadDesignSystem(opts.css, {
180
- base,
181
- loadStylesheet: async (id, basedir) => {
182
- const path = resolveStylesheet(id, basedir);
183
- const content = await readFile(path, "utf8");
184
- return { path, base: dirname(path), content };
185
- },
186
- loadModule: async (id, basedir) => {
187
- const path = resolveStylesheet(id, basedir);
188
- const mod = await import(pathToFileURL(path).href);
189
- return { path, base: dirname(path), module: mod.default ?? mod };
190
- }
191
- });
163
+ const base = resolve(opts.base ?? process.cwd());
164
+ const ds = await __unstable__loadDesignSystem(opts.css, { base });
192
165
  const themeEntries = new Map;
193
166
  for (const [key, entry] of ds.theme.entries())
194
167
  themeEntries.set(key, entry.value);
@@ -495,7 +468,7 @@ async function loadPreset(entry, cwd) {
495
468
  const value = await entry;
496
469
  if (typeof value !== "string")
497
470
  return value;
498
- const req = createRequire2(resolve4(cwd, "__pandatail_anchor__"));
471
+ const req = createRequire(resolve4(cwd, "__pandatail_anchor__"));
499
472
  let mod;
500
473
  try {
501
474
  mod = await import(req.resolve(value));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmisdm/pandatail",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Run PandaCSS from a Tailwind v4 stylesheet. Your @theme becomes typed Panda style props, with no panda.config.ts required.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -40,7 +40,7 @@
40
40
  ],
41
41
  "scripts": {
42
42
  "build": "bun run clean && bun run build:js && bun run build:types",
43
- "build:js": "bun build src/index.ts src/cli.ts src/vite.ts --outdir dist --target node --format esm --external \"@pandacss/*\" --external tailwindcss --external postcss --external vite",
43
+ "build:js": "bun build src/index.ts src/cli.ts src/vite.ts --outdir dist --target node --format esm --external \"@pandacss/*\" --external @tailwindcss/node --external postcss --external vite",
44
44
  "build:types": "tsc --project tsconfig.build.json",
45
45
  "clean": "rm -rf dist",
46
46
  "test": "bun test",
@@ -51,6 +51,7 @@
51
51
  "@pandacss/compiler": "^2.0.0",
52
52
  "@pandacss/config": "^2.0.0",
53
53
  "@pandacss/preset-base": "^2.0.0",
54
+ "@tailwindcss/node": "^4.0.0",
54
55
  "tailwindcss": "^4.0.0",
55
56
  "@pandacss/compiler-shared": "^2.0.0",
56
57
  "vite": ">=5.0.0"
@@ -64,15 +65,16 @@
64
65
  "@pandacss/config": "^2.6.0",
65
66
  "@pandacss/dev": "^2.6.0",
66
67
  "@pandacss/preset-base": "^2.6.0",
68
+ "@tailwindcss/node": "4.3.5",
67
69
  "@tailwindcss/postcss": "^4.3.0",
68
70
  "@types/bun": "latest",
69
71
  "@types/node": "^25.8.0",
70
- "tailwindcss": "^4.3.0",
72
+ "tailwindcss": "4.3.5",
71
73
  "typescript": "^5",
72
74
  "vite": "^8.4.1"
73
75
  },
74
76
  "bin": {
75
- "pandatail": "./dist/cli.js"
77
+ "pandatail": "dist/cli.js"
76
78
  },
77
79
  "peerDependenciesMeta": {
78
80
  "vite": {