@tailwindcss/postcss 0.0.0-development.3 → 0.0.0-development.5
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 +4 -8
- package/dist/index.js +31 -20
- package/package.json +22 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import postcss from 'postcss';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The directory to scan for Tailwind CSS files.
|
|
6
|
-
* Defaults to the current working directory.
|
|
7
|
-
*/
|
|
3
|
+
type PluginOptions = {
|
|
8
4
|
base?: string;
|
|
9
|
-
}
|
|
10
|
-
declare const _default: PluginCreator<PluginOptions>;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: postcss.PluginCreator<PluginOptions>;
|
|
11
7
|
|
|
12
8
|
export = _default;
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,39 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/index.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/index.ts
|
|
2
2
|
var _oxide = require('@tailwindcss/oxide');
|
|
3
|
-
require('postcss');
|
|
3
|
+
var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postcss);
|
|
4
|
+
var _postcssimport = require('postcss-import'); var _postcssimport2 = _interopRequireDefault(_postcssimport);
|
|
4
5
|
var _tailwindcss = require('tailwindcss');
|
|
5
6
|
function tailwindcss(opts = {}) {
|
|
6
7
|
let base = _nullishCoalesce(opts.base, () => ( process.cwd()));
|
|
7
8
|
return {
|
|
8
9
|
postcssPlugin: "tailwindcss-v4",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
plugins: [
|
|
11
|
+
// We need to run `postcss-import` first to handle `@import` rules.
|
|
12
|
+
_postcssimport2.default.call(void 0, ),
|
|
13
|
+
function(root, result) {
|
|
14
|
+
let hasApply = false;
|
|
15
|
+
let hasTailwind = false;
|
|
16
|
+
root.walkAtRules((rule) => {
|
|
17
|
+
if (rule.name === "apply") {
|
|
18
|
+
hasApply = true;
|
|
19
|
+
} else if (rule.name === "tailwind") {
|
|
20
|
+
hasApply = true;
|
|
21
|
+
hasTailwind = true;
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (!hasTailwind && !hasApply)
|
|
13
26
|
return;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// at-rules and replace them with their content before we see them.
|
|
18
|
-
tailwind: async (atRule, { result, postcss }) => {
|
|
19
|
-
if (atRule.params !== void 0 && atRule.params !== "") {
|
|
20
|
-
throw atRule.error(`@tailwind does not accept any parameters.`);
|
|
27
|
+
function replaceCss(css) {
|
|
28
|
+
root.removeAll();
|
|
29
|
+
root.append(_postcss2.default.parse(_tailwindcss.optimizeCss.call(void 0, css), result.opts));
|
|
21
30
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
if (!hasTailwind) {
|
|
32
|
+
replaceCss(_tailwindcss.compile.call(void 0, root.toString(), []));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
let { candidates, files, globs } = _oxide.scanDir.call(void 0, { base, globs: true });
|
|
36
|
+
for (let file of files) {
|
|
25
37
|
result.messages.push({
|
|
26
38
|
type: "dependency",
|
|
27
39
|
plugin: "tailwindcss-v4",
|
|
@@ -29,7 +41,7 @@ function tailwindcss(opts = {}) {
|
|
|
29
41
|
parent: result.opts.from
|
|
30
42
|
});
|
|
31
43
|
}
|
|
32
|
-
for (let { base: base2, glob } of
|
|
44
|
+
for (let { base: base2, glob } of globs) {
|
|
33
45
|
result.messages.push({
|
|
34
46
|
type: "dir-dependency",
|
|
35
47
|
plugin: "tailwindcss-v4",
|
|
@@ -38,10 +50,9 @@ function tailwindcss(opts = {}) {
|
|
|
38
50
|
parent: result.opts.from
|
|
39
51
|
});
|
|
40
52
|
}
|
|
41
|
-
|
|
42
|
-
atRule.replaceWith(nodes);
|
|
53
|
+
replaceCss(_tailwindcss.compile.call(void 0, root.toString(), candidates));
|
|
43
54
|
}
|
|
44
|
-
|
|
55
|
+
]
|
|
45
56
|
};
|
|
46
57
|
}
|
|
47
58
|
var src_default = Object.assign(tailwindcss, { postcss: true });
|
package/package.json
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailwindcss/postcss",
|
|
3
|
-
"version": "0.0.0-development.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
"version": "0.0.0-development.5",
|
|
4
|
+
"description": "PostCSS plugin for Tailwind CSS, a utility-first CSS framework for rapidly building custom user interfaces",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "https://github.com/tailwindlabs/tailwindcss.git",
|
|
7
|
+
"bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
|
|
8
|
+
"homepage": "https://tailwindcss.com",
|
|
8
9
|
"files": [
|
|
9
|
-
"dist"
|
|
10
|
+
"dist/"
|
|
10
11
|
],
|
|
11
12
|
"exports": {
|
|
12
13
|
".": {
|
|
13
|
-
"types": "./dist/index.d.
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
14
15
|
"require": "./dist/index.js"
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"
|
|
19
|
-
"@tailwindcss/oxide": "0.0.0-development.
|
|
19
|
+
"postcss-import": "^16.0.0",
|
|
20
|
+
"@tailwindcss/oxide": "^0.0.0-development.5",
|
|
21
|
+
"tailwindcss": "^0.0.0-development.5"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^20.11.17",
|
|
25
|
+
"@types/postcss-import": "^14.0.3",
|
|
26
|
+
"postcss": "8.4.24"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"lint": "tsc --noEmit",
|
|
30
|
+
"build": "tsup-node ./src/index.ts --format cjs --dts --cjsInterop --splitting",
|
|
31
|
+
"dev": "pnpm run build -- --watch"
|
|
20
32
|
}
|
|
21
|
-
}
|
|
33
|
+
}
|