@tailwindcss/webpack 0.0.0-insiders.566eea4
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/LICENSE +21 -0
- package/README.md +64 -0
- package/dist/index.d.mts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Tailwind Labs, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @tailwindcss/webpack
|
|
2
|
+
|
|
3
|
+
A webpack loader for Tailwind CSS v4.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @tailwindcss/webpack
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
// webpack.config.js
|
|
15
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
plugins: [new MiniCssExtractPlugin()],
|
|
19
|
+
module: {
|
|
20
|
+
rules: [
|
|
21
|
+
{
|
|
22
|
+
test: /\.css$/i,
|
|
23
|
+
use: [MiniCssExtractPlugin.loader, 'css-loader', '@tailwindcss/webpack'],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Then create a CSS file that imports Tailwind:
|
|
31
|
+
|
|
32
|
+
```css
|
|
33
|
+
/* src/index.css */
|
|
34
|
+
@import 'tailwindcss/theme';
|
|
35
|
+
@import 'tailwindcss/utilities';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Options
|
|
39
|
+
|
|
40
|
+
### `base`
|
|
41
|
+
|
|
42
|
+
The base directory to scan for class candidates. Defaults to the current working directory.
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
{
|
|
46
|
+
loader: '@tailwindcss/webpack',
|
|
47
|
+
options: {
|
|
48
|
+
base: process.cwd(),
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `optimize`
|
|
54
|
+
|
|
55
|
+
Whether to optimize and minify the output CSS. Defaults to `true` in production mode.
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
{
|
|
59
|
+
loader: '@tailwindcss/webpack',
|
|
60
|
+
options: {
|
|
61
|
+
optimize: true, // or { minify: true }
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
```
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LoaderContext } from 'webpack';
|
|
2
|
+
|
|
3
|
+
interface LoaderOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The base directory to scan for class candidates.
|
|
6
|
+
*
|
|
7
|
+
* Defaults to the current working directory.
|
|
8
|
+
*/
|
|
9
|
+
base?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Optimize and minify the output CSS.
|
|
12
|
+
*/
|
|
13
|
+
optimize?: boolean | {
|
|
14
|
+
minify?: boolean;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare function tailwindLoader(this: LoaderContext<LoaderOptions>, source: string): Promise<void>;
|
|
18
|
+
|
|
19
|
+
export { type LoaderOptions, tailwindLoader as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LoaderContext } from 'webpack';
|
|
2
|
+
|
|
3
|
+
interface LoaderOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The base directory to scan for class candidates.
|
|
6
|
+
*
|
|
7
|
+
* Defaults to the current working directory.
|
|
8
|
+
*/
|
|
9
|
+
base?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Optimize and minify the output CSS.
|
|
12
|
+
*/
|
|
13
|
+
optimize?: boolean | {
|
|
14
|
+
minify?: boolean;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare function tailwindLoader(this: LoaderContext<LoaderOptions>, source: string): Promise<void>;
|
|
18
|
+
|
|
19
|
+
export = tailwindLoader;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var I=Object.create;var B=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var O=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),x=n=>{throw TypeError(n)};var j=(n,e,l,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of M(e))!G.call(n,s)&&s!==l&&B(n,s,{get:()=>e[s],enumerable:!(t=J(e,s))||t.enumerable});return n};var k=(n,e,l)=>(l=n!=null?I(Q(n)):{},j(e||!n||!n.__esModule?B(l,"default",{value:n,enumerable:!0}):l,n));var D=(n,e,l)=>{if(e!=null){typeof e!="object"&&typeof e!="function"&&x("Object expected");var t,s;l&&(t=e[O("asyncDispose")]),t===void 0&&(t=e[O("dispose")],l&&(s=t)),typeof t!="function"&&x("Object not disposable"),s&&(t=function(){try{s.call(this)}catch(f){return Promise.reject(f)}}),n.push([l,t,e])}else l&&n.push([l]);return e},L=(n,e,l)=>{var t=typeof SuppressedError=="function"?SuppressedError:function(p,i,m,y){return y=Error(m),y.name="SuppressedError",y.error=p,y.suppressed=i,y},s=p=>e=l?new t(p,e,"An error was suppressed during disposal"):(l=!0,p),f=p=>{for(;p=n.pop();)try{var i=p[1]&&p[1].call(p[2]);if(p[0])return Promise.resolve(i).then(f,m=>(s(m),f()))}catch(m){s(m)}if(l)throw e};return f()};var N=k(require("@alloc/quick-lru")),o=require("@tailwindcss/node"),T=require("@tailwindcss/node/require-cache"),A=require("@tailwindcss/oxide"),P=k(require("fs")),u=k(require("path"));var r=o.env.DEBUG,v=new N.default({maxSize:50});function q(n,e){let l=`${n}:${e.base??""}:${JSON.stringify(e.optimize)}`;if(v.has(l))return v.get(l);let t={mtimes:new Map,compiler:null,scanner:null,candidates:new Set,fullRebuildPaths:[]};return v.set(l,t),t}async function R(n){var m=[];try{let e=this.async();let l=this.getOptions()??{};let t=this.resourcePath;let s=l.base??process.cwd();let f=l.optimize??process.env.NODE_ENV==="production";let p=t.endsWith(".module.css");let i=D(m,new o.Instrumentation);r&&i.start(`[@tailwindcss/webpack] ${u.default.relative(s,t)}`);{if(r&&i.start("Quick bail check"),!/@(import|reference|theme|variant|config|plugin|apply|tailwind)\b/.test(n)){r&&i.end("Quick bail check"),r&&i.end(`[@tailwindcss/webpack] ${u.default.relative(s,t)}`),e(null,n);return}r&&i.end("Quick bail check")}try{let a=q(t,l),S=u.default.dirname(u.default.resolve(t)),C=a.compiler===null;async function E(){r&&i.start("Setup compiler"),a.fullRebuildPaths.length>0&&!C&&(0,T.clearRequireCache)(a.fullRebuildPaths),a.fullRebuildPaths=[],r&&i.start("Create compiler");let b=await(0,o.compile)(n,{from:t,base:S,shouldRewriteUrls:!0,onDependency:d=>a.fullRebuildPaths.push(d),polyfills:p?o.Polyfills.All^o.Polyfills.AtProperty:o.Polyfills.All});return r&&i.end("Create compiler"),r&&i.end("Setup compiler"),b}if(a.compiler??=await E(),a.compiler.features===o.Features.None){r&&i.end(`[@tailwindcss/webpack] ${u.default.relative(s,t)}`),e(null,n);return}let w="incremental";r&&i.start("Register full rebuild paths");{for(let d of a.fullRebuildPaths)this.addDependency(u.default.resolve(d));let b=[...a.fullRebuildPaths,t];for(let d of b){let c=null;try{c=P.default.statSync(d)?.mtimeMs??null}catch{}if(c===null){d===t&&(w="full");continue}a.mtimes.get(d)!==c&&(w="full",a.mtimes.set(d,c))}}r&&i.end("Register full rebuild paths"),w==="full"&&!C&&(a.compiler=await E());let h=a.compiler;if(!(h.features&(o.Features.AtApply|o.Features.JsPluginCompat|o.Features.ThemeFunction|o.Features.Utilities))){r&&i.end(`[@tailwindcss/webpack] ${u.default.relative(s,t)}`),e(null,n);return}if(a.scanner===null||w==="full"){r&&i.start("Setup scanner");let b=(h.root==="none"?[]:h.root===null?[{base:s,pattern:"**/*",negated:!1}]:[{...h.root,negated:!1}]).concat(h.sources);a.scanner=new A.Scanner({sources:b}),r&&i.end("Setup scanner")}if(h.features&o.Features.Utilities){r&&i.start("Scan for candidates");for(let c of a.scanner.scan())a.candidates.add(c);r&&i.end("Scan for candidates"),r&&i.start("Register dependency messages");let b=u.default.resolve(s,t);for(let c of a.scanner.files){let g=u.default.resolve(c);g!==b&&this.addDependency(g)}for(let c of a.scanner.globs)c.pattern[0]!=="!"&&(c.pattern==="*"&&s===c.base||this.addContextDependency(u.default.resolve(c.base)));let d=h.root;if(d!=="none"&&d!==null){let c=(0,o.normalizePath)(u.default.resolve(d.base,d.pattern));try{if(!P.default.statSync(c).isDirectory())throw new Error(`The path given to \`source(\u2026)\` must be a directory but got \`source(${c})\` instead.`)}catch(g){if(g.code!=="ENOENT")throw g}}r&&i.end("Register dependency messages")}r&&i.start("Build utilities");let $=h.build([...a.candidates]);r&&i.end("Build utilities");let z=$;f&&(r&&i.start("Optimization"),z=(0,o.optimize)($,{minify:typeof f=="object"?f.minify:!0}).code,r&&i.end("Optimization")),r&&i.end(`[@tailwindcss/webpack] ${u.default.relative(s,t)}`),e(null,z)}catch(a){let S=`${t}:${l.base??""}:${JSON.stringify(l.optimize)}`;v.delete(S),r&&i.end(`[@tailwindcss/webpack] ${u.default.relative(s,t)}`),e(a)}}catch(y){var F=y,U=!0}finally{L(m,F,U)}}module.exports=R;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var $=(a,n)=>(n=Symbol[a])?n:Symbol.for("Symbol."+a),z=a=>{throw TypeError(a)};var O=(a,n,r)=>{if(n!=null){typeof n!="object"&&typeof n!="function"&&z("Object expected");var t,s;r&&(t=n[$("asyncDispose")]),t===void 0&&(t=n[$("dispose")],r&&(s=t)),typeof t!="function"&&z("Object not disposable"),s&&(t=function(){try{s.call(this)}catch(p){return Promise.reject(p)}}),a.push([r,t,n])}else r&&a.push([r]);return n},x=(a,n,r)=>{var t=typeof SuppressedError=="function"?SuppressedError:function(d,e,f,b){return b=Error(f),b.name="SuppressedError",b.error=d,b.suppressed=e,b},s=d=>n=r?new t(d,n,"An error was suppressed during disposal"):(r=!0,d),p=d=>{for(;d=a.pop();)try{var e=d[1]&&d[1].call(d[2]);if(d[0])return Promise.resolve(e).then(p,f=>(s(f),p()))}catch(f){s(f)}if(r)throw n};return p()};import L from"@alloc/quick-lru";import{compile as T,env as A,Features as g,Instrumentation as F,normalizePath as U,optimize as I,Polyfills as k}from"@tailwindcss/node";import{clearRequireCache as J}from"@tailwindcss/node/require-cache";import{Scanner as M}from"@tailwindcss/oxide";import B from"fs";import u from"path";var i=A.DEBUG,v=new L({maxSize:50});function Q(a,n){let r=`${a}:${n.base??""}:${JSON.stringify(n.optimize)}`;if(v.has(r))return v.get(r);let t={mtimes:new Map,compiler:null,scanner:null,candidates:new Set,fullRebuildPaths:[]};return v.set(r,t),t}async function G(a){var f=[];try{let n=this.async();let r=this.getOptions()??{};let t=this.resourcePath;let s=r.base??process.cwd();let p=r.optimize??process.env.NODE_ENV==="production";let d=t.endsWith(".module.css");let e=O(f,new F);i&&e.start(`[@tailwindcss/webpack] ${u.relative(s,t)}`);{if(i&&e.start("Quick bail check"),!/@(import|reference|theme|variant|config|plugin|apply|tailwind)\b/.test(a)){i&&e.end("Quick bail check"),i&&e.end(`[@tailwindcss/webpack] ${u.relative(s,t)}`),n(null,a);return}i&&e.end("Quick bail check")}try{let l=Q(t,r),S=u.dirname(u.resolve(t)),P=l.compiler===null;async function R(){i&&e.start("Setup compiler"),l.fullRebuildPaths.length>0&&!P&&J(l.fullRebuildPaths),l.fullRebuildPaths=[],i&&e.start("Create compiler");let h=await T(a,{from:t,base:S,shouldRewriteUrls:!0,onDependency:c=>l.fullRebuildPaths.push(c),polyfills:d?k.All^k.AtProperty:k.All});return i&&e.end("Create compiler"),i&&e.end("Setup compiler"),h}if(l.compiler??=await R(),l.compiler.features===g.None){i&&e.end(`[@tailwindcss/webpack] ${u.relative(s,t)}`),n(null,a);return}let w="incremental";i&&e.start("Register full rebuild paths");{for(let c of l.fullRebuildPaths)this.addDependency(u.resolve(c));let h=[...l.fullRebuildPaths,t];for(let c of h){let o=null;try{o=B.statSync(c)?.mtimeMs??null}catch{}if(o===null){c===t&&(w="full");continue}l.mtimes.get(c)!==o&&(w="full",l.mtimes.set(c,o))}}i&&e.end("Register full rebuild paths"),w==="full"&&!P&&(l.compiler=await R());let m=l.compiler;if(!(m.features&(g.AtApply|g.JsPluginCompat|g.ThemeFunction|g.Utilities))){i&&e.end(`[@tailwindcss/webpack] ${u.relative(s,t)}`),n(null,a);return}if(l.scanner===null||w==="full"){i&&e.start("Setup scanner");let h=(m.root==="none"?[]:m.root===null?[{base:s,pattern:"**/*",negated:!1}]:[{...m.root,negated:!1}]).concat(m.sources);l.scanner=new M({sources:h}),i&&e.end("Setup scanner")}if(m.features&g.Utilities){i&&e.start("Scan for candidates");for(let o of l.scanner.scan())l.candidates.add(o);i&&e.end("Scan for candidates"),i&&e.start("Register dependency messages");let h=u.resolve(s,t);for(let o of l.scanner.files){let y=u.resolve(o);y!==h&&this.addDependency(y)}for(let o of l.scanner.globs)o.pattern[0]!=="!"&&(o.pattern==="*"&&s===o.base||this.addContextDependency(u.resolve(o.base)));let c=m.root;if(c!=="none"&&c!==null){let o=U(u.resolve(c.base,c.pattern));try{if(!B.statSync(o).isDirectory())throw new Error(`The path given to \`source(\u2026)\` must be a directory but got \`source(${o})\` instead.`)}catch(y){if(y.code!=="ENOENT")throw y}}i&&e.end("Register dependency messages")}i&&e.start("Build utilities");let C=m.build([...l.candidates]);i&&e.end("Build utilities");let E=C;p&&(i&&e.start("Optimization"),E=I(C,{minify:typeof p=="object"?p.minify:!0}).code,i&&e.end("Optimization")),i&&e.end(`[@tailwindcss/webpack] ${u.relative(s,t)}`),n(null,E)}catch(l){let S=`${t}:${r.base??""}:${JSON.stringify(r.optimize)}`;v.delete(S),i&&e.end(`[@tailwindcss/webpack] ${u.relative(s,t)}`),n(l)}}catch(b){var D=b,N=!0}finally{x(f,D,N)}}export{G as default};
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tailwindcss/webpack",
|
|
3
|
+
"version": "0.0.0-insiders.566eea4",
|
|
4
|
+
"description": "A webpack loader for Tailwind CSS v4.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/tailwindlabs/tailwindcss.git",
|
|
9
|
+
"directory": "packages/@tailwindcss-webpack"
|
|
10
|
+
},
|
|
11
|
+
"bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
|
|
12
|
+
"homepage": "https://tailwindcss.com",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"provenance": true,
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"require": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@alloc/quick-lru": "^5.2.0",
|
|
31
|
+
"@tailwindcss/node": "0.0.0-insiders.566eea4",
|
|
32
|
+
"@tailwindcss/oxide": "0.0.0-insiders.566eea4",
|
|
33
|
+
"tailwindcss": "0.0.0-insiders.566eea4"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^20.19.0",
|
|
37
|
+
"webpack": "^5"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"webpack": "^5"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsup-node",
|
|
44
|
+
"dev": "pnpm run build -- --watch"
|
|
45
|
+
}
|
|
46
|
+
}
|