tailwindcss 0.0.0-insiders.e4a37ce → 0.0.0-insiders.e572dc6

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 (97) hide show
  1. package/README.md +1 -1
  2. package/index.css +5 -0
  3. package/lib/cli/build/index.js +3 -0
  4. package/lib/cli/build/plugin.js +54 -51
  5. package/lib/cli/index.js +1 -0
  6. package/lib/cli.js +1 -5
  7. package/lib/corePluginList.js +1 -0
  8. package/lib/corePlugins.js +28 -4
  9. package/lib/css/preflight.css +7 -1
  10. package/lib/featureFlags.js +7 -9
  11. package/lib/lib/content.js +27 -1
  12. package/lib/lib/evaluateTailwindFunctions.js +5 -3
  13. package/lib/lib/expandTailwindAtRules.js +53 -13
  14. package/lib/lib/generateRules.js +4 -7
  15. package/lib/lib/handleImportAtRules.js +50 -0
  16. package/lib/lib/normalizeTailwindDirectives.js +0 -15
  17. package/lib/lib/setupContextUtils.js +6 -16
  18. package/lib/lib/setupTrackingContext.js +2 -1
  19. package/lib/lib/sharedState.js +2 -10
  20. package/lib/plugin.js +37 -19
  21. package/lib/util/dataTypes.js +14 -6
  22. package/lib/util/log.js +17 -0
  23. package/lib/util/normalizeConfig.js +21 -9
  24. package/lib/util/pluginUtils.js +1 -3
  25. package/lib/util/validateConfig.js +11 -0
  26. package/lib/value-parser/LICENSE +22 -0
  27. package/lib/value-parser/README.md +3 -0
  28. package/lib/value-parser/index.d.js +2 -0
  29. package/lib/value-parser/index.js +22 -0
  30. package/lib/value-parser/parse.js +259 -0
  31. package/lib/value-parser/stringify.js +38 -0
  32. package/lib/value-parser/unit.js +86 -0
  33. package/lib/value-parser/walk.js +16 -0
  34. package/package.json +24 -31
  35. package/src/cli/build/index.js +4 -0
  36. package/src/cli/build/plugin.js +57 -44
  37. package/src/cli/index.js +1 -0
  38. package/src/cli.js +1 -5
  39. package/src/corePluginList.js +1 -1
  40. package/src/corePlugins.js +32 -4
  41. package/src/css/preflight.css +7 -1
  42. package/src/featureFlags.js +6 -8
  43. package/src/lib/content.js +33 -1
  44. package/src/lib/evaluateTailwindFunctions.js +4 -1
  45. package/src/lib/expandTailwindAtRules.js +58 -26
  46. package/src/lib/generateRules.js +4 -8
  47. package/src/lib/handleImportAtRules.js +34 -0
  48. package/src/lib/normalizeTailwindDirectives.js +0 -27
  49. package/src/lib/setupContextUtils.js +6 -15
  50. package/src/lib/setupTrackingContext.js +1 -3
  51. package/src/lib/sharedState.js +0 -4
  52. package/src/plugin.js +70 -53
  53. package/src/util/dataTypes.js +17 -6
  54. package/src/util/log.js +24 -0
  55. package/src/util/normalizeConfig.js +22 -10
  56. package/src/util/pluginUtils.js +0 -4
  57. package/src/util/validateConfig.js +10 -0
  58. package/src/value-parser/LICENSE +22 -0
  59. package/src/value-parser/README.md +3 -0
  60. package/src/value-parser/index.d.ts +177 -0
  61. package/src/value-parser/index.js +28 -0
  62. package/src/value-parser/parse.js +303 -0
  63. package/src/value-parser/stringify.js +41 -0
  64. package/src/value-parser/unit.js +118 -0
  65. package/src/value-parser/walk.js +18 -0
  66. package/stubs/config.full.js +14 -1
  67. package/stubs/config.simple.js +1 -1
  68. package/stubs/postcss.config.cjs +0 -1
  69. package/stubs/postcss.config.js +0 -1
  70. package/types/generated/corePluginList.d.ts +1 -1
  71. package/types/generated/default-theme.d.ts +2 -1
  72. package/lib/cli/build/deps.js +0 -62
  73. package/lib/cli-peer-dependencies.js +0 -36
  74. package/lib/oxide/cli/build/deps.js +0 -89
  75. package/lib/oxide/cli/build/index.js +0 -53
  76. package/lib/oxide/cli/build/plugin.js +0 -375
  77. package/lib/oxide/cli/build/utils.js +0 -87
  78. package/lib/oxide/cli/build/watching.js +0 -179
  79. package/lib/oxide/cli/help/index.js +0 -72
  80. package/lib/oxide/cli/index.js +0 -214
  81. package/lib/oxide/cli/init/index.js +0 -52
  82. package/lib/oxide/cli.js +0 -5
  83. package/lib/oxide/postcss-plugin.js +0 -2
  84. package/peers/index.js +0 -96419
  85. package/scripts/swap-engines.js +0 -40
  86. package/src/cli/build/deps.js +0 -56
  87. package/src/cli-peer-dependencies.js +0 -15
  88. package/src/oxide/cli/build/deps.ts +0 -91
  89. package/src/oxide/cli/build/index.ts +0 -47
  90. package/src/oxide/cli/build/plugin.ts +0 -442
  91. package/src/oxide/cli/build/utils.ts +0 -74
  92. package/src/oxide/cli/build/watching.ts +0 -225
  93. package/src/oxide/cli/help/index.ts +0 -69
  94. package/src/oxide/cli/index.ts +0 -204
  95. package/src/oxide/cli/init/index.ts +0 -59
  96. package/src/oxide/cli.ts +0 -1
  97. package/src/oxide/postcss-plugin.ts +0 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
  <p align="center">
