@tailwindcss/postcss 0.0.0-development.3 → 0.0.0-development.4

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 CHANGED
@@ -1,12 +1,8 @@
1
- import { PluginCreator } from 'postcss';
1
+ import postcss from 'postcss';
2
2
 
3
- interface PluginOptions {
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,19 @@
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
- AtRule: {
10
- import: async (atRule, { AtRule }) => {
11
- let isTailwind = atRule.params === "'tailwindcss'" || atRule.params === '"tailwindcss"';
12
- if (!isTailwind)
13
- return;
14
- atRule.replaceWith(new AtRule({ name: "tailwind" }));
15
- },
16
- // We must handle `@tailwind` because not all tools preserve `@import`
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.`);
21
- }
22
- let scanResult = _oxide.scanDir.call(void 0, { base, globs: true });
23
- let css = _tailwindcss.optimizeCss.call(void 0, _tailwindcss.preflight + _tailwindcss.compile.call(void 0, scanResult.candidates));
24
- for (let file of scanResult.files) {
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 { candidates, files, globs } = _oxide.scanDir.call(void 0, { base, globs: true });
15
+ let css = _tailwindcss.optimizeCss.call(void 0, _tailwindcss.compile.call(void 0, root.toString(), candidates));
16
+ for (let file of files) {
25
17
  result.messages.push({
26
18
  type: "dependency",
27
19
  plugin: "tailwindcss-v4",
@@ -29,7 +21,7 @@ function tailwindcss(opts = {}) {
29
21
  parent: result.opts.from
30
22
  });
31
23
  }
32
- for (let { base: base2, glob } of scanResult.globs) {
24
+ for (let { base: base2, glob } of globs) {
33
25
  result.messages.push({
34
26
  type: "dir-dependency",
35
27
  plugin: "tailwindcss-v4",
@@ -38,10 +30,11 @@ function tailwindcss(opts = {}) {
38
30
  parent: result.opts.from
39
31
  });
40
32
  }
41
- let nodes = postcss.parse(css);
42
- atRule.replaceWith(nodes);
33
+ let nodes = _postcss2.default.parse(css);
34
+ root.removeAll();
35
+ root.append(nodes);
43
36
  }
44
- }
37
+ ]
45
38
  };
46
39
  }
47
40
  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.3",
4
- "scripts": {
5
- "build": "tsup-node ./src/index.ts --format cjs --dts --cjsInterop --splitting",
6
- "dev": "npm run build -- --watch"
7
- },
3
+ "version": "0.0.0-development.4",
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.mts",
14
+ "types": "./dist/index.d.ts",
14
15
  "require": "./dist/index.js"
15
16
  }
16
17
  },
17
18
  "dependencies": {
18
- "tailwindcss": "0.0.0-development.3",
19
- "@tailwindcss/oxide": "0.0.0-development.3"
19
+ "postcss-import": "^16.0.0",
20
+ "@tailwindcss/oxide": "^0.0.0-development.4",
21
+ "tailwindcss": "^0.0.0-development.4"
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
+ }