tailwindcss 2.0.2 → 2.0.3

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.
@@ -27,7 +27,7 @@ const options = [{
27
27
  description: 'Generate complete configuration file.'
28
28
  }, {
29
29
  usage: '-p',
30
- description: 'Generate postcss.config.js file.'
30
+ description: 'Generate PostCSS config file.'
31
31
  }];
32
32
  exports.options = options;
33
33
  const optionMap = {
@@ -47,8 +47,9 @@ exports.optionMap = optionMap;
47
47
  function run(cliParams, cliOptions) {
48
48
  return new Promise(resolve => {
49
49
  utils.header();
50
+ const isModule = utils.isModule();
50
51
  const full = cliOptions.full;
51
- const file = cliParams[0] || constants.defaultConfigFile;
52
+ const file = cliParams[0] || (isModule ? constants.cjsConfigFile : constants.defaultConfigFile);
52
53
  const simplePath = utils.getSimplePath(file);
53
54
  utils.exists(file) && utils.die(colors.file(simplePath), 'already exists.');
54
55
  const stubFile = full ? constants.defaultConfigStubFile : constants.simpleConfigStubFile;
@@ -58,9 +59,10 @@ function run(cliParams, cliOptions) {
58
59
  utils.log(emoji.yes, 'Created Tailwind config file:', colors.file(simplePath));
59
60
 
60
61
  if (cliOptions.postcss) {
61
- const path = utils.getSimplePath(constants.defaultPostCssConfigFile);
62
+ const postCssConfigFile = isModule ? constants.cjsPostCssConfigFile : constants.defaultPostCssConfigFile;
63
+ const path = utils.getSimplePath(postCssConfigFile);
62
64
  utils.exists(constants.defaultPostCssConfigFile) && utils.die(colors.file(path), 'already exists.');
63
- utils.copyFile(constants.defaultPostCssConfigStubFile, constants.defaultPostCssConfigFile);
65
+ utils.copyFile(constants.defaultPostCssConfigStubFile, postCssConfigFile);
64
66
  utils.log(emoji.yes, 'Created PostCSS config file:', colors.file(path));
65
67
  }
66
68
 
package/lib/cli/utils.js CHANGED
@@ -13,6 +13,7 @@ exports.die = die;
13
13
  exports.exists = exists;
14
14
  exports.copyFile = copyFile;
15
15
  exports.readFile = readFile;
16
+ exports.isModule = isModule;
16
17
  exports.writeFile = writeFile;
17
18
  exports.getSimplePath = getSimplePath;
18
19
 
@@ -20,18 +21,20 @@ var _fsExtra = require("fs-extra");
20
21
 
21
22
  var _lodash = require("lodash");
22
23
 
24
+ var _path = _interopRequireDefault(require("path"));
25
+
23
26
  var colors = _interopRequireWildcard(require("./colors"));
24
27
 
25
28
  var emoji = _interopRequireWildcard(require("./emoji"));
26
29
 
27
30
  var _package = _interopRequireDefault(require("../../package.json"));
28
31
 
29
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
-
31
32
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
32
33
 
33
34
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
34
35
 
36
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
+
35
38
  /**
36
39
  * Gets CLI parameters.
37
40
  *
@@ -153,6 +156,23 @@ function copyFile(source, destination) {
153
156
  function readFile(path) {
154
157
  return (0, _fsExtra.readFileSync)(path, 'utf-8');
155
158
  }
159
+ /**
160
+ * Checks if current package.json uses type "module"
161
+ *
162
+ * @return {boolean}
163
+ */
164
+
165
+
166
+ function isModule() {
167
+ const pkgPath = _path.default.resolve('./package.json');
168
+
169
+ if (exists(pkgPath)) {
170
+ const pkg = JSON.parse(readFile(pkgPath));
171
+ return pkg.type && pkg.type === 'module';
172
+ }
173
+
174
+ return false;
175
+ }
156
176
  /**
157
177
  * Writes content to file.
158
178
  *
package/lib/constants.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.defaultPostCssConfigStubFile = exports.simpleConfigStubFile = exports.defaultConfigStubFile = exports.defaultPostCssConfigFile = exports.defaultConfigFile = exports.cli = void 0;
6
+ exports.defaultPostCssConfigStubFile = exports.simpleConfigStubFile = exports.defaultConfigStubFile = exports.supportedPostCssConfigFile = exports.supportedConfigFiles = exports.cjsPostCssConfigFile = exports.cjsConfigFile = exports.defaultPostCssConfigFile = exports.defaultConfigFile = exports.cli = void 0;
7
7
 
8
8
  var _path = _interopRequireDefault(require("path"));
9
9
 
@@ -15,6 +15,14 @@ const defaultConfigFile = './tailwind.config.js';
15
15
  exports.defaultConfigFile = defaultConfigFile;
16
16
  const defaultPostCssConfigFile = './postcss.config.js';
17
17
  exports.defaultPostCssConfigFile = defaultPostCssConfigFile;
18
+ const cjsConfigFile = './tailwind.config.cjs';
19
+ exports.cjsConfigFile = cjsConfigFile;
20
+ const cjsPostCssConfigFile = './postcss.config.cjs';
21
+ exports.cjsPostCssConfigFile = cjsPostCssConfigFile;
22
+ const supportedConfigFiles = [cjsConfigFile, defaultConfigFile];
23
+ exports.supportedConfigFiles = supportedConfigFiles;
24
+ const supportedPostCssConfigFile = [cjsPostCssConfigFile, defaultPostCssConfigFile];
25
+ exports.supportedPostCssConfigFile = supportedPostCssConfigFile;
18
26
 
19
27
  const defaultConfigStubFile = _path.default.resolve(__dirname, '../stubs/defaultConfig.stub.js');
20
28
 
package/lib/index.js CHANGED
@@ -46,15 +46,17 @@ function resolveConfigPath(filePath) {
46
46
  } // require('tailwindcss')
47
47
 
48
48
 
49
- try {
50
- const defaultConfigPath = _path.default.resolve(_constants.defaultConfigFile);
49
+ for (const configFile of _constants.supportedConfigFiles) {
50
+ try {
51
+ const configPath = _path.default.resolve(configFile);
51
52
 
52
- _fs.default.accessSync(defaultConfigPath);
53
+ _fs.default.accessSync(configPath);
53
54
 
54
- return defaultConfigPath;
55
- } catch (err) {
56
- return undefined;
55
+ return configPath;
56
+ } catch (err) {}
57
57
  }
58
+
59
+ return undefined;
58
60
  }
59
61
 
60
62
  const getConfigFunction = config => () => {
@@ -48,15 +48,17 @@ function resolveConfigPath(filePath) {
48
48
  } // require('tailwindcss')
49
49
 
50
50
 
51
- try {
52
- const defaultConfigPath = _path.default.resolve(_constants.defaultConfigFile);
51
+ for (const configFile of _constants.supportedConfigFiles) {
52
+ try {
53
+ const configPath = _path.default.resolve(configFile);
53
54
 
54
- _fs.default.accessSync(defaultConfigPath);
55
+ _fs.default.accessSync(configPath);
55
56
 
56
- return defaultConfigPath;
57
- } catch (err) {
58
- return undefined;
57
+ return configPath;
58
+ } catch (err) {}
59
59
  }
60
+
61
+ return undefined;
60
62
  }
61
63
 
62
64
  const getConfigFunction = config => () => {
@@ -85,7 +85,7 @@ function validatePath(config, path, defaultValue) {
85
85
  };
86
86
  }
87
87
 
88
- if (!(typeof value === 'string' || typeof value === 'number' || value instanceof String || value instanceof Number || Array.isArray(value))) {
88
+ if (!(typeof value === 'string' || typeof value === 'number' || typeof value === 'function' || value instanceof String || value instanceof Number || Array.isArray(value))) {
89
89
  let error = `'${pathString}' was found but does not resolve to a string.`;
90
90
 
91
91
  if (_lodash.default.isObject(value)) {
@@ -324,7 +324,7 @@ function substituteClassApplyAtRules(config, getProcessedPlugins, configChanged)
324
324
 
325
325
  const generateLookupTree = configChanged || !defaultTailwindTree.has(lookupKey) ? () => {
326
326
  return (0, _postcss.default)([(0, _substituteTailwindAtRules.default)(config, getProcessedPlugins()), (0, _evaluateTailwindFunctions.default)(config), (0, _substituteVariantsAtRules.default)(config, getProcessedPlugins()), (0, _substituteResponsiveAtRules.default)(config), (0, _convertLayerAtRulesToControlComments.default)(config), (0, _substituteScreenAtRules.default)(config)]).process(requiredTailwindAtRules.map(rule => `@tailwind ${rule};`).join('\n'), {
327
- from: undefined
327
+ from: __filename
328
328
  }).then(result => {
329
329
  defaultTailwindTree.set(lookupKey, result);
330
330
  return result;
@@ -62,7 +62,7 @@ function _default(_config, {
62
62
  css.walkAtRules('tailwind', atRule => {
63
63
  if (atRule.params === 'preflight') {
64
64
  // prettier-ignore
65
- throw atRule.error("`@tailwind preflight` is not a valid at-rule in Tailwind v1.0, use `@tailwind base` instead.", {
65
+ throw atRule.error("`@tailwind preflight` is not a valid at-rule in Tailwind v2.0, use `@tailwind base` instead.", {
66
66
  word: 'preflight'
67
67
  });
68
68
  }
@@ -141,6 +141,7 @@ textarea {
141
141
 
142
142
  input::placeholder,
143
143
  textarea::placeholder {
144
+ opacity: 1;
144
145
  color: theme('colors.gray.400', #a1a1aa);
145
146
  }
146
147
 
@@ -9,6 +9,8 @@ var _fs = _interopRequireDefault(require("fs"));
9
9
 
10
10
  var _postcss = _interopRequireDefault(require("postcss"));
11
11
 
12
+ var _package = _interopRequireDefault(require("../../package.json"));
13
+
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
14
16
  function _default() {
@@ -19,6 +21,8 @@ function _default() {
19
21
 
20
22
  const preflightStyles = _postcss.default.parse(_fs.default.readFileSync(`${__dirname}/css/preflight.css`, 'utf8'));
21
23
 
22
- addBase([...normalizeStyles.nodes, ...preflightStyles.nodes]);
24
+ addBase([_postcss.default.comment({
25
+ text: `! tailwindcss v${_package.default.version} | MIT License | https://tailwindcss.com`
26
+ }), ...normalizeStyles.nodes, ...preflightStyles.nodes]);
23
27
  };
24
28
  }
@@ -14,5 +14,9 @@ function transformThemeValue(themeSection) {
14
14
  return value => Array.isArray(value) ? value.join(', ') : value;
15
15
  }
16
16
 
17
+ if (themeSection === 'colors') {
18
+ return value => typeof value === 'function' ? value({}) : value;
19
+ }
20
+
17
21
  return value => value;
18
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -37,19 +37,19 @@
37
37
  "*.js"
38
38
  ],
39
39
  "devDependencies": {
40
- "@babel/cli": "^7.11.6",
41
- "@babel/core": "^7.12.9",
42
- "@babel/node": "^7.0.0",
43
- "@babel/preset-env": "^7.0.0",
44
- "autoprefixer": "^10.0.2",
40
+ "@babel/cli": "^7.12.10",
41
+ "@babel/core": "^7.12.10",
42
+ "@babel/node": "^7.12.10",
43
+ "@babel/preset-env": "^7.12.10",
44
+ "autoprefixer": "^10.2.4",
45
45
  "babel-jest": "^26.6.3",
46
46
  "clean-css": "^4.1.9",
47
- "eslint": "^7.14.0",
48
- "eslint-config-prettier": "^6.15.0",
49
- "eslint-plugin-prettier": "^3.2.0",
47
+ "eslint": "^7.18.0",
48
+ "eslint-config-prettier": "^7.2.0",
49
+ "eslint-plugin-prettier": "^3.3.1",
50
50
  "jest": "^26.6.3",
51
- "postcss": "^8.1.10",
52
- "prettier": "^2.2.0",
51
+ "postcss": "^8.2.4",
52
+ "prettier": "^2.2.1",
53
53
  "rimraf": "^3.0.0"
54
54
  },
55
55
  "peerDependencies": {
@@ -57,25 +57,25 @@
57
57
  "postcss": "^8.0.9"
58
58
  },
59
59
  "dependencies": {
60
- "@fullhuman/postcss-purgecss": "^3.0.0",
60
+ "@fullhuman/postcss-purgecss": "^3.1.3",
61
61
  "bytes": "^3.0.0",
62
62
  "chalk": "^4.1.0",
63
63
  "color": "^3.1.3",
64
64
  "detective": "^5.2.0",
65
65
  "didyoumean": "^1.2.1",
66
- "fs-extra": "^9.0.1",
66
+ "fs-extra": "^9.1.0",
67
67
  "html-tags": "^3.1.0",
68
68
  "lodash": "^4.17.20",
69
69
  "modern-normalize": "^1.0.0",
70
70
  "node-emoji": "^1.8.1",
71
- "object-hash": "^2.0.3",
71
+ "object-hash": "^2.1.1",
72
72
  "postcss-functions": "^3",
73
73
  "postcss-js": "^3.0.3",
74
74
  "postcss-nested": "^5.0.1",
75
75
  "postcss-selector-parser": "^6.0.4",
76
76
  "postcss-value-parser": "^4.1.0",
77
77
  "pretty-hrtime": "^1.0.3",
78
- "reduce-css-calc": "^2.1.6",
78
+ "reduce-css-calc": "^2.1.8",
79
79
  "resolve": "^1.19.0"
80
80
  },
81
81
  "browserslist": [
@@ -141,6 +141,7 @@ module.exports = {
141
141
  wait: 'wait',
142
142
  text: 'text',
143
143
  move: 'move',
144
+ help: 'help',
144
145
  'not-allowed': 'not-allowed',
145
146
  },
146
147
  divideColor: (theme) => theme('borderColor'),
@@ -308,17 +309,6 @@ module.exports = {
308
309
  6: '6',
309
310
  7: '7',
310
311
  },
311
- transformOrigin: {
312
- center: 'center',
313
- top: 'top',
314
- 'top-right': 'top right',
315
- right: 'right',
316
- 'bottom-right': 'bottom right',
317
- bottom: 'bottom',
318
- 'bottom-left': 'bottom left',
319
- left: 'left',
320
- 'top-left': 'top left',
321
- },
322
312
  gridTemplateColumns: {
323
313
  none: 'none',
324
314
  1: 'repeat(1, minmax(0, 1fr))',
@@ -616,8 +606,18 @@ module.exports = {
616
606
  },
617
607
  textColor: (theme) => theme('colors'),
618
608
  textOpacity: (theme) => theme('opacity'),
619
- transitionDuration: {
620
- DEFAULT: '150ms',
609
+ transformOrigin: {
610
+ center: 'center',
611
+ top: 'top',
612
+ 'top-right': 'top right',
613
+ right: 'right',
614
+ 'bottom-right': 'bottom right',
615
+ bottom: 'bottom',
616
+ 'bottom-left': 'bottom left',
617
+ left: 'left',
618
+ 'top-left': 'top left',
619
+ },
620
+ transitionDelay: {
621
621
  75: '75ms',
622
622
  100: '100ms',
623
623
  150: '150ms',
@@ -627,7 +627,8 @@ module.exports = {
627
627
  700: '700ms',
628
628
  1000: '1000ms',
629
629
  },
630
- transitionDelay: {
630
+ transitionDuration: {
631
+ DEFAULT: '150ms',
631
632
  75: '75ms',
632
633
  100: '100ms',
633
634
  150: '150ms',
@@ -742,13 +743,13 @@ module.exports = {
742
743
  backgroundClip: ['responsive'],
743
744
  backgroundColor: ['responsive', 'dark', 'group-hover', 'focus-within', 'hover', 'focus'],
744
745
  backgroundImage: ['responsive'],
745
- backgroundOpacity: ['responsive', 'group-hover', 'focus-within', 'hover', 'focus'],
746
+ backgroundOpacity: ['responsive', 'dark', 'group-hover', 'focus-within', 'hover', 'focus'],
746
747
  backgroundPosition: ['responsive'],
747
748
  backgroundRepeat: ['responsive'],
748
749
  backgroundSize: ['responsive'],
749
750
  borderCollapse: ['responsive'],
750
751
  borderColor: ['responsive', 'dark', 'group-hover', 'focus-within', 'hover', 'focus'],
751
- borderOpacity: ['responsive', 'group-hover', 'focus-within', 'hover', 'focus'],
752
+ borderOpacity: ['responsive', 'dark', 'group-hover', 'focus-within', 'hover', 'focus'],
752
753
  borderRadius: ['responsive'],
753
754
  borderStyle: ['responsive'],
754
755
  borderWidth: ['responsive'],
@@ -759,7 +760,7 @@ module.exports = {
759
760
  cursor: ['responsive'],
760
761
  display: ['responsive'],
761
762
  divideColor: ['responsive', 'dark'],
762
- divideOpacity: ['responsive'],
763
+ divideOpacity: ['responsive', 'dark'],
763
764
  divideStyle: ['responsive'],
764
765
  divideWidth: ['responsive'],
765
766
  fill: ['responsive'],
@@ -814,14 +815,14 @@ module.exports = {
814
815
  placeItems: ['responsive'],
815
816
  placeSelf: ['responsive'],
816
817
  placeholderColor: ['responsive', 'dark', 'focus'],
817
- placeholderOpacity: ['responsive', 'focus'],
818
+ placeholderOpacity: ['responsive', 'dark', 'focus'],
818
819
  pointerEvents: ['responsive'],
819
820
  position: ['responsive'],
820
821
  resize: ['responsive'],
821
822
  ringColor: ['responsive', 'dark', 'focus-within', 'focus'],
822
823
  ringOffsetColor: ['responsive', 'dark', 'focus-within', 'focus'],
823
824
  ringOffsetWidth: ['responsive', 'focus-within', 'focus'],
824
- ringOpacity: ['responsive', 'focus-within', 'focus'],
825
+ ringOpacity: ['responsive', 'dark', 'focus-within', 'focus'],
825
826
  ringWidth: ['responsive', 'focus-within', 'focus'],
826
827
  rotate: ['responsive', 'hover', 'focus'],
827
828
  scale: ['responsive', 'hover', 'focus'],
@@ -833,7 +834,7 @@ module.exports = {
833
834
  textAlign: ['responsive'],
834
835
  textColor: ['responsive', 'dark', 'group-hover', 'focus-within', 'hover', 'focus'],
835
836
  textDecoration: ['responsive', 'group-hover', 'focus-within', 'hover', 'focus'],
836
- textOpacity: ['responsive', 'group-hover', 'focus-within', 'hover', 'focus'],
837
+ textOpacity: ['responsive', 'dark', 'group-hover', 'focus-within', 'hover', 'focus'],
837
838
  textOverflow: ['responsive'],
838
839
  textTransform: ['responsive'],
839
840
  transform: ['responsive'],