17
- <a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci-stable.yml?branch=master" alt="Build Status"></a>
17
+ <a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=master" alt="Build Status"></a>
18
18
  <a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
19
19
  <a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
20
20
  <a href="https://github.com/tailwindcss/tailwindcss/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
package/index.css ADDED
@@ -0,0 +1,5 @@
1
+ @tailwind base;
2
+
3
+ @tailwind components;
4
+
5
+ @tailwind utilities;
@@ -34,6 +34,9 @@ async function build(args) {
34
34
  console.error(`Specified config file ${args["--config"]} does not exist.`);
35
35
  process.exit(9);
36
36
  }
37
+ if (args["--no-autoprefixer"]) {
38
+ console.error("[deprecation] The --no-autoprefixer flag is deprecated and has no effect.");
39
+ }
37
40
  // TODO: Reference the @config path here if exists
38
41
  let configPath = args["--config"] ? args["--config"] : (0, _resolveConfigPath.resolveDefaultConfigPath)();
39
42
  let processor = await (0, _plugin.createProcessor)(args, configPath);
@@ -9,16 +9,19 @@ Object.defineProperty(exports, "createProcessor", {
9
9
  return createProcessor;
10
10
  }
11
11
  });
12
+ const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../../package.json"));
12
13
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
14
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
15
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
14
16
  const _postcssloadconfig = /*#__PURE__*/ _interop_require_default(require("postcss-load-config"));
17
+ const _browserslist = /*#__PURE__*/ _interop_require_default(require("browserslist"));
18
+ const _lightningcss = /*#__PURE__*/ _interop_require_default(require("lightningcss"));
15
19
  const _lilconfig = require("lilconfig");
16
20
  const _plugins = /*#__PURE__*/ _interop_require_default(require("postcss-load-config/src/plugins" // Little bit scary, looking at private/internal API
17
21
  ));
18
22
  const _options = /*#__PURE__*/ _interop_require_default(require("postcss-load-config/src/options" // Little bit scary, looking at private/internal API
19
23
  ));
20
24
  const _processTailwindFeatures = /*#__PURE__*/ _interop_require_default(require("../../processTailwindFeatures"));
21
- const _deps = require("./deps");
22
25
  const _utils = require("./utils");
23
26
  const _sharedState = require("../../lib/sharedState");
24
27
  const _resolveConfig = /*#__PURE__*/ _interop_require_default(require("../../../resolveConfig.js"));
@@ -29,11 +32,42 @@ const _findAtConfigPath = require("../../lib/findAtConfigPath.js");
29
32
  const _log = /*#__PURE__*/ _interop_require_default(require("../../util/log"));
30
33
  const _loadconfig = require("../../lib/load-config");
31
34
  const _getModuleDependencies = /*#__PURE__*/ _interop_require_default(require("../../lib/getModuleDependencies"));
