@tailwindcss/vite 4.0.0-alpha.2 → 4.0.0-alpha.21

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.
Files changed (2) hide show
  1. package/dist/index.mjs +2 -1
  2. package/package.json +22 -7
package/dist/index.mjs CHANGED
@@ -1 +1,2 @@
1
- import{IO as v,Parsing as y,scanFiles as w}from"@tailwindcss/oxide";import g from"path";import{compile as h,optimizeCss as S}from"tailwindcss";function x(){let s=null,l=new Set,a=new Set,u=!1;function d(e){let[t]=e.split("?",2);return g.extname(t).slice(1)==="css"}function c(){if(!s)return;let e=[];for(let t of a){let i=s.moduleGraph.getModuleById(t);if(!i){console.log("Could not find css module",t);continue}s.moduleGraph.invalidateModule(i),e.push({type:`${i.type}-update`,path:i.url,acceptedPath:i.url,timestamp:Date.now()})}e.length>0&&s.hot.send({type:"update",updates:e})}function f(e,t){let i=!1;for(let n of w([{content:e,extension:t}],v.Sequential|y.Sequential)){if(!i){if(l.has(n))continue;i=!0}l.add(n)}return i}function p(e){return S(h(e,Array.from(l)),{minify:u})}let o=(()=>{let e=50,t,i,n=!1;return{tick(){n||(t&&clearTimeout(t),t=setTimeout(i,e))},complete:new Promise(r=>{i=()=>{n=!0,r()}})}})();return[{name:"@tailwindcss/vite:scan",enforce:"pre",configureServer(e){s=e},async configResolved(e){u=e.build.cssMinify!==!1},transformIndexHtml(e){o.tick();let t=f(e,"html");s&&t&&c()},transform(e,t){if(o.tick(),t.includes("/.vite/"))return;let[i]=t.split("?",2),n=g.extname(i).slice(1);n===""||n==="css"||(f(e,n),s&&c())}},{name:"@tailwindcss/vite:generate:serve",apply:"serve",async transform(e,t){if(!(!d(t)||!e.includes("@tailwind")))return a.add(t),await o.complete,{code:p(e)}}},{name:"@tailwindcss/vite:generate:build",enforce:"post",apply:"build",generateBundle(e,t){for(let i in t){let n=t[i];if(n.type!=="asset"||!d(i))continue;let r=n.source,m=r instanceof Uint8Array?new TextDecoder().decode(r):r;m.includes("@tailwind")&&(n.source=p(m))}}}]}export{x as default};
1
+ import{compile as z}from"@tailwindcss/node";import{clearRequireCache as D}from"@tailwindcss/node/require-cache";import{Scanner as B}from"@tailwindcss/oxide";import P from"node:path";function j(n,r){if(typeof n!="string")throw new TypeError("expected path to be a string");if(n==="\\"||n==="/")return"/";var l=n.length;if(l<=1)return n;var f="";if(l>4&&n[3]==="\\"){var c=n[2];(c==="?"||c===".")&&n.slice(0,2)==="\\\\"&&(n=n.slice(2),f="//")}var u=n.split(/[/\\]+/);return r!==!1&&u[u.length-1]===""&&u.pop(),f+u.join("/")}function S(n){let r=j(n);return n.startsWith("\\\\")&&r.startsWith("/")&&!r.startsWith("//")?`/${r}`:r}var b="'",x='"';function R(){let n=new WeakSet;function r(l){let f=l.root().source?.input.file;if(!f)return;let c=l.source?.input.file;if(!c||n.has(l))return;let u=l.params[0],d=u[0]===x&&u[u.length-1]===x?x:u[0]===b&&u[u.length-1]===b?b:null;if(!d)return;let p=l.params.slice(1,-1),v="";if(p.startsWith("!")&&(p=p.slice(1),v="!"),!p.startsWith("./")&&!p.startsWith("../"))return;let w=P.posix.join(S(P.dirname(c)),p),C=P.posix.dirname(S(f)),m=P.posix.relative(C,w);m.startsWith(".")||(m="./"+m),l.params=d+v+m+d,n.add(l)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",AtRule:{source:r,plugin:r,config:r}}}import{Features as M,transform as I}from"lightningcss";import y from"path";import O from"postcss-load-config";function T(){let n=null,r=null,l=null,f=[],c=new Set,u=[],d={},p=!1,v=!1,w=[];function C(t){if(!n)return;let e=[];for(let s of Object.keys(d)){let i=n.moduleGraph.getModuleById(s);if(!i){t||delete d[s];continue}n.moduleGraph.invalidateModule(i),e.push({type:`${i.type}-update`,path:i.url,acceptedPath:i.url,timestamp:Date.now()})}e.length>0&&n.hot.send({type:"update",updates:e})}function m(t,e){let s=!1;if(l===null)return f.push({content:t,extension:e}),s;for(let i of l.scanFiles([{content:t,extension:e}]))s=!0,c.add(i);return s}async function F(t,e,s){let i=y.dirname(y.resolve(e));D(u),u=[];let{build:o,globs:h}=await z(t,{base:i,onDependency(a){s(a),u.push(a)}});l=new B({sources:h.map(a=>({base:i,pattern:a}))});for(let a of l.scan())c.add(a);if(f.length>0)for(let a of l.scanFiles(f.splice(0)))c.add(a);for(let a of l.files)s(a);for(let a of l.globs){if(a.pattern[0]==="!")continue;let g=y.relative(r.root,a.base);g[0]!=="."&&(g="./"+g),g=S(g),s(y.posix.join(g,a.pattern))}return o(Array.from(c))}async function E(t,e,s){return q(await F(t,e,s),{minify:v})}async function W(t,e,s){let i={...t,getCombinedSourcemap:()=>{throw new Error("getCombinedSourcemap not implemented")}};for(let o of w){if(!o.transform)continue;let h="handler"in o.transform?o.transform.handler:o.transform;try{let a=await h.call(i,s,e);if(!a)continue;typeof a=="string"?s=a:a.code&&(s=a.code)}catch{console.error(`Error running ${o.name} on Tailwind CSS output. Skipping.`)}}return s}return[{name:"@tailwindcss/vite:scan",enforce:"pre",configureServer(t){n=t},async configResolved(t){r=t,v=r.build.cssMinify!==!1,p=r.build.ssr!==!1&&r.build.ssr!==void 0;let e=["vite:css",...r.command==="build"?["vite:css-post"]:[]];w=r.plugins.filter(s=>e.includes(s.name))},async config(t){let e=t.css?.postcss;if(typeof e=="string"){let s=typeof e=="string"?e:t.root,i=await O({},s).catch(o=>{if(!o.message.includes("No PostCSS Config found"))if(o instanceof Error){let{name:h,message:a,stack:g}=o;throw o.name="Failed to load PostCSS config",o.message=`Failed to load PostCSS config (searchPath: ${s}): [${h}] ${a}
2
+ ${g}`,o.stack="",o}else throw new Error(`Failed to load PostCSS config: ${o}`);return null});i!==null?e={options:i.options,plugins:i.plugins}:e={},t.css={postcss:e}}typeof e!="string"&&(!e||!e?.plugins?(t.css=t.css||{},t.css.postcss=e||{},t.css.postcss.plugins=[R()]):e.plugins.push(R()))},transformIndexHtml(t){m(t,"html")&&C(p)},transform(t,e,s){if(e.includes("/.vite/"))return;let i=k(e);i===""||i==="css"||(m(t,i),C(s?.ssr??!1))}},{name:"@tailwindcss/vite:generate:serve",apply:"serve",async transform(t,e,s){return $(e,t)?(d[e]={content:"",handled:!0},s?.ssr||await n?.waitForRequestsIdle?.(e),{code:await W(this,e,await F(t,e,o=>this.addWatchFile(o)))}):void 0}},{name:"@tailwindcss/vite:generate:build",apply:"build",transform(t,e){$(e,t)&&(d[e]={content:t,handled:!1})},async renderChunk(t,e){for(let[s,i]of Object.entries(d)){if(i.handled)continue;let o=await E(i.content,s,h=>this.addWatchFile(h));await W(this,s,o),i.handled=!0}}}]}function k(n){let[r]=n.split("?",2);return y.extname(r).slice(1)}function $(n,r){let l=k(n);return(l==="css"||l==="vue"&&n.includes("&lang.css"))&&r.includes("@tailwind")}function q(n,{file:r="input.css",minify:l=!1}={}){return I({filename:r,code:Buffer.from(n),minify:l,sourceMap:!1,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:M.Nesting,exclude:M.LogicalProperties,targets:{safari:16<<16|1024},errorRecovery:!0}).code.toString()}export{T as default};
package/package.json CHANGED
@@ -1,14 +1,22 @@
1
1
  {
2
2
  "name": "@tailwindcss/vite",
3
- "version": "4.0.0-alpha.2",
3
+ "version": "4.0.0-alpha.21",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
- "repository": "https://github.com/tailwindlabs/tailwindcss.git",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/tailwindlabs/tailwindcss.git",
9
+ "directory": "packages/@tailwindcss-vite"
10
+ },
7
11
  "bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
8
12
  "homepage": "https://tailwindcss.com",
9
13
  "files": [
10
14
  "dist/"
11
15
  ],
16
+ "publishConfig": {
17
+ "provenance": true,
18
+ "access": "public"
19
+ },
12
20
  "exports": {
13
21
  ".": {
14
22
  "types": "./dist/index.d.mts",
@@ -16,15 +24,22 @@
16
24
  }
17
25
  },
18
26
  "dependencies": {
19
- "@tailwindcss/oxide": "4.0.0-alpha.2",
20
- "tailwindcss": "4.0.0-alpha.2"
27
+ "lightningcss": "^1.26.0",
28
+ "postcss-load-config": "^6.0.1",
29
+ "@tailwindcss/node": "4.0.0-alpha.21",
30
+ "@tailwindcss/oxide": "4.0.0-alpha.21",
31
+ "tailwindcss": "4.0.0-alpha.21"
21
32
  },
22
33
  "devDependencies": {
23
- "@types/node": "^20.11.17",
24
- "vite": "^5.0.11"
34
+ "@types/node": "^20.14.8",
35
+ "vite": "^5.4.0",
36
+ "internal-postcss-fix-relative-paths": "0.0.0"
37
+ },
38
+ "peerDependencies": {
39
+ "vite": "^5.2.0"
25
40
  },
26
41
  "scripts": {
27
- "build": "tsup-node ./src/index.ts --format esm --dts --minify --clean",
42
+ "build": "tsup-node",
28
43
  "dev": "pnpm run build -- --watch"
29
44
  }
30
45
  }