tailwindcss 0.0.0-insiders.c65a1a2 → 0.0.0-insiders.c8c4852
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/CHANGELOG.md +54 -3
- package/lib/cli.js +60 -60
- package/lib/corePlugins.js +66 -60
- package/lib/featureFlags.js +2 -4
- package/lib/index.js +1 -2
- package/lib/lib/cacheInvalidation.js +32 -14
- package/lib/lib/collapseAdjacentRules.js +1 -2
- package/lib/lib/defaultExtractor.js +85 -49
- package/lib/lib/evaluateTailwindFunctions.js +18 -14
- package/lib/lib/expandApplyAtRules.js +11 -26
- package/lib/lib/expandTailwindAtRules.js +36 -22
- package/lib/lib/generateRules.js +60 -45
- package/lib/lib/regex.js +1 -2
- package/lib/lib/resolveDefaultsAtRules.js +56 -45
- package/lib/lib/setupContextUtils.js +49 -46
- package/lib/lib/setupTrackingContext.js +4 -9
- package/lib/lib/sharedState.js +1 -2
- package/lib/lib/substituteScreenAtRules.js +1 -2
- package/lib/postcss-plugins/nesting/plugin.js +1 -2
- package/lib/util/buildMediaQuery.js +1 -2
- package/lib/util/cloneDeep.js +2 -4
- package/lib/util/color.js +5 -10
- package/lib/util/createPlugin.js +1 -2
- package/lib/util/createUtilityPlugin.js +1 -2
- package/lib/util/dataTypes.js +8 -15
- package/lib/util/flattenColorPalette.js +2 -5
- package/lib/util/formatVariantSelector.js +1 -2
- package/lib/util/getAllConfigs.js +2 -5
- package/lib/util/isValidArbitraryValue.js +1 -2
- package/lib/util/log.js +2 -3
- package/lib/util/negateValue.js +1 -2
- package/lib/util/normalizeConfig.js +33 -16
- package/lib/util/normalizeScreens.js +1 -2
- package/lib/util/parseAnimationValue.js +1 -2
- package/lib/util/pluginUtils.js +11 -3
- package/lib/util/removeAlphaVariables.js +18 -0
- package/lib/util/resolveConfig.js +10 -37
- package/lib/util/splitAtTopLevelOnly.js +32 -14
- package/lib/util/withAlphaVariable.js +5 -5
- package/package.json +12 -12
- package/peers/index.js +286 -123
- package/src/cli.js +48 -28
- package/src/corePlugins.js +23 -16
- package/src/lib/defaultExtractor.js +43 -33
- package/src/lib/evaluateTailwindFunctions.js +16 -6
- package/src/lib/generateRules.js +18 -10
- package/src/lib/resolveDefaultsAtRules.js +53 -36
- package/src/lib/setupContextUtils.js +5 -2
- package/src/util/dataTypes.js +3 -5
- package/src/util/log.js +1 -1
- package/src/util/pluginUtils.js +13 -1
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +5 -33
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/defaultConfig.stub.js +1 -0
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +7 -6
- package/types/index.d.ts +7 -1
- package/types.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,50 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Fixed
|
|
11
11
|
|
|
12
|
+
- Allows fallback values in plugin API helpers ([#8762](https://github.com/tailwindlabs/tailwindcss/pull/8762))
|
|
13
|
+
- Fix usage of postcss.config.js in standalone CLI ([#8769](https://github.com/tailwindlabs/tailwindcss/pull/8769))
|
|
14
|
+
|
|
15
|
+
## [3.1.4] - 2022-06-21
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Provide default to `<alpha-value>` when using `theme()` ([#8652](https://github.com/tailwindlabs/tailwindcss/pull/8652))
|
|
20
|
+
- Detect arbitrary variants with quotes ([#8687](https://github.com/tailwindlabs/tailwindcss/pull/8687))
|
|
21
|
+
- Don’t add spaces around raw `/` that are preceded by numbers ([#8688](https://github.com/tailwindlabs/tailwindcss/pull/8688))
|
|
22
|
+
|
|
23
|
+
## [3.1.3] - 2022-06-14
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- Fix extraction of multi-word utilities with arbitrary values and quotes ([#8604](https://github.com/tailwindlabs/tailwindcss/pull/8604))
|
|
28
|
+
- Fix casing of import of `corePluginList` type definition ([#8587](https://github.com/tailwindlabs/tailwindcss/pull/8587))
|
|
29
|
+
- Ignore PostCSS nodes returned by `addVariant` ([#8608](https://github.com/tailwindlabs/tailwindcss/pull/8608))
|
|
30
|
+
- Fix missing spaces around arithmetic operators ([#8615](https://github.com/tailwindlabs/tailwindcss/pull/8615))
|
|
31
|
+
- Detect alpha value in CSS `theme()` function when using quotes ([#8625](https://github.com/tailwindlabs/tailwindcss/pull/8625))
|
|
32
|
+
- Fix "Maximum call stack size exceeded" bug ([#8636](https://github.com/tailwindlabs/tailwindcss/pull/8636))
|
|
33
|
+
- Allow functions returning parallel variants to mutate the container ([#8622](https://github.com/tailwindlabs/tailwindcss/pull/8622))
|
|
34
|
+
- Remove text opacity CSS variables from `::marker` ([#8622](https://github.com/tailwindlabs/tailwindcss/pull/8622))
|
|
35
|
+
|
|
36
|
+
## [3.1.2] - 2022-06-10
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- Ensure `\` is a valid arbitrary variant token ([#8576](https://github.com/tailwindlabs/tailwindcss/pull/8576))
|
|
41
|
+
- Enable `postcss-import` in the CLI by default in watch mode ([#8574](https://github.com/tailwindlabs/tailwindcss/pull/8574), [#8580](https://github.com/tailwindlabs/tailwindcss/pull/8580))
|
|
42
|
+
|
|
43
|
+
## [3.1.1] - 2022-06-09
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- Fix candidate extractor regression ([#8558](https://github.com/tailwindlabs/tailwindcss/pull/8558))
|
|
48
|
+
- Split `::backdrop` into separate defaults group ([#8567](https://github.com/tailwindlabs/tailwindcss/pull/8567))
|
|
49
|
+
- Fix postcss plugin type ([#8564](https://github.com/tailwindlabs/tailwindcss/pull/8564))
|
|
50
|
+
- Fix class detection in markdown code fences and slim templates ([#8569](https://github.com/tailwindlabs/tailwindcss/pull/8569))
|
|
51
|
+
|
|
52
|
+
## [3.1.0] - 2022-06-08
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
12
56
|
- Types: allow for arbitrary theme values (for 3rd party plugins) ([#7926](https://github.com/tailwindlabs/tailwindcss/pull/7926))
|
|
13
57
|
- Don’t split vars with numbers in them inside arbitrary values ([#8091](https://github.com/tailwindlabs/tailwindcss/pull/8091))
|
|
14
58
|
- Require matching prefix when detecting negatives ([#8121](https://github.com/tailwindlabs/tailwindcss/pull/8121))
|
|
@@ -29,6 +73,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
29
73
|
- Try using local `postcss` installation first in the CLI ([#8270](https://github.com/tailwindlabs/tailwindcss/pull/8270))
|
|
30
74
|
- Allow default ring color to be a function ([#7587](https://github.com/tailwindlabs/tailwindcss/pull/7587))
|
|
31
75
|
- Don't inherit `to` value from parent gradients ([#8489](https://github.com/tailwindlabs/tailwindcss/pull/8489))
|
|
76
|
+
- Remove process dependency from log functions ([#8530](https://github.com/tailwindlabs/tailwindcss/pull/8530))
|
|
77
|
+
- Ensure we can use `@import 'tailwindcss/...'` without node_modules ([#8537](https://github.com/tailwindlabs/tailwindcss/pull/8537))
|
|
32
78
|
|
|
33
79
|
### Changed
|
|
34
80
|
|
|
@@ -37,7 +83,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
37
83
|
|
|
38
84
|
### Added
|
|
39
85
|
|
|
40
|
-
- Add `rgb` and `hsl` color helpers for CSS variables ([#7665](https://github.com/tailwindlabs/tailwindcss/pull/7665))
|
|
41
86
|
- Support PostCSS `Document` nodes ([#7291](https://github.com/tailwindlabs/tailwindcss/pull/7291))
|
|
42
87
|
- Add `text-start` and `text-end` utilities ([#6656](https://github.com/tailwindlabs/tailwindcss/pull/6656))
|
|
43
88
|
- Support customizing class name when using `darkMode: 'class'` ([#5800](https://github.com/tailwindlabs/tailwindcss/pull/5800))
|
|
@@ -45,7 +90,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
45
90
|
- Add new `border-spacing` utilities ([#7102](https://github.com/tailwindlabs/tailwindcss/pull/7102))
|
|
46
91
|
- Add `enabled` variant ([#7905](https://github.com/tailwindlabs/tailwindcss/pull/7905))
|
|
47
92
|
- Add TypeScript types for the `tailwind.config.js` file ([#7891](https://github.com/tailwindlabs/tailwindcss/pull/7891))
|
|
48
|
-
- Add `backdrop` variant ([#7924](https://github.com/tailwindlabs/tailwindcss/pull/7924))
|
|
93
|
+
- Add `backdrop` variant ([#7924](https://github.com/tailwindlabs/tailwindcss/pull/7924), [#8526](https://github.com/tailwindlabs/tailwindcss/pull/8526))
|
|
49
94
|
- Add `grid-flow-dense` utility ([#8193](https://github.com/tailwindlabs/tailwindcss/pull/8193))
|
|
50
95
|
- Add `mix-blend-plus-lighter` utility ([#8288](https://github.com/tailwindlabs/tailwindcss/pull/8288))
|
|
51
96
|
- Add arbitrary variants ([#8299](https://github.com/tailwindlabs/tailwindcss/pull/8299))
|
|
@@ -54,6 +99,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
54
99
|
- Add opacity support when referencing colors with `theme` function ([#8416](https://github.com/tailwindlabs/tailwindcss/pull/8416))
|
|
55
100
|
- Add `postcss-import` support to the CLI ([#8437](https://github.com/tailwindlabs/tailwindcss/pull/8437))
|
|
56
101
|
- Add `optional` variant ([#8486](https://github.com/tailwindlabs/tailwindcss/pull/8486))
|
|
102
|
+
- Add `<alpha-value>` placeholder support for custom colors ([#8501](https://github.com/tailwindlabs/tailwindcss/pull/8501))
|
|
57
103
|
|
|
58
104
|
## [3.0.24] - 2022-04-12
|
|
59
105
|
|
|
@@ -1946,7 +1992,12 @@ No release notes
|
|
|
1946
1992
|
|
|
1947
1993
|
- Everything!
|
|
1948
1994
|
|
|
1949
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.
|
|
1995
|
+
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.4...HEAD
|
|
1996
|
+
[3.1.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.3...v3.1.4
|
|
1997
|
+
[3.1.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.2...v3.1.3
|
|
1998
|
+
[3.1.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.1...v3.1.2
|
|
1999
|
+
[3.1.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.0...v3.1.1
|
|
2000
|
+
[3.1.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.24...v3.1.0
|
|
1950
2001
|
[3.0.24]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.23...v3.0.24
|
|
1951
2002
|
[3.0.23]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.22...v3.0.23
|
|
1952
2003
|
[3.0.22]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.21...v3.0.22
|
package/lib/cli.js
CHANGED
|
@@ -72,10 +72,8 @@ function drainStdin() {
|
|
|
72
72
|
process.stdin.on("data", (chunk)=>{
|
|
73
73
|
result += chunk;
|
|
74
74
|
});
|
|
75
|
-
process.stdin.on("end", ()=>resolve(result)
|
|
76
|
-
);
|
|
77
|
-
process.stdin.on("error", (err)=>reject(err)
|
|
78
|
-
);
|
|
75
|
+
process.stdin.on("end", ()=>resolve(result));
|
|
76
|
+
process.stdin.on("error", (err)=>reject(err));
|
|
79
77
|
});
|
|
80
78
|
}
|
|
81
79
|
function help({ message , usage , commands: commands1 , options }) {
|
|
@@ -166,10 +164,6 @@ let commands = {
|
|
|
166
164
|
type: Boolean,
|
|
167
165
|
description: `Initialize a \`${configs.postcss}\` file`
|
|
168
166
|
},
|
|
169
|
-
"--types": {
|
|
170
|
-
type: Boolean,
|
|
171
|
-
description: `Add TypeScript types for the \`${configs.tailwind}\` file`
|
|
172
|
-
},
|
|
173
167
|
"-f": "--full",
|
|
174
168
|
"-p": "--postcss"
|
|
175
169
|
}
|
|
@@ -233,16 +227,13 @@ let sharedFlags = {
|
|
|
233
227
|
},
|
|
234
228
|
"-h": "--help"
|
|
235
229
|
};
|
|
236
|
-
if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined
|
|
237
|
-
))) {
|
|
230
|
+
if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
|
|
238
231
|
help({
|
|
239
232
|
usage: [
|
|
240
233
|
"tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
|
|
241
|
-
"tailwindcss init [--full] [--postcss] [
|
|
234
|
+
"tailwindcss init [--full] [--postcss] [options...]",
|
|
242
235
|
],
|
|
243
|
-
commands: Object.keys(commands).filter((command2)=>command2 !== "build"
|
|
244
|
-
).map((command3)=>`${command3} [options]`
|
|
245
|
-
),
|
|
236
|
+
commands: Object.keys(commands).filter((command2)=>command2 !== "build").map((command3)=>`${command3} [options]`),
|
|
246
237
|
options: {
|
|
247
238
|
...commands.build.args,
|
|
248
239
|
...sharedFlags
|
|
@@ -250,8 +241,7 @@ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.
|
|
|
250
241
|
});
|
|
251
242
|
process.exit(0);
|
|
252
243
|
}
|
|
253
|
-
let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg
|
|
254
|
-
)(process.argv[2]) || "build";
|
|
244
|
+
let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
|
|
255
245
|
if (commands[command] === undefined) {
|
|
256
246
|
if (_fs.default.existsSync(_path.default.resolve(command))) {
|
|
257
247
|
// TODO: Deprecate this in future versions
|
|
@@ -263,9 +253,7 @@ if (commands[command] === undefined) {
|
|
|
263
253
|
usage: [
|
|
264
254
|
"tailwindcss <command> [options]"
|
|
265
255
|
],
|
|
266
|
-
commands: Object.keys(commands).filter((command4)=>command4 !== "build"
|
|
267
|
-
).map((command5)=>`${command5} [options]`
|
|
268
|
-
),
|
|
256
|
+
commands: Object.keys(commands).filter((command4)=>command4 !== "build").map((command5)=>`${command5} [options]`),
|
|
269
257
|
options: sharedFlags
|
|
270
258
|
});
|
|
271
259
|
process.exit(1);
|
|
@@ -284,8 +272,7 @@ let args = (()=>{
|
|
|
284
272
|
}).map(([key, value])=>[
|
|
285
273
|
key,
|
|
286
274
|
typeof value === "object" ? value.type : value
|
|
287
|
-
]
|
|
288
|
-
)), {
|
|
275
|
+
])), {
|
|
289
276
|
permissive: true
|
|
290
277
|
});
|
|
291
278
|
// Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
|
|
@@ -357,10 +344,6 @@ function init() {
|
|
|
357
344
|
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
|
|
358
345
|
} else {
|
|
359
346
|
let stubFile = _fs.default.readFileSync(args["--full"] ? _path.default.resolve(__dirname, "../stubs/defaultConfig.stub.js") : _path.default.resolve(__dirname, "../stubs/simpleConfig.stub.js"), "utf8");
|
|
360
|
-
if (args["--types"]) {
|
|
361
|
-
let typesHeading = "/** @type {import('tailwindcss/types').Config} */";
|
|
362
|
-
stubFile = stubFile.replace(`module.exports = `, `${typesHeading}\nconst config = `) + "\nmodule.exports = config";
|
|
363
|
-
}
|
|
364
347
|
// Change colors import
|
|
365
348
|
stubFile = stubFile.replace("../colors", "tailwindcss/colors");
|
|
366
349
|
_fs.default.writeFileSync(tailwindConfigLocation, stubFile, "utf8");
|
|
@@ -406,8 +389,7 @@ async function build() {
|
|
|
406
389
|
console.error(`Specified config file ${args["--config"]} does not exist.`);
|
|
407
390
|
process.exit(9);
|
|
408
391
|
}
|
|
409
|
-
let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null
|
|
410
|
-
)(_path.default.resolve(`./${configs.tailwind}`));
|
|
392
|
+
let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null)(_path.default.resolve(`./${configs.tailwind}`));
|
|
411
393
|
async function loadPostCssPlugins() {
|
|
412
394
|
let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
|
|
413
395
|
let config1 = customPostCssPath ? await (async ()=>{
|
|
@@ -446,6 +428,43 @@ async function build() {
|
|
|
446
428
|
config1.options
|
|
447
429
|
];
|
|
448
430
|
}
|
|
431
|
+
function loadBuiltinPostcssPlugins() {
|
|
432
|
+
let postcss = loadPostcss();
|
|
433
|
+
let IMPORT_COMMENT = "__TAILWIND_RESTORE_IMPORT__: ";
|
|
434
|
+
return [
|
|
435
|
+
[
|
|
436
|
+
(root)=>{
|
|
437
|
+
root.walkAtRules("import", (rule)=>{
|
|
438
|
+
if (rule.params.slice(1).startsWith("tailwindcss/")) {
|
|
439
|
+
rule.after(postcss.comment({
|
|
440
|
+
text: IMPORT_COMMENT + rule.params
|
|
441
|
+
}));
|
|
442
|
+
rule.remove();
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
},
|
|
446
|
+
(()=>{
|
|
447
|
+
try {
|
|
448
|
+
return require("postcss-import");
|
|
449
|
+
} catch {}
|
|
450
|
+
return (0, _indexJs).lazyPostcssImport();
|
|
451
|
+
})(),
|
|
452
|
+
(root)=>{
|
|
453
|
+
root.walkComments((rule)=>{
|
|
454
|
+
if (rule.text.startsWith(IMPORT_COMMENT)) {
|
|
455
|
+
rule.after(postcss.atRule({
|
|
456
|
+
name: "import",
|
|
457
|
+
params: rule.text.replace(IMPORT_COMMENT, "")
|
|
458
|
+
}));
|
|
459
|
+
rule.remove();
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
},
|
|
463
|
+
],
|
|
464
|
+
[],
|
|
465
|
+
{},
|
|
466
|
+
];
|
|
467
|
+
}
|
|
449
468
|
function resolveConfig() {
|
|
450
469
|
let config = configPath ? require(configPath) : {};
|
|
451
470
|
if (args["--purge"]) {
|
|
@@ -478,8 +497,7 @@ async function build() {
|
|
|
478
497
|
// like an object it's probably a raw content object. But this object
|
|
479
498
|
// is not watchable, so let's remove it.
|
|
480
499
|
return typeof file === "string";
|
|
481
|
-
}).map((glob)=>(0, _normalizePath).default(glob)
|
|
482
|
-
);
|
|
500
|
+
}).map((glob)=>(0, _normalizePath).default(glob));
|
|
483
501
|
}
|
|
484
502
|
function extractRawContent(config) {
|
|
485
503
|
return config.content.files.filter((file)=>{
|
|
@@ -522,18 +540,7 @@ async function build() {
|
|
|
522
540
|
};
|
|
523
541
|
};
|
|
524
542
|
tailwindPlugin.postcss = true;
|
|
525
|
-
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins() :
|
|
526
|
-
[
|
|
527
|
-
(()=>{
|
|
528
|
-
try {
|
|
529
|
-
return require("postcss-import");
|
|
530
|
-
} catch {}
|
|
531
|
-
return (0, _indexJs).lazyPostcssImport();
|
|
532
|
-
})(),
|
|
533
|
-
],
|
|
534
|
-
[],
|
|
535
|
-
{},
|
|
536
|
-
];
|
|
543
|
+
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins() : loadBuiltinPostcssPlugins();
|
|
537
544
|
let plugins = [
|
|
538
545
|
...beforePlugins,
|
|
539
546
|
tailwindPlugin,
|
|
@@ -568,13 +575,11 @@ async function build() {
|
|
|
568
575
|
let start = process.hrtime.bigint();
|
|
569
576
|
return Promise.resolve().then(()=>output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
|
|
570
577
|
recursive: true
|
|
571
|
-
}) : null
|
|
572
|
-
).then(()=>processor.process(css, {
|
|
578
|
+
}) : null).then(()=>processor.process(css, {
|
|
573
579
|
...postcssOptions,
|
|
574
580
|
from: input,
|
|
575
581
|
to: output
|
|
576
|
-
})
|
|
577
|
-
).then((result)=>{
|
|
582
|
+
})).then((result)=>{
|
|
578
583
|
if (!output) {
|
|
579
584
|
return process.stdout.write(result.css);
|
|
580
585
|
}
|
|
@@ -585,7 +590,7 @@ async function build() {
|
|
|
585
590
|
}).then(()=>{
|
|
586
591
|
let end = process.hrtime.bigint();
|
|
587
592
|
console.error();
|
|
588
|
-
console.error("Done in", (end - start) / BigInt(
|
|
593
|
+
console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
|
|
589
594
|
});
|
|
590
595
|
}
|
|
591
596
|
let css1 = await (()=>{
|
|
@@ -614,8 +619,7 @@ async function build() {
|
|
|
614
619
|
delete require.cache[require.resolve(file1)];
|
|
615
620
|
}
|
|
616
621
|
if (configPath) {
|
|
617
|
-
configDependencies = (0, _getModuleDependencies).default(configPath).map(({ file })=>file
|
|
618
|
-
);
|
|
622
|
+
configDependencies = (0, _getModuleDependencies).default(configPath).map(({ file })=>file);
|
|
619
623
|
for (let dependency of configDependencies){
|
|
620
624
|
contextDependencies.add(dependency);
|
|
621
625
|
}
|
|
@@ -623,10 +627,7 @@ async function build() {
|
|
|
623
627
|
env.DEBUG && console.timeEnd("Module dependencies");
|
|
624
628
|
return resolveConfig();
|
|
625
629
|
}
|
|
626
|
-
let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() :
|
|
627
|
-
[],
|
|
628
|
-
[]
|
|
629
|
-
];
|
|
630
|
+
let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() : loadBuiltinPostcssPlugins();
|
|
630
631
|
let plugins = [
|
|
631
632
|
...beforePlugins,
|
|
632
633
|
"__TAILWIND_PLUGIN_POSITION__",
|
|
@@ -690,12 +691,10 @@ async function build() {
|
|
|
690
691
|
let start = process.hrtime.bigint();
|
|
691
692
|
return Promise.resolve().then(()=>output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
|
|
692
693
|
recursive: true
|
|
693
|
-
}) : null
|
|
694
|
-
).then(()=>processor.process(css, {
|
|
694
|
+
}) : null).then(()=>processor.process(css, {
|
|
695
695
|
from: input,
|
|
696
696
|
to: output
|
|
697
|
-
})
|
|
698
|
-
).then(async (result)=>{
|
|
697
|
+
})).then(async (result)=>{
|
|
699
698
|
for (let message of result.messages){
|
|
700
699
|
if (message.type === "dependency") {
|
|
701
700
|
contextDependencies.add(message.file);
|
|
@@ -713,7 +712,7 @@ async function build() {
|
|
|
713
712
|
].filter(Boolean));
|
|
714
713
|
}).then(()=>{
|
|
715
714
|
let end = process.hrtime.bigint();
|
|
716
|
-
console.error("Done in", (end - start) / BigInt(
|
|
715
|
+
console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
|
|
717
716
|
}).catch((err)=>{
|
|
718
717
|
if (err.name === "CssSyntaxError") {
|
|
719
718
|
console.error(err.toString());
|
|
@@ -795,9 +794,10 @@ async function build() {
|
|
|
795
794
|
});
|
|
796
795
|
}
|
|
797
796
|
if (shouldWatch) {
|
|
798
|
-
/* Abort the watcher if stdin is closed to avoid zombie processes */ process.stdin.
|
|
799
|
-
|
|
800
|
-
|
|
797
|
+
/* Abort the watcher if stdin is closed to avoid zombie processes */ if (process.stdin.isTTY) {
|
|
798
|
+
process.stdin.on("end", ()=>process.exit(0));
|
|
799
|
+
process.stdin.resume();
|
|
800
|
+
}
|
|
801
801
|
startWatcher();
|
|
802
802
|
} else {
|
|
803
803
|
buildOnce();
|
package/lib/corePlugins.js
CHANGED
|
@@ -19,40 +19,69 @@ var _packageJson = require("../package.json");
|
|
|
19
19
|
var _log = _interopRequireDefault(require("./util/log"));
|
|
20
20
|
var _normalizeScreens = require("./util/normalizeScreens");
|
|
21
21
|
var _parseBoxShadowValue = require("./util/parseBoxShadowValue");
|
|
22
|
+
var _removeAlphaVariables = require("./util/removeAlphaVariables");
|
|
22
23
|
var _featureFlags = require("./featureFlags");
|
|
23
24
|
function _interopRequireDefault(obj) {
|
|
24
25
|
return obj && obj.__esModule ? obj : {
|
|
25
26
|
default: obj
|
|
26
27
|
};
|
|
27
28
|
}
|
|
29
|
+
function _getRequireWildcardCache() {
|
|
30
|
+
if (typeof WeakMap !== "function") return null;
|
|
31
|
+
var cache = new WeakMap();
|
|
32
|
+
_getRequireWildcardCache = function() {
|
|
33
|
+
return cache;
|
|
34
|
+
};
|
|
35
|
+
return cache;
|
|
36
|
+
}
|
|
28
37
|
function _interopRequireWildcard(obj) {
|
|
29
38
|
if (obj && obj.__esModule) {
|
|
30
39
|
return obj;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
}
|
|
41
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
42
|
+
return {
|
|
43
|
+
default: obj
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
var cache = _getRequireWildcardCache();
|
|
47
|
+
if (cache && cache.has(obj)) {
|
|
48
|
+
return cache.get(obj);
|
|
49
|
+
}
|
|
50
|
+
var newObj = {};
|
|
51
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
52
|
+
for(var key in obj){
|
|
53
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
54
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
55
|
+
if (desc && (desc.get || desc.set)) {
|
|
56
|
+
Object.defineProperty(newObj, key, desc);
|
|
57
|
+
} else {
|
|
58
|
+
newObj[key] = obj[key];
|
|
43
59
|
}
|
|
44
60
|
}
|
|
45
|
-
newObj.default = obj;
|
|
46
|
-
return newObj;
|
|
47
61
|
}
|
|
62
|
+
newObj.default = obj;
|
|
63
|
+
if (cache) {
|
|
64
|
+
cache.set(obj, newObj);
|
|
65
|
+
}
|
|
66
|
+
return newObj;
|
|
48
67
|
}
|
|
49
68
|
let variantPlugins = {
|
|
50
69
|
pseudoElementVariants: ({ addVariant })=>{
|
|
51
70
|
addVariant("first-letter", "&::first-letter");
|
|
52
71
|
addVariant("first-line", "&::first-line");
|
|
53
72
|
addVariant("marker", [
|
|
54
|
-
|
|
55
|
-
|
|
73
|
+
({ container })=>{
|
|
74
|
+
(0, _removeAlphaVariables).removeAlphaVariables(container, [
|
|
75
|
+
"--tw-text-opacity"
|
|
76
|
+
]);
|
|
77
|
+
return "& *::marker";
|
|
78
|
+
},
|
|
79
|
+
({ container })=>{
|
|
80
|
+
(0, _removeAlphaVariables).removeAlphaVariables(container, [
|
|
81
|
+
"--tw-text-opacity"
|
|
82
|
+
]);
|
|
83
|
+
return "&::marker";
|
|
84
|
+
},
|
|
56
85
|
]);
|
|
57
86
|
addVariant("selection", [
|
|
58
87
|
"& *::selection",
|
|
@@ -122,22 +151,11 @@ let variantPlugins = {
|
|
|
122
151
|
[
|
|
123
152
|
"visited",
|
|
124
153
|
({ container })=>{
|
|
125
|
-
|
|
154
|
+
(0, _removeAlphaVariables).removeAlphaVariables(container, [
|
|
126
155
|
"--tw-text-opacity",
|
|
127
156
|
"--tw-border-opacity",
|
|
128
|
-
"--tw-bg-opacity"
|
|
129
|
-
];
|
|
130
|
-
container.walkDecls((decl)=>{
|
|
131
|
-
if (toRemove.includes(decl.prop)) {
|
|
132
|
-
decl.remove();
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
for (const varName of toRemove){
|
|
136
|
-
if (decl.value.includes(`/ var(${varName})`)) {
|
|
137
|
-
decl.value = decl.value.replace(`/ var(${varName})`, "");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
});
|
|
157
|
+
"--tw-bg-opacity",
|
|
158
|
+
]);
|
|
141
159
|
return "&:visited";
|
|
142
160
|
},
|
|
143
161
|
],
|
|
@@ -175,8 +193,7 @@ let variantPlugins = {
|
|
|
175
193
|
].map((variant)=>Array.isArray(variant) ? variant : [
|
|
176
194
|
variant,
|
|
177
195
|
`&:${variant}`
|
|
178
|
-
]
|
|
179
|
-
);
|
|
196
|
+
]);
|
|
180
197
|
for (let [variantName, state] of pseudoVariants){
|
|
181
198
|
addVariant(variantName, (ctx)=>{
|
|
182
199
|
let result = typeof state === "function" ? state(ctx) : state;
|
|
@@ -293,10 +310,7 @@ let corePlugins = {
|
|
|
293
310
|
},
|
|
294
311
|
container: (()=>{
|
|
295
312
|
function extractMinWidths(breakpoints = []) {
|
|
296
|
-
return breakpoints.flatMap((breakpoint1)=>breakpoint1.values.map((breakpoint)=>breakpoint.min
|
|
297
|
-
)
|
|
298
|
-
).filter((v)=>v !== undefined
|
|
299
|
-
);
|
|
313
|
+
return breakpoints.flatMap((breakpoint1)=>breakpoint1.values.map((breakpoint)=>breakpoint.min)).filter((v)=>v !== undefined);
|
|
300
314
|
}
|
|
301
315
|
function mapMinWidthsToPadding(minWidths, screens, paddings) {
|
|
302
316
|
if (typeof paddings === "undefined") {
|
|
@@ -338,8 +352,7 @@ let corePlugins = {
|
|
|
338
352
|
let minWidths = extractMinWidths(screens);
|
|
339
353
|
let paddings = mapMinWidthsToPadding(minWidths, screens, theme("container.padding"));
|
|
340
354
|
let generatePaddingFor = (minWidth)=>{
|
|
341
|
-
let paddingConfig = paddings.find((padding)=>padding.minWidth === minWidth
|
|
342
|
-
);
|
|
355
|
+
let paddingConfig = paddings.find((padding)=>padding.minWidth === minWidth);
|
|
343
356
|
if (!paddingConfig) {
|
|
344
357
|
return {};
|
|
345
358
|
}
|
|
@@ -348,16 +361,14 @@ let corePlugins = {
|
|
|
348
361
|
paddingLeft: paddingConfig.padding
|
|
349
362
|
};
|
|
350
363
|
};
|
|
351
|
-
let atRules = Array.from(new Set(minWidths.slice().sort((a, z)=>parseInt(a) - parseInt(z)
|
|
352
|
-
))).map((minWidth)=>({
|
|
364
|
+
let atRules = Array.from(new Set(minWidths.slice().sort((a, z)=>parseInt(a) - parseInt(z)))).map((minWidth)=>({
|
|
353
365
|
[`@media (min-width: ${minWidth})`]: {
|
|
354
366
|
".container": {
|
|
355
367
|
"max-width": minWidth,
|
|
356
368
|
...generatePaddingFor(minWidth)
|
|
357
369
|
}
|
|
358
370
|
}
|
|
359
|
-
})
|
|
360
|
-
);
|
|
371
|
+
}));
|
|
361
372
|
addComponents([
|
|
362
373
|
{
|
|
363
374
|
".container": Object.assign({
|
|
@@ -1034,8 +1045,7 @@ let corePlugins = {
|
|
|
1034
1045
|
});
|
|
1035
1046
|
},
|
|
1036
1047
|
animation: ({ matchUtilities , theme , config })=>{
|
|
1037
|
-
let prefixName = (name)=>`${config("prefix")}${(0, _escapeClassName).default(name)}
|
|
1038
|
-
;
|
|
1048
|
+
let prefixName = (name)=>`${config("prefix")}${(0, _escapeClassName).default(name)}`;
|
|
1039
1049
|
var ref;
|
|
1040
1050
|
let keyframes = Object.fromEntries(Object.entries((ref = theme("keyframes")) !== null && ref !== void 0 ? ref : {}).map(([key, value])=>{
|
|
1041
1051
|
return [
|
|
@@ -1049,8 +1059,7 @@ let corePlugins = {
|
|
|
1049
1059
|
animate: (value1)=>{
|
|
1050
1060
|
let animations = (0, _parseAnimationValue).default(value1);
|
|
1051
1061
|
return [
|
|
1052
|
-
...animations.flatMap((animation)=>keyframes[animation.name]
|
|
1053
|
-
),
|
|
1062
|
+
...animations.flatMap((animation)=>keyframes[animation.name]),
|
|
1054
1063
|
{
|
|
1055
1064
|
animation: animations.map(({ name , value })=>{
|
|
1056
1065
|
if (name === undefined || keyframes[name] === undefined) {
|
|
@@ -1750,8 +1759,7 @@ let corePlugins = {
|
|
|
1750
1759
|
};
|
|
1751
1760
|
}
|
|
1752
1761
|
}, {
|
|
1753
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
1754
|
-
)((0, _flattenColorPalette).default(theme("divideColor"))),
|
|
1762
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("divideColor"))),
|
|
1755
1763
|
type: "color"
|
|
1756
1764
|
});
|
|
1757
1765
|
},
|
|
@@ -2153,8 +2161,7 @@ let corePlugins = {
|
|
|
2153
2161
|
});
|
|
2154
2162
|
}
|
|
2155
2163
|
}, {
|
|
2156
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
2157
|
-
)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2164
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2158
2165
|
type: [
|
|
2159
2166
|
"color"
|
|
2160
2167
|
]
|
|
@@ -2193,8 +2200,7 @@ let corePlugins = {
|
|
|
2193
2200
|
});
|
|
2194
2201
|
}
|
|
2195
2202
|
}, {
|
|
2196
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
2197
|
-
)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2203
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2198
2204
|
type: "color"
|
|
2199
2205
|
});
|
|
2200
2206
|
matchUtilities({
|
|
@@ -2247,8 +2253,7 @@ let corePlugins = {
|
|
|
2247
2253
|
});
|
|
2248
2254
|
}
|
|
2249
2255
|
}, {
|
|
2250
|
-
values: (({ DEFAULT: _ , ...colors })=>colors
|
|
2251
|
-
)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2256
|
+
values: (({ DEFAULT: _ , ...colors })=>colors)((0, _flattenColorPalette).default(theme("borderColor"))),
|
|
2252
2257
|
type: "color"
|
|
2253
2258
|
});
|
|
2254
2259
|
},
|
|
@@ -3207,12 +3212,15 @@ let corePlugins = {
|
|
|
3207
3212
|
},
|
|
3208
3213
|
ringWidth: ({ matchUtilities , addDefaults , addUtilities , theme , config })=>{
|
|
3209
3214
|
let ringColorDefault = (()=>{
|
|
3210
|
-
var ref;
|
|
3215
|
+
var ref, ref1;
|
|
3211
3216
|
if ((0, _featureFlags).flagEnabled(config(), "respectDefaultRingColorOpacity")) {
|
|
3212
3217
|
return theme("ringColor.DEFAULT");
|
|
3213
3218
|
}
|
|
3214
3219
|
let ringOpacityDefault = theme("ringOpacity.DEFAULT", "0.5");
|
|
3215
|
-
|
|
3220
|
+
if (!((ref = theme("ringColor")) === null || ref === void 0 ? void 0 : ref.DEFAULT)) {
|
|
3221
|
+
return `rgb(147 197 253 / ${ringOpacityDefault})`;
|
|
3222
|
+
}
|
|
3223
|
+
return (0, _withAlphaVariable).withAlphaValue((ref1 = theme("ringColor")) === null || ref1 === void 0 ? void 0 : ref1.DEFAULT, ringOpacityDefault, `rgb(147 197 253 / ${ringOpacityDefault})`);
|
|
3216
3224
|
})();
|
|
3217
3225
|
addDefaults("ring-width", {
|
|
3218
3226
|
"--tw-ring-inset": " ",
|
|
@@ -3263,8 +3271,7 @@ let corePlugins = {
|
|
|
3263
3271
|
});
|
|
3264
3272
|
}
|
|
3265
3273
|
}, {
|
|
3266
|
-
values: Object.fromEntries(Object.entries((0, _flattenColorPalette).default(theme("ringColor"))).filter(([modifier])=>modifier !== "DEFAULT"
|
|
3267
|
-
)),
|
|
3274
|
+
values: Object.fromEntries(Object.entries((0, _flattenColorPalette).default(theme("ringColor"))).filter(([modifier])=>modifier !== "DEFAULT")),
|
|
3268
3275
|
type: "color"
|
|
3269
3276
|
});
|
|
3270
3277
|
},
|
|
@@ -3346,8 +3353,7 @@ let corePlugins = {
|
|
|
3346
3353
|
matchUtilities({
|
|
3347
3354
|
"drop-shadow": (value)=>{
|
|
3348
3355
|
return {
|
|
3349
|
-
"--tw-drop-shadow": Array.isArray(value) ? value.map((v)=>`drop-shadow(${v})`
|
|
3350
|
-
).join(" ") : `drop-shadow(${value})`,
|
|
3356
|
+
"--tw-drop-shadow": Array.isArray(value) ? value.map((v)=>`drop-shadow(${v})`).join(" ") : `drop-shadow(${value})`,
|
|
3351
3357
|
"@defaults filter": {},
|
|
3352
3358
|
filter: cssFilterValue
|
|
3353
3359
|
};
|
package/lib/featureFlags.js
CHANGED
|
@@ -43,16 +43,14 @@ function experimentalFlagsEnabled(config) {
|
|
|
43
43
|
return featureFlags.experimental;
|
|
44
44
|
}
|
|
45
45
|
var ref;
|
|
46
|
-
return Object.keys((ref = config === null || config === void 0 ? void 0 : config.experimental) !== null && ref !== void 0 ? ref : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]
|
|
47
|
-
);
|
|
46
|
+
return Object.keys((ref = config === null || config === void 0 ? void 0 : config.experimental) !== null && ref !== void 0 ? ref : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]);
|
|
48
47
|
}
|
|
49
48
|
function issueFlagNotices(config) {
|
|
50
49
|
if (process.env.JEST_WORKER_ID !== undefined) {
|
|
51
50
|
return;
|
|
52
51
|
}
|
|
53
52
|
if (experimentalFlagsEnabled(config).length > 0) {
|
|
54
|
-
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)
|
|
55
|
-
).join(", ");
|
|
53
|
+
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(", ");
|
|
56
54
|
_log.default.warn("experimental-flags-enabled", [
|
|
57
55
|
`You have enabled experimental features: ${changes}`,
|
|
58
56
|
"Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time.",
|
package/lib/index.js
CHANGED
|
@@ -19,8 +19,7 @@ module.exports = function tailwindcss(configOrPath) {
|
|
|
19
19
|
function(root, result) {
|
|
20
20
|
let context = (0, _setupTrackingContext).default(configOrPath);
|
|
21
21
|
if (root.type === "document") {
|
|
22
|
-
let roots = root.nodes.filter((node)=>node.type === "root"
|
|
23
|
-
);
|
|
22
|
+
let roots = root.nodes.filter((node)=>node.type === "root");
|
|
24
23
|
for (const root1 of roots){
|
|
25
24
|
if (root1.type === "root") {
|
|
26
25
|
(0, _processTailwindFeatures).default(context)(root1, result);
|