35
+ const _validateConfig = require("../../util/validateConfig");
36
+ const _handleImportAtRules = require("../../lib/handleImportAtRules");
37
+ const _featureFlags = require("../../featureFlags");
32
38
  function _interop_require_default(obj) {
33
39
  return obj && obj.__esModule ? obj : {
34
40
  default: obj
35
41
  };
36
42
  }
43
+ async function lightningcss(result, { map =true , minify =true } = {}) {
44
+ try {
45
+ let transformed = _lightningcss.default.transform({
46
+ filename: result.opts.from || "input.css",
47
+ code: Buffer.from(result.css, "utf-8"),
48
+ minify,
49
+ sourceMap: result.map === undefined ? map : !!result.map,
50
+ inputSourceMap: result.map ? result.map.toString() : undefined,
51
+ targets: _lightningcss.default.browserslistToTargets((0, _browserslist.default)(_packagejson.default.browserslist)),
52
+ drafts: {
53
+ nesting: true
54
+ }
55
+ });
56
+ return Object.assign(result, {
57
+ css: transformed.code.toString("utf8"),
58
+ map: result.map ? Object.assign(result.map, {
59
+ toString () {
60
+ var _transformed_map;
61
+ return (_transformed_map = transformed.map) === null || _transformed_map === void 0 ? void 0 : _transformed_map.toString();
62
+ }
63
+ }) : result.map
64
+ });
65
+ } catch (err) {
66
+ console.error("Unable to use Lightning CSS. Using raw version instead.");
67
+ console.error(err);
68
+ return result;
69
+ }
70
+ }
37
71
  /**
38
72
  *
39
73
  * @param {string} [customPostCssPath ]
@@ -76,43 +110,11 @@ function _interop_require_default(obj) {
76
110
  config.options
77
111
  ];
78
112
  }
79
- function loadBuiltinPostcssPlugins() {
80
- let postcss = (0, _deps.loadPostcss)();
81
- let IMPORT_COMMENT = "__TAILWIND_RESTORE_IMPORT__: ";
82
- return [
83
- [
84
- (root)=>{
85
- root.walkAtRules("import", (rule)=>{
86
- if (rule.params.slice(1).startsWith("tailwindcss/")) {
87
- rule.after(postcss.comment({
88
- text: IMPORT_COMMENT + rule.params
89
- }));
90
- rule.remove();
91
- }
92
- });
93
- },
94
- (0, _deps.loadPostcssImport)(),
95
- (root)=>{
96
- root.walkComments((rule)=>{
97
- if (rule.text.startsWith(IMPORT_COMMENT)) {
98
- rule.after(postcss.atRule({
99
- name: "import",
100
- params: rule.text.replace(IMPORT_COMMENT, "")
101
- }));
102
- rule.remove();
103
- }
104
- });
105
- }
106
- ],
107
- [],
108
- {}
109
- ];
110
- }
111
113
  let state = {
112
114
  /** @type {any} */ context: null,
113
115
  /** @type {ReturnType<typeof createWatcher> | null} */ watcher: null,
114
116
  /** @type {{content: string, extension: string}[]} */ changedContent: [],
115
- /** @type {ReturnType<typeof load> | null} */ configBag: null,
117
+ /** @type {{config: import('../../../types').Config, dependencies: Set<string>, dispose: Function } | null} */ configBag: null,
116
118
  contextDependencies: new Set(),
117
119
  /** @type {import('../../lib/content.js').ContentPath[]} */ contentPaths: [],
118
120
  refreshContentPaths () {
@@ -143,12 +145,7 @@ let state = {
143
145
  }
144
146
  }
145
147
  };
146
- // @ts-ignore
147
- this.configBag.config = (0, _resolveConfig.default)(this.configBag.config, {
148
- content: {
149
- files: []
150
- }
151
- });
148
+ this.configBag.config = (0, _validateConfig.validateConfig)((0, _resolveConfig.default)(this.configBag.config));
152
149
  // Override content files if `--content` has been passed explicitly
153
150
  if ((content === null || content === void 0 ? void 0 : content.length) > 0) {
154
151
  this.configBag.config.content.files = content;
@@ -167,7 +164,7 @@ let state = {
167
164
  // TODO: When we make the postcss plugin async-capable this can become async
168
165
  let files = _fastglob.default.sync(this.contentPatterns.all);
169
166
  for (let file of files){
170
- if (false) {
167
+ if ((0, _featureFlags.flagEnabled)(this.config, "oxideParser")) {
171
168
  content.push({
172
169
  file,
173
170
  extension: _path.default.extname(file).slice(1)
@@ -225,12 +222,16 @@ let state = {
225
222
  };
226
223
  async function createProcessor(args, cliConfigPath) {
227
224
  var _args_content;
228
- let postcss = (0, _deps.loadPostcss)();
229
225
  let input = args["--input"];
230
226
  let output = args["--output"];
231
227
  let includePostCss = args["--postcss"];
232
228
  let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
233
- let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) : loadBuiltinPostcssPlugins();
229
+ let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) : [
230
+ [],
231
+ [],
232
+ {}
233
+ ];
234
+ beforePlugins.unshift(...(0, _handleImportAtRules.handleImportAtRules)());
234
235
  if (args["--purge"]) {
235
236
  _log.default.warn("purge-flag-deprecated", [
236
237
  "The `--purge` flag has been deprecated.",
@@ -269,12 +270,10 @@ async function createProcessor(args, cliConfigPath) {
269
270
  ...beforePlugins,
270
271
  tailwindPlugin,
271
272
  !args["--minify"] && _utils.formatNodes,
272
- ...afterPlugins,
273
- !args["--no-autoprefixer"] && (0, _deps.loadAutoprefixer)(),
274
- args["--minify"] && (0, _deps.loadCssNano)()
273
+ ...afterPlugins
275
274
  ].filter(Boolean);
276
275
  /** @type {import('postcss').Processor} */ // @ts-ignore
277
- let processor = postcss(plugins);
276
+ let processor = (0, _postcss.default)(plugins);
278
277
  async function readInput() {
279
278
  // Piping in data, let's drain the stdin
280
279
  if (input === "-") {
@@ -289,10 +288,14 @@ async function createProcessor(args, cliConfigPath) {
289
288
  }
290
289
  async function build() {
291
290
  let start = process.hrtime.bigint();
292
- return readInput().then((css)=>processor.process(css, {
293
- ...postcssOptions,
294
- from: input,
295
- to: output
291
+ let options = {
292
+ ...postcssOptions,
293
+ from: input,
294
+ to: output
295
+ };
296
+ return readInput().then((css)=>processor.process(css, options)).then((result)=>lightningcss(result, {
297
+ ...options,
298
+ minify: !!args["--minify"]
296
299
  })).then((result)=>{
297
300
  if (!state.watcher) {
298
301
  return result;
package/lib/cli/index.js CHANGED
@@ -91,6 +91,7 @@ let commands = {
91
91
  description: "Path to a custom config file"
92
92
  },
93
93
  "--no-autoprefixer": {
94
+ deprecated: true,
94
95
  type: Boolean,
95
96
  description: "Disable autoprefixer"
96
97
  },
package/lib/cli.js CHANGED
@@ -1,7 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- if (false) {
4
- module.exports = require("./oxide/cli");
5
- } else {
6
- module.exports = require("./cli/index");
7
- }
3
+ module.exports = require("./cli/index");
@@ -98,6 +98,7 @@ const _default = [
98
98
  "textOverflow",
99
99
  "hyphens",
100
100
  "whitespace",
101
+ "textWrap",
101
102
  "wordBreak",
102
103
  "borderRadius",
103
104
  "borderWidth",
@@ -415,6 +415,17 @@ let variantPlugins = {
415
415
  values: (_theme = theme("supports")) !== null && _theme !== void 0 ? _theme : {}
416
416
  });
417
417
  },
418
+ hasVariants: ({ matchVariant })=>{
419
+ matchVariant("has", (value)=>`&:has(${(0, _dataTypes.normalize)(value)})`, {
420
+ values: {}
421
+ });
422
+ matchVariant("group-has", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier}):has(${(0, _dataTypes.normalize)(value)}) &` : `:merge(.group):has(${(0, _dataTypes.normalize)(value)}) &`, {
423
+ values: {}
424
+ });
425
+ matchVariant("peer-has", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier}):has(${(0, _dataTypes.normalize)(value)}) ~ &` : `:merge(.peer):has(${(0, _dataTypes.normalize)(value)}) ~ &`, {
426
+ values: {}
427
+ });
428
+ },
418
429
  ariaVariants: ({ matchVariant , theme })=>{
419
430
  var _theme;
420
431
  matchVariant("aria", (value)=>`&[aria-${(0, _dataTypes.normalize)(value)}]`, {
@@ -1935,11 +1946,11 @@ let corePlugins = {
1935
1946
  ]
1936
1947
  ]
1937
1948
  ]),
1938
- space: ({ matchUtilities , addUtilities , theme })=>{
1949
+ space: ({ matchUtilities , addUtilities , theme , config })=>{
1939
1950
  matchUtilities({
1940
1951
  "space-x": (value)=>{
1941
1952
  value = value === "0" ? "0px" : value;
1942
- if (false) {
1953
+ if ((0, _featureFlags.flagEnabled)(config(), "logicalSiblingUtilities")) {
1943
1954
  return {
1944
1955
  "& > :not([hidden]) ~ :not([hidden])": {
1945
1956
  "--tw-space-x-reverse": "0",
@@ -1979,11 +1990,11 @@ let corePlugins = {
1979
1990
  }
1980
1991
  });
1981
1992
  },
1982
- divideWidth: ({ matchUtilities , addUtilities , theme })=>{
1993
+ divideWidth: ({ matchUtilities , addUtilities , theme , config })=>{
1983
1994
  matchUtilities({
1984
1995
  "divide-x": (value)=>{
1985
1996
  value = value === "0" ? "0px" : value;
1986
- if (false) {
1997
+ if ((0, _featureFlags.flagEnabled)(config(), "logicalSiblingUtilities")) {
1987
1998
  return {
1988
1999
  "& > :not([hidden]) ~ :not([hidden])": {
1989
2000
  "@defaults border-width": {},
@@ -2293,6 +2304,19 @@ let corePlugins = {
2293
2304
  }
2294
2305
  });
2295
2306
  },
2307
+ textWrap: ({ addUtilities })=>{
2308
+ addUtilities({
2309
+ ".text-wrap": {
2310
+ "text-wrap": "wrap"
2311
+ },
2312
+ ".text-nowrap": {
2313
+ "text-wrap": "nowrap"
2314
+ },
2315
+ ".text-balance": {
2316
+ "text-wrap": "balance"
2317
+ }
2318
+ });
2319
+ },
2296
2320
  wordBreak: ({ addUtilities })=>{
2297
2321
  addUtilities({
2298
2322
  ".break-normal": {
@@ -163,6 +163,8 @@ optgroup,
163
163
  select,
164
164
  textarea {
165
165
  font-family: inherit; /* 1 */
166
+ font-feature-settings: inherit; /* 1 */
167
+ font-variation-settings: inherit; /* 1 */
166
168
  font-size: 100%; /* 1 */
167
169
  font-weight: inherit; /* 1 */
168
170
  line-height: inherit; /* 1 */
@@ -264,7 +266,7 @@ summary {
264
266
  }
265
267
 
266
268
  /*
267
- Removes the default spacing and border for appropriate elements.
269
+ Removes the default spacing for appropriate elements.
268
270
  */
269
271
 
270
272
  blockquote,
@@ -300,6 +302,10 @@ menu {
300
302
  padding: 0;
301
303
  }
302
304
 
305
+ dialog {
306
+ padding: 0;
307
+ }
308
+
303
309
  /*
304
310
  Prevent resizing textareas horizontally by default.
305
311
  */
@@ -28,24 +28,22 @@ function _interop_require_default(obj) {
28
28
  }
29
29
  let defaults = {
30
30
  optimizeUniversalDefaults: false,
31
- generalizedModifiers: true,
32
- get disableColorOpacityUtilitiesByDefault () {
33
- return false;
34
- },
35
- get relativeContentPathsByDefault () {
36
- return false;
37
- }
31
+ disableColorOpacityUtilitiesByDefault: false,
32
+ relativeContentPathsByDefault: false,
33
+ oxideParser: false,
34
+ logicalSiblingUtilities: false
38
35
  };
39
36
  let featureFlags = {
40
37
  future: [
41
38
  "hoverOnlyWhenSupported",
42
39
  "respectDefaultRingColorOpacity",
43
40
  "disableColorOpacityUtilitiesByDefault",
44
- "relativeContentPathsByDefault"
41
+ "relativeContentPathsByDefault",
42
+ "logicalSiblingUtilities"
45
43
  ],
46
44
  experimental: [
47
45
  "optimizeUniversalDefaults",
48
- "generalizedModifiers"
46
+ "oxideParser"
49
47
  ]
50
48
  };
51
49
  function flagEnabled(config, flag) {
@@ -24,13 +24,39 @@ const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
24
24
  const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
25
25
  const _parseGlob = require("../util/parseGlob");
26
26
  const _sharedState = require("./sharedState");
27
+ const _oxide = require("@tailwindcss/oxide");
27
28
  function _interop_require_default(obj) {
28
29
  return obj && obj.__esModule ? obj : {
29
30
  default: obj
30
31
  };
31
32
  }
33
+ /** @typedef {import('../../types/config.js').RawFile} RawFile */ /** @typedef {import('../../types/config.js').FilePath} FilePath */ /*
34
+ * @param {import('tailwindcss').Config} tailwindConfig
35
+ * @param {{skip:string[]}} options
36
+ * @returns {ContentPath[]}
37
+ */ function resolveContentFiles(tailwindConfig, { skip =[] } = {}) {
38
+ if (Array.isArray(tailwindConfig.content.files) && tailwindConfig.content.files.includes("auto")) {
39
+ let idx = tailwindConfig.content.files.indexOf("auto");
40
+ if (idx !== -1) {
41
+ _sharedState.env.DEBUG && console.time("Calculating resolve content paths");
42
+ let resolved = (0, _oxide.resolveContentPaths)({
43
+ base: process.cwd()
44
+ });
45
+ _sharedState.env.DEBUG && console.timeEnd("Calculating resolve content paths");
46
+ tailwindConfig.content.files.splice(idx, 1, ...resolved);
47
+ }
48
+ }
49
+ if (skip.length > 0) {
50
+ tailwindConfig.content.files = tailwindConfig.content.files.filter((filePath)=>!skip.includes(filePath));
51
+ }
52
+ return tailwindConfig.content.files;
53
+ }
32
54
  function parseCandidateFiles(context, tailwindConfig) {
33
- let files = tailwindConfig.content.files;
55
+ let files = resolveContentFiles(tailwindConfig, {
56
+ skip: [
57
+ context.userConfigPath
58
+ ]
59
+ });
34
60
  // Normalize the file globs
35
61
  files = files.filter((filePath)=>typeof filePath === "string");
36
62
  files = files.map(_normalizepath.default);
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "default", {
11
11
  const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
12
12
  const _didyoumean = /*#__PURE__*/ _interop_require_default(require("didyoumean"));
13
13
  const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
14
- const _postcssvalueparser = /*#__PURE__*/ _interop_require_default(require("postcss-value-parser"));
14
+ const _index = /*#__PURE__*/ _interop_require_default(require("../value-parser/index"));
15
15
  const _normalizeScreens = require("../util/normalizeScreens");
16
16
  const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
17
17
  const _toPath = require("../util/toPath");
@@ -121,7 +121,7 @@ function extractArgs(node, vNodes, functions) {
121
121
  if (vNode.type === "div" && vNode.value === ",") {
122
122
  args.push("");
123
123
  } else {
124
- args[args.length - 1] += _postcssvalueparser.default.stringify(vNode);
124
+ args[args.length - 1] += _index.default.stringify(vNode);
125
125
  }
126
126
  }
127
127
  return args;
@@ -135,7 +135,9 @@ function resolveVNode(node, vNode, functions) {
135
135
  return vNode;
136
136
  }
137
137
  function resolveFunctions(node, input, functions) {
138
- return (0, _postcssvalueparser.default)(input).walk((vNode)=>{
138
+ let hasAnyFn = Object.keys(functions).some((fn)=>input.includes(`${fn}(`));
139
+ if (!hasAnyFn) return input;
140
+ return (0, _index.default)(input).walk((vNode)=>{
139
141
  resolveVNode(node, vNode, functions);
140
142
  }).toString();
141
143
  }
@@ -10,11 +10,13 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
12
  const _quicklru = /*#__PURE__*/ _interop_require_default(require("@alloc/quick-lru"));
13
+ const _oxide = require("@tailwindcss/oxide");
13
14
  const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
14
15
  const _generateRules = require("./generateRules");
15
16
  const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
16
17
  const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("../util/cloneNodes"));
17
18
  const _defaultExtractor = require("./defaultExtractor");
19
+ const _featureFlags = require("../featureFlags");
18
20
  function _interop_require_default(obj) {
19
21
  return obj && obj.__esModule ? obj : {
20
22
  default: obj
@@ -69,7 +71,12 @@ const builtInTransformers = {
69
71
  };
70
72
  function getExtractor(context, fileExtension) {
71
73
  let extractors = context.tailwindConfig.content.extract;
72
- return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || builtInExtractors.DEFAULT(context);
74
+ return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || // Because we call `DEFAULT(context)`, the returning function is always a new function without a
75
+ // stable identity. Marking it with `DEFAULT_EXTRACTOR` allows us to check if it is the default
76
+ // extractor without relying on the function identity.
77
+ Object.assign(builtInExtractors.DEFAULT(context), {
78
+ DEFAULT_EXTRACTOR: true
79
+ });
73
80
  }
74
81
  function getTransformer(tailwindConfig, fileExtension) {
75
82
  let transformers = tailwindConfig.content.transform;
@@ -154,16 +161,35 @@ function expandTailwindAtRules(context) {
154
161
  ]);
155
162
  let seen = new Set();
156
163
  env.DEBUG && console.time("Reading changed files");
157
- if (false) {
158
- // TODO: Pass through or implement `extractor`
159
- for (let candidate of require("@tailwindcss/oxide").parseCandidateStringsFromFiles(context.changedContent)){
160
- candidates.add(candidate);
164
+ if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "oxideParser")) {
165
+ let rustParserContent = [];
166
+ let regexParserContent = [];
167
+ for (let item of context.changedContent){
168
+ let transformer = getTransformer(context.tailwindConfig, item.extension);
169
+ let extractor = getExtractor(context, item.extension);
170
+ if (transformer === builtInTransformers.DEFAULT && (extractor === null || extractor === void 0 ? void 0 : extractor.DEFAULT_EXTRACTOR) === true) {
171
+ rustParserContent.push(item);
172
+ } else {
173
+ regexParserContent.push([
174
+ item,
175
+ {
176
+ transformer,
177
+ extractor
178
+ }
179
+ ]);
180
+ }
181
+ }
182
+ if (rustParserContent.length > 0) {
183
+ for (let candidate of (0, _oxide.parseCandidateStrings)(rustParserContent, _oxide.IO.Parallel | _oxide.Parsing.Parallel)){
184
+ candidates.add(candidate);
185
+ }
186
+ }
187
+ if (regexParserContent.length > 0) {
188
+ for (let [{ file , content }, { transformer , extractor }] of regexParserContent){
189
+ content = file ? _fs.default.readFileSync(file, "utf8") : content;
190
+ getClassCandidates(transformer(content), extractor, candidates, seen);
191
+ }
161
192
  }
162
- // for (let { file, content, extension } of context.changedContent) {
163
- // let transformer = getTransformer(context.tailwindConfig, extension)
164
- // let extractor = getExtractor(context, extension)
165
- // getClassCandidatesOxide(file, transformer(content), extractor, candidates, seen)
166
- // }
167
193
  } else {
168
194
  for (let { file , content , extension } of context.changedContent){
169
195
  let transformer = getTransformer(context.tailwindConfig, extension);
@@ -178,7 +204,10 @@ function expandTailwindAtRules(context) {
178
204
  let classCacheCount = context.classCache.size;
179
205
  env.DEBUG && console.time("Generate rules");
180
206
  env.DEBUG && console.time("Sorting candidates");
181
- let sortedCandidates = false ? candidates : new Set([
207
+ // TODO: only sort if we are not using the oxide parser (flagEnabled(context.tailwindConfig,
208
+ // 'oxideParser')) AND if we got all the candidates form the oxideParser alone. This will not
209
+ // be the case currently if you have custom transformers / extractors.
210
+ let sortedCandidates = new Set([
182
211
  ...candidates
183
212
  ].sort((a, z)=>{
184
213
  if (a === z) return 0;
@@ -242,9 +271,20 @@ function expandTailwindAtRules(context) {
242
271
  }));
243
272
  layerNodes.variants.remove();
244
273
  } else if (variantNodes.length > 0) {
245
- root.append((0, _cloneNodes.default)(variantNodes, root.source, {
274
+ let cloned = (0, _cloneNodes.default)(variantNodes, undefined, {
246
275
  layer: "variants"
247
- }));
276
+ });
277
+ cloned.forEach((node)=>{
278
+ var _node_raws_tailwind;
279
+ var _node_raws_tailwind_parentLayer;
280
+ let parentLayer = (_node_raws_tailwind_parentLayer = (_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer) !== null && _node_raws_tailwind_parentLayer !== void 0 ? _node_raws_tailwind_parentLayer : null;
281
+ node.walk((n)=>{
282
+ if (!n.source) {
283
+ n.source = layerNodes[parentLayer].source;
284
+ }
285
+ });
286
+ });
287
+ root.append(cloned);
248
288
  }
249
289
  // If we've got a utility layer and no utilities are generated there's likely something wrong
250
290
  const hasUtilityVariants = variantNodes.some((node)=>{
@@ -215,9 +215,6 @@ function applyVariant(variant, matches, context) {
215
215
  if (modifiers.length && !context.variantMap.has(variant)) {
216
216
  variant = baseVariant;
217
217
  args.modifier = modifiers[0];
218
- if (!(0, _featureFlags.flagEnabled)(context.tailwindConfig, "generalizedModifiers")) {
219
- return [];
220
- }
221
218
  }
222
219
  }
223
220
  // Retrieve "arbitrary value"
@@ -231,12 +228,12 @@ function applyVariant(variant, matches, context) {
231
228
  // group[:hover] (`-` is missing)
232
229
  let match = /(.)(-?)\[(.*)\]/g.exec(variant);
233
230
  if (match) {
234
- let [, char, seperator, value] = match;
231
+ let [, char, separator, value] = match;
235
232
  // @-[200px] case
236
- if (char === "@" && seperator === "-") return [];
233
+ if (char === "@" && separator === "-") return [];
237
234
  // group[:hover] case
238
- if (char !== "@" && seperator === "") return [];
239
- variant = variant.replace(`${seperator}[${value}]`, "");
235
+ if (char !== "@" && separator === "") return [];
236
+ variant = variant.replace(`${separator}[${value}]`, "");
240
237
  args.value = value;
241
238
  }
242
239
  }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "handleImportAtRules", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return handleImportAtRules;
9
+ }
10
+ });
11
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
12
+ const _postcssimport = /*#__PURE__*/ _interop_require_default(require("postcss-import"));
13
+ function _interop_require_default(obj) {
14
+ return obj && obj.__esModule ? obj : {
15
+ default: obj
16
+ };
17
+ }
18
+ const TAILWIND = Symbol();
19
+ function handleImportAtRules() {
20
+ let RESTORE_ATRULE_COMMENT = "__TAILWIND_RESTORE__";
21
+ let atRulesToRestore = [
22
+ "tailwind",
23
+ "config"
24
+ ];
25
+ return [
26
+ (root)=>{
27
+ root.walkAtRules((rule)=>{
28
+ if (!atRulesToRestore.includes(rule.name)) return rule;
29
+ rule.after(_postcss.default.comment({
30
+ text: RESTORE_ATRULE_COMMENT,
31
+ raws: {
32
+ [TAILWIND]: {
33
+ rule
34
+ }
35
+ }
36
+ }));
37
+ rule.remove();
38
+ });
39
+ },
40
+ (0, _postcssimport.default)(),
41
+ (root)=>{
42
+ root.walkComments((rule)=>{
43
+ if (rule.text === RESTORE_ATRULE_COMMENT) {
44
+ rule.after(rule.raws[TAILWIND].rule);
45
+ rule.remove();
46
+ }
47
+ });
48
+ }
49
+ ];
50
+ }
@@ -22,21 +22,6 @@ function normalizeTailwindDirectives(root) {
22
22
  if (atRule.name === "apply") {
23
23
  applyDirectives.add(atRule);
24
24
  }
25
- if (atRule.name === "import") {
26
- if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
27
- atRule.name = "tailwind";
28
- atRule.params = "base";
29
- } else if (atRule.params === '"tailwindcss/components"' || atRule.params === "'tailwindcss/components'") {
30
- atRule.name = "tailwind";
31
- atRule.params = "components";
32
- } else if (atRule.params === '"tailwindcss/utilities"' || atRule.params === "'tailwindcss/utilities'") {
33
- atRule.name = "tailwind";
34
- atRule.params = "utilities";
35
- } else if (atRule.params === '"tailwindcss/screens"' || atRule.params === "'tailwindcss/screens'" || atRule.params === '"tailwindcss/variants"' || atRule.params === "'tailwindcss/variants'") {
36
- atRule.name = "tailwind";
37
- atRule.params = "variants";
38
- }
39
- }
40
25
  if (atRule.name === "tailwind") {
41
26
  if (atRule.params === "screens") {
42
27
  atRule.params = "variants";