tailwindcss 0.0.0-insiders.bd970d0 → 0.0.0-insiders.bda8421
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/README.md +1 -2
- package/lib/cli/build/deps.js +62 -0
- package/lib/cli/build/index.js +12 -15
- package/lib/cli/build/plugin.js +107 -167
- package/lib/cli/build/utils.js +13 -13
- package/lib/cli/build/watching.js +10 -10
- package/lib/cli/help/index.js +11 -11
- package/lib/cli/index.js +60 -61
- package/lib/cli/init/index.js +16 -16
- package/lib/cli-peer-dependencies.js +36 -0
- package/lib/cli.js +1 -1
- package/lib/corePluginList.js +4 -1
- package/lib/corePlugins.js +2018 -1905
- package/lib/css/preflight.css +18 -12
- package/lib/featureFlags.js +17 -23
- package/lib/index.js +1 -1
- package/lib/lib/cacheInvalidation.js +3 -3
- package/lib/lib/collapseAdjacentRules.js +6 -6
- package/lib/lib/collapseDuplicateDeclarations.js +1 -1
- package/lib/lib/content.js +39 -32
- package/lib/lib/defaultExtractor.js +40 -17
- package/lib/lib/evaluateTailwindFunctions.js +23 -23
- package/lib/lib/expandApplyAtRules.js +37 -18
- package/lib/lib/expandTailwindAtRules.js +49 -85
- package/lib/lib/findAtConfigPath.js +5 -5
- package/lib/lib/generateRules.js +82 -55
- package/lib/lib/getModuleDependencies.js +23 -23
- package/lib/lib/load-config.js +21 -6
- package/lib/lib/normalizeTailwindDirectives.js +36 -21
- package/lib/lib/offsets.js +97 -48
- package/lib/lib/partitionApplyAtRules.js +2 -2
- package/lib/lib/regex.js +5 -5
- package/lib/lib/resolveDefaultsAtRules.js +27 -25
- package/lib/lib/setupContextUtils.js +195 -167
- package/lib/lib/setupTrackingContext.js +4 -5
- package/lib/lib/sharedState.js +10 -10
- package/lib/lib/substituteScreenAtRules.js +4 -4
- package/lib/plugin.js +8 -124
- package/lib/postcss-plugins/nesting/index.js +2 -2
- package/lib/postcss-plugins/nesting/plugin.js +11 -11
- package/lib/processTailwindFeatures.js +3 -5
- package/lib/public/colors.js +264 -264
- package/lib/util/applyImportantSelector.js +2 -2
- package/lib/util/buildMediaQuery.js +2 -2
- package/lib/util/cloneDeep.js +1 -1
- package/lib/util/cloneNodes.js +33 -13
- package/lib/util/color.js +19 -19
- package/lib/util/createUtilityPlugin.js +3 -3
- package/lib/util/dataTypes.js +170 -113
- package/lib/util/defaults.js +4 -4
- package/lib/util/escapeClassName.js +2 -2
- package/lib/util/escapeCommas.js +1 -1
- package/lib/util/flattenColorPalette.js +2 -2
- package/lib/util/formatVariantSelector.js +24 -19
- package/lib/util/getAllConfigs.js +4 -5
- package/lib/util/isKeyframeRule.js +1 -1
- package/lib/util/isPlainObject.js +2 -2
- package/lib/util/isSyntacticallyValidPropertyValue.js +10 -10
- package/lib/util/log.js +6 -23
- package/lib/util/nameClass.js +4 -4
- package/lib/util/negateValue.js +8 -8
- package/lib/util/normalizeConfig.js +63 -94
- package/lib/util/normalizeScreens.js +18 -18
- package/lib/util/parseAnimationValue.js +38 -38
- package/lib/util/parseBoxShadowValue.js +18 -18
- package/lib/util/parseDependency.js +4 -4
- package/lib/util/parseGlob.js +4 -4
- package/lib/util/parseObjectStyles.js +1 -1
- package/lib/util/pluginUtils.js +36 -21
- package/lib/util/prefixSelector.js +4 -4
- package/lib/util/pseudoElements.js +72 -69
- package/lib/util/removeAlphaVariables.js +1 -1
- package/lib/util/resolveConfig.js +11 -15
- package/lib/util/resolveConfigPath.js +6 -6
- package/lib/util/responsive.js +1 -1
- package/lib/util/splitAtTopLevelOnly.js +3 -3
- package/lib/util/toColorValue.js +1 -1
- package/lib/util/toPath.js +2 -2
- package/lib/util/transformThemeValue.js +24 -24
- package/lib/util/validateConfig.js +9 -20
- package/lib/util/validateFormalSyntax.js +5 -5
- package/lib/util/withAlphaVariable.js +5 -5
- package/lib/value-parser/index.js +5 -5
- package/lib/value-parser/parse.js +43 -43
- package/lib/value-parser/stringify.js +11 -11
- package/lib/value-parser/unit.js +5 -5
- package/lib/value-parser/walk.js +1 -1
- package/nesting/index.d.ts +4 -0
- package/package.json +41 -36
- package/peers/index.js +96503 -0
- package/resolveConfig.d.ts +22 -3
- package/scripts/generate-types.js +1 -2
- package/scripts/release-notes.js +1 -1
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +0 -4
- package/src/cli/build/plugin.js +53 -85
- package/src/cli/build/watching.js +1 -1
- package/src/cli/index.js +0 -1
- package/src/cli-peer-dependencies.js +15 -0
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +118 -31
- package/src/css/preflight.css +18 -12
- package/src/featureFlags.js +3 -5
- package/src/lib/content.js +39 -30
- package/src/lib/defaultExtractor.js +29 -6
- package/src/lib/expandApplyAtRules.js +24 -0
- package/src/lib/expandTailwindAtRules.js +19 -56
- package/src/lib/generateRules.js +39 -8
- package/src/lib/load-config.ts +13 -0
- package/src/lib/normalizeTailwindDirectives.js +27 -0
- package/src/lib/offsets.js +62 -3
- package/src/lib/resolveDefaultsAtRules.js +5 -1
- package/src/lib/setupContextUtils.js +79 -39
- package/src/plugin.js +0 -86
- package/src/processTailwindFeatures.js +0 -3
- package/src/util/cloneNodes.js +35 -14
- package/src/util/dataTypes.js +72 -6
- package/src/util/formatVariantSelector.js +7 -0
- package/src/util/isPlainObject.js +1 -1
- package/src/util/log.js +0 -24
- package/src/util/normalizeConfig.js +11 -38
- package/src/util/pluginUtils.js +20 -0
- package/src/util/pseudoElements.js +4 -0
- package/src/util/validateConfig.js +0 -10
- package/stubs/config.full.js +68 -8
- package/stubs/config.simple.js +1 -1
- package/stubs/postcss.config.cjs +1 -0
- package/stubs/postcss.config.js +1 -0
- package/types/config.d.ts +12 -5
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +28 -9
- package/types/index.d.ts +7 -3
- package/index.css +0 -5
- package/lib/lib/detectNesting.js +0 -45
- package/lib/lib/handleImportAtRules.js +0 -50
- package/src/lib/detectNesting.js +0 -47
- package/src/lib/handleImportAtRules.js +0 -34
|
@@ -42,7 +42,6 @@ function getCandidateFiles(context, tailwindConfig) {
|
|
|
42
42
|
}
|
|
43
43
|
// Get the config object based on a path
|
|
44
44
|
function getTailwindConfig(configOrPath) {
|
|
45
|
-
var _configOrPath;
|
|
46
45
|
let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
|
|
47
46
|
if (userConfigPath !== null) {
|
|
48
47
|
let [prevConfig, prevConfigHash, prevDeps, prevModified] = configPathCache.get(userConfigPath) || [];
|
|
@@ -86,7 +85,7 @@ function getTailwindConfig(configOrPath) {
|
|
|
86
85
|
}
|
|
87
86
|
var _configOrPath_config, _ref;
|
|
88
87
|
// It's a plain object, not a path
|
|
89
|
-
let newConfig = (0, _resolveconfig.default)((_ref = (_configOrPath_config =
|
|
88
|
+
let newConfig = (0, _resolveconfig.default)((_ref = (_configOrPath_config = configOrPath === null || configOrPath === void 0 ? void 0 : configOrPath.config) !== null && _configOrPath_config !== void 0 ? _configOrPath_config : configOrPath) !== null && _ref !== void 0 ? _ref : {});
|
|
90
89
|
newConfig = (0, _validateConfig.validateConfig)(newConfig);
|
|
91
90
|
return [
|
|
92
91
|
newConfig,
|
|
@@ -96,7 +95,7 @@ function getTailwindConfig(configOrPath) {
|
|
|
96
95
|
];
|
|
97
96
|
}
|
|
98
97
|
function setupTrackingContext(configOrPath) {
|
|
99
|
-
return ({ tailwindDirectives, registerDependency
|
|
98
|
+
return ({ tailwindDirectives , registerDependency })=>{
|
|
100
99
|
return (root, result)=>{
|
|
101
100
|
let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
|
|
102
101
|
let contextDependencies = new Set(configDependencies);
|
|
@@ -111,7 +110,7 @@ function setupTrackingContext(configOrPath) {
|
|
|
111
110
|
contextDependencies.add(result.opts.from);
|
|
112
111
|
// Add all css @import dependencies as context dependencies.
|
|
113
112
|
for (let message of result.messages){
|
|
114
|
-
if (message.type ===
|
|
113
|
+
if (message.type === "dependency") {
|
|
115
114
|
contextDependencies.add(message.file);
|
|
116
115
|
}
|
|
117
116
|
}
|
|
@@ -151,7 +150,7 @@ function setupTrackingContext(configOrPath) {
|
|
|
151
150
|
}
|
|
152
151
|
for (let file of configDependencies){
|
|
153
152
|
registerDependency({
|
|
154
|
-
type:
|
|
153
|
+
type: "dependency",
|
|
155
154
|
file
|
|
156
155
|
});
|
|
157
156
|
}
|
package/lib/lib/sharedState.js
CHANGED
|
@@ -34,28 +34,28 @@ _export(exports, {
|
|
|
34
34
|
return resolveDebug;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
const env = typeof process !==
|
|
37
|
+
const env = typeof process !== "undefined" ? {
|
|
38
38
|
NODE_ENV: process.env.NODE_ENV,
|
|
39
39
|
DEBUG: resolveDebug(process.env.DEBUG)
|
|
40
40
|
} : {
|
|
41
|
-
NODE_ENV:
|
|
41
|
+
NODE_ENV: "production",
|
|
42
42
|
DEBUG: false
|
|
43
43
|
};
|
|
44
44
|
const contextMap = new Map();
|
|
45
45
|
const configContextMap = new Map();
|
|
46
46
|
const contextSourcesMap = new Map();
|
|
47
47
|
const sourceHashMap = new Map();
|
|
48
|
-
const NOT_ON_DEMAND = new String(
|
|
49
|
-
const NONE = Symbol(
|
|
48
|
+
const NOT_ON_DEMAND = new String("*");
|
|
49
|
+
const NONE = Symbol("__NONE__");
|
|
50
50
|
function resolveDebug(debug) {
|
|
51
51
|
if (debug === undefined) {
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
54
|
// Environment variables are strings, so convert to boolean
|
|
55
|
-
if (debug ===
|
|
55
|
+
if (debug === "true" || debug === "1") {
|
|
56
56
|
return true;
|
|
57
57
|
}
|
|
58
|
-
if (debug ===
|
|
58
|
+
if (debug === "false" || debug === "0") {
|
|
59
59
|
return false;
|
|
60
60
|
}
|
|
61
61
|
// Keep the debug convention into account:
|
|
@@ -63,16 +63,16 @@ function resolveDebug(debug) {
|
|
|
63
63
|
// DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC
|
|
64
64
|
// DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types)
|
|
65
65
|
// DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB
|
|
66
|
-
if (debug ===
|
|
66
|
+
if (debug === "*") {
|
|
67
67
|
return true;
|
|
68
68
|
}
|
|
69
|
-
let debuggers = debug.split(
|
|
69
|
+
let debuggers = debug.split(",").map((d)=>d.split(":")[0]);
|
|
70
70
|
// Ignoring tailwindcss
|
|
71
|
-
if (debuggers.includes(
|
|
71
|
+
if (debuggers.includes("-tailwindcss")) {
|
|
72
72
|
return false;
|
|
73
73
|
}
|
|
74
74
|
// Including tailwindcss
|
|
75
|
-
if (debuggers.includes(
|
|
75
|
+
if (debuggers.includes("tailwindcss")) {
|
|
76
76
|
return true;
|
|
77
77
|
}
|
|
78
78
|
return false;
|
|
@@ -15,16 +15,16 @@ function _interop_require_default(obj) {
|
|
|
15
15
|
default: obj
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function _default({ tailwindConfig: { theme
|
|
18
|
+
function _default({ tailwindConfig: { theme } }) {
|
|
19
19
|
return function(css) {
|
|
20
|
-
css.walkAtRules(
|
|
20
|
+
css.walkAtRules("screen", (atRule)=>{
|
|
21
21
|
let screen = atRule.params;
|
|
22
22
|
let screens = (0, _normalizeScreens.normalizeScreens)(theme.screens);
|
|
23
|
-
let screenDefinition = screens.find(({ name
|
|
23
|
+
let screenDefinition = screens.find(({ name })=>name === screen);
|
|
24
24
|
if (!screenDefinition) {
|
|
25
25
|
throw atRule.error(`No \`${screen}\` screen found.`);
|
|
26
26
|
}
|
|
27
|
-
atRule.name =
|
|
27
|
+
atRule.name = "media";
|
|
28
28
|
atRule.params = (0, _buildMediaQuery.default)(screenDefinition);
|
|
29
29
|
});
|
|
30
30
|
};
|
package/lib/plugin.js
CHANGED
|
@@ -2,82 +2,34 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
6
|
-
const _lightningcss = /*#__PURE__*/ _interop_require_wildcard(require("lightningcss"));
|
|
7
|
-
const _browserslist = /*#__PURE__*/ _interop_require_default(require("browserslist"));
|
|
8
5
|
const _setupTrackingContext = /*#__PURE__*/ _interop_require_default(require("./lib/setupTrackingContext"));
|
|
9
6
|
const _processTailwindFeatures = /*#__PURE__*/ _interop_require_default(require("./processTailwindFeatures"));
|
|
10
7
|
const _sharedState = require("./lib/sharedState");
|
|
11
8
|
const _findAtConfigPath = require("./lib/findAtConfigPath");
|
|
12
|
-
const _handleImportAtRules = require("./lib/handleImportAtRules");
|
|
13
|
-
const _packagejson = require("../package.json");
|
|
14
9
|
function _interop_require_default(obj) {
|
|
15
10
|
return obj && obj.__esModule ? obj : {
|
|
16
11
|
default: obj
|
|
17
12
|
};
|
|
18
13
|
}
|
|
19
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
20
|
-
if (typeof WeakMap !== "function") return null;
|
|
21
|
-
var cacheBabelInterop = new WeakMap();
|
|
22
|
-
var cacheNodeInterop = new WeakMap();
|
|
23
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
24
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
25
|
-
})(nodeInterop);
|
|
26
|
-
}
|
|
27
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
28
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
29
|
-
return obj;
|
|
30
|
-
}
|
|
31
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
32
|
-
return {
|
|
33
|
-
default: obj
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
37
|
-
if (cache && cache.has(obj)) {
|
|
38
|
-
return cache.get(obj);
|
|
39
|
-
}
|
|
40
|
-
var newObj = {};
|
|
41
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
42
|
-
for(var key in obj){
|
|
43
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
44
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
45
|
-
if (desc && (desc.get || desc.set)) {
|
|
46
|
-
Object.defineProperty(newObj, key, desc);
|
|
47
|
-
} else {
|
|
48
|
-
newObj[key] = obj[key];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
newObj.default = obj;
|
|
53
|
-
if (cache) {
|
|
54
|
-
cache.set(obj, newObj);
|
|
55
|
-
}
|
|
56
|
-
return newObj;
|
|
57
|
-
}
|
|
58
|
-
function license() {
|
|
59
|
-
return `/* ! tailwindcss v${_packagejson.version} | MIT License | https://tailwindcss.com */\n`;
|
|
60
|
-
}
|
|
61
14
|
module.exports = function tailwindcss(configOrPath) {
|
|
62
15
|
return {
|
|
63
|
-
postcssPlugin:
|
|
16
|
+
postcssPlugin: "tailwindcss",
|
|
64
17
|
plugins: [
|
|
65
18
|
_sharedState.env.DEBUG && function(root) {
|
|
66
|
-
console.log(
|
|
67
|
-
console.time(
|
|
19
|
+
console.log("\n");
|
|
20
|
+
console.time("JIT TOTAL");
|
|
68
21
|
return root;
|
|
69
22
|
},
|
|
70
|
-
...(0, _handleImportAtRules.handleImportAtRules)(),
|
|
71
23
|
async function(root, result) {
|
|
72
24
|
var _findAtConfigPath1;
|
|
73
25
|
// Use the path for the `@config` directive if it exists, otherwise use the
|
|
74
26
|
// path for the file being processed
|
|
75
27
|
configOrPath = (_findAtConfigPath1 = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && _findAtConfigPath1 !== void 0 ? _findAtConfigPath1 : configOrPath;
|
|
76
28
|
let context = (0, _setupTrackingContext.default)(configOrPath);
|
|
77
|
-
if (root.type ===
|
|
78
|
-
let roots = root.nodes.filter((node)=>node.type ===
|
|
29
|
+
if (root.type === "document") {
|
|
30
|
+
let roots = root.nodes.filter((node)=>node.type === "root");
|
|
79
31
|
for (const root of roots){
|
|
80
|
-
if (root.type ===
|
|
32
|
+
if (root.type === "root") {
|
|
81
33
|
await (0, _processTailwindFeatures.default)(context)(root, result);
|
|
82
34
|
}
|
|
83
35
|
}
|
|
@@ -85,77 +37,9 @@ module.exports = function tailwindcss(configOrPath) {
|
|
|
85
37
|
}
|
|
86
38
|
await (0, _processTailwindFeatures.default)(context)(root, result);
|
|
87
39
|
},
|
|
88
|
-
function lightningCssPlugin(_root, result) {
|
|
89
|
-
var _intermediateResult_map_toJSON, _intermediateResult_map;
|
|
90
|
-
var _result_map;
|
|
91
|
-
let map = (_result_map = result.map) !== null && _result_map !== void 0 ? _result_map : result.opts.map;
|
|
92
|
-
let intermediateResult = result.root.toResult({
|
|
93
|
-
map: map ? {
|
|
94
|
-
inline: true
|
|
95
|
-
} : false
|
|
96
|
-
});
|
|
97
|
-
var _intermediateResult_map_toJSON1;
|
|
98
|
-
let intermediateMap = (_intermediateResult_map_toJSON1 = (_intermediateResult_map = intermediateResult.map) === null || _intermediateResult_map === void 0 ? void 0 : (_intermediateResult_map_toJSON = _intermediateResult_map.toJSON) === null || _intermediateResult_map_toJSON === void 0 ? void 0 : _intermediateResult_map_toJSON.call(_intermediateResult_map)) !== null && _intermediateResult_map_toJSON1 !== void 0 ? _intermediateResult_map_toJSON1 : map;
|
|
99
|
-
try {
|
|
100
|
-
var _browserslist_findConfig;
|
|
101
|
-
var _result_opts_from;
|
|
102
|
-
let resolvedBrowsersListConfig = (_browserslist_findConfig = _browserslist.default.findConfig((_result_opts_from = result.opts.from) !== null && _result_opts_from !== void 0 ? _result_opts_from : process.cwd())) === null || _browserslist_findConfig === void 0 ? void 0 : _browserslist_findConfig.defaults;
|
|
103
|
-
let defaultBrowsersListConfig = require('../package.json').browserslist;
|
|
104
|
-
let browsersListConfig = resolvedBrowsersListConfig !== null && resolvedBrowsersListConfig !== void 0 ? resolvedBrowsersListConfig : defaultBrowsersListConfig;
|
|
105
|
-
let transformed = _lightningcss.default.transform({
|
|
106
|
-
filename: result.opts.from,
|
|
107
|
-
code: Buffer.from(intermediateResult.css),
|
|
108
|
-
minify: false,
|
|
109
|
-
sourceMap: !!intermediateMap,
|
|
110
|
-
targets: _lightningcss.default.browserslistToTargets((0, _browserslist.default)(browsersListConfig)),
|
|
111
|
-
drafts: {
|
|
112
|
-
nesting: true,
|
|
113
|
-
customMedia: true
|
|
114
|
-
},
|
|
115
|
-
nonStandard: {
|
|
116
|
-
deepSelectorCombinator: true
|
|
117
|
-
},
|
|
118
|
-
include: _lightningcss.Features.Nesting,
|
|
119
|
-
exclude: _lightningcss.Features.LogicalProperties
|
|
120
|
-
});
|
|
121
|
-
let code = transformed.code.toString();
|
|
122
|
-
// https://postcss.org/api/#sourcemapoptions
|
|
123
|
-
if (intermediateMap && transformed.map != null) {
|
|
124
|
-
let prev = transformed.map.toString();
|
|
125
|
-
if (typeof intermediateMap === 'object') {
|
|
126
|
-
intermediateMap.prev = prev;
|
|
127
|
-
} else {
|
|
128
|
-
code = `${code}\n/*# sourceMappingURL=data:application/json;base64,${Buffer.from(prev).toString('base64')} */`;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
result.root = _postcss.default.parse(license() + code, {
|
|
132
|
-
...result.opts,
|
|
133
|
-
map: intermediateMap
|
|
134
|
-
});
|
|
135
|
-
} catch (err) {
|
|
136
|
-
if (err.source && typeof process !== 'undefined' && process.env.JEST_WORKER_ID) {
|
|
137
|
-
let lines = err.source.split('\n');
|
|
138
|
-
err = new Error([
|
|
139
|
-
'Error formatting using Lightning CSS:',
|
|
140
|
-
'',
|
|
141
|
-
...[
|
|
142
|
-
'```css',
|
|
143
|
-
...lines.slice(Math.max(err.loc.line - 3, 0), err.loc.line),
|
|
144
|
-
' '.repeat(err.loc.column - 1) + '^-- ' + err.toString(),
|
|
145
|
-
...lines.slice(err.loc.line, err.loc.line + 2),
|
|
146
|
-
'```'
|
|
147
|
-
]
|
|
148
|
-
].join('\n'));
|
|
149
|
-
}
|
|
150
|
-
if (Error.captureStackTrace) {
|
|
151
|
-
Error.captureStackTrace(err, lightningCssPlugin);
|
|
152
|
-
}
|
|
153
|
-
throw err;
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
40
|
_sharedState.env.DEBUG && function(root) {
|
|
157
|
-
console.timeEnd(
|
|
158
|
-
console.log(
|
|
41
|
+
console.timeEnd("JIT TOTAL");
|
|
42
|
+
console.log("\n");
|
|
159
43
|
return root;
|
|
160
44
|
}
|
|
161
45
|
].filter(Boolean)
|
|
@@ -11,8 +11,8 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
const _plugin = require("./plugin");
|
|
12
12
|
const _default = Object.assign(function(opts) {
|
|
13
13
|
return {
|
|
14
|
-
postcssPlugin:
|
|
15
|
-
Once (root, { result
|
|
14
|
+
postcssPlugin: "tailwindcss/nesting",
|
|
15
|
+
Once (root, { result }) {
|
|
16
16
|
return (0, _plugin.nesting)(opts)(root, result);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -17,37 +17,37 @@ function _interop_require_default(obj) {
|
|
|
17
17
|
}
|
|
18
18
|
function nesting(opts = _postcssnested.default) {
|
|
19
19
|
return (root, result)=>{
|
|
20
|
-
root.walkAtRules(
|
|
21
|
-
rule.name =
|
|
20
|
+
root.walkAtRules("screen", (rule)=>{
|
|
21
|
+
rule.name = "media";
|
|
22
22
|
rule.params = `screen(${rule.params})`;
|
|
23
23
|
});
|
|
24
|
-
root.walkAtRules(
|
|
24
|
+
root.walkAtRules("apply", (rule)=>{
|
|
25
25
|
rule.before(_postcss.default.decl({
|
|
26
|
-
prop:
|
|
26
|
+
prop: "__apply",
|
|
27
27
|
value: rule.params,
|
|
28
28
|
source: rule.source
|
|
29
29
|
}));
|
|
30
30
|
rule.remove();
|
|
31
31
|
});
|
|
32
32
|
let plugin = (()=>{
|
|
33
|
-
var _opts_hasOwnProperty
|
|
34
|
-
if (typeof opts ===
|
|
33
|
+
var _opts_hasOwnProperty;
|
|
34
|
+
if (typeof opts === "function" || typeof opts === "object" && (opts === null || opts === void 0 ? void 0 : (_opts_hasOwnProperty = opts.hasOwnProperty) === null || _opts_hasOwnProperty === void 0 ? void 0 : _opts_hasOwnProperty.call(opts, "postcssPlugin"))) {
|
|
35
35
|
return opts;
|
|
36
36
|
}
|
|
37
|
-
if (typeof opts ===
|
|
37
|
+
if (typeof opts === "string") {
|
|
38
38
|
return require(opts);
|
|
39
39
|
}
|
|
40
40
|
if (Object.keys(opts).length <= 0) {
|
|
41
41
|
return _postcssnested.default;
|
|
42
42
|
}
|
|
43
|
-
throw new Error(
|
|
43
|
+
throw new Error("tailwindcss/nesting should be loaded with a nesting plugin.");
|
|
44
44
|
})();
|
|
45
45
|
(0, _postcss.default)([
|
|
46
46
|
plugin
|
|
47
47
|
]).process(root, result.opts).sync();
|
|
48
|
-
root.walkDecls(
|
|
48
|
+
root.walkDecls("__apply", (decl)=>{
|
|
49
49
|
decl.before(_postcss.default.atRule({
|
|
50
|
-
name:
|
|
50
|
+
name: "apply",
|
|
51
51
|
params: decl.value,
|
|
52
52
|
source: decl.source
|
|
53
53
|
}));
|
|
@@ -67,7 +67,7 @@ function nesting(opts = _postcssnested.default) {
|
|
|
67
67
|
*
|
|
68
68
|
* @param {import('postcss').Node} node
|
|
69
69
|
*/ function markDirty(node) {
|
|
70
|
-
if (!(
|
|
70
|
+
if (!("markDirty" in node)) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
// Traverse the tree down to the leaf nodes
|
|
@@ -17,7 +17,6 @@ const _resolveDefaultsAtRules = /*#__PURE__*/ _interop_require_default(require("
|
|
|
17
17
|
const _collapseAdjacentRules = /*#__PURE__*/ _interop_require_default(require("./lib/collapseAdjacentRules"));
|
|
18
18
|
const _collapseDuplicateDeclarations = /*#__PURE__*/ _interop_require_default(require("./lib/collapseDuplicateDeclarations"));
|
|
19
19
|
const _partitionApplyAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/partitionApplyAtRules"));
|
|
20
|
-
const _detectNesting = /*#__PURE__*/ _interop_require_default(require("./lib/detectNesting"));
|
|
21
20
|
const _setupContextUtils = require("./lib/setupContextUtils");
|
|
22
21
|
const _featureFlags = require("./featureFlags");
|
|
23
22
|
function _interop_require_default(obj) {
|
|
@@ -27,8 +26,7 @@ function _interop_require_default(obj) {
|
|
|
27
26
|
}
|
|
28
27
|
function processTailwindFeatures(setupContext) {
|
|
29
28
|
return async function(root, result) {
|
|
30
|
-
let { tailwindDirectives, applyDirectives
|
|
31
|
-
(0, _detectNesting.default)()(root, result);
|
|
29
|
+
let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives.default)(root);
|
|
32
30
|
// Partition apply rules that are found in the css
|
|
33
31
|
// itself.
|
|
34
32
|
(0, _partitionApplyAtRules.default)()(root, result);
|
|
@@ -37,7 +35,7 @@ function processTailwindFeatures(setupContext) {
|
|
|
37
35
|
applyDirectives,
|
|
38
36
|
registerDependency (dependency) {
|
|
39
37
|
result.messages.push({
|
|
40
|
-
plugin:
|
|
38
|
+
plugin: "tailwindcss",
|
|
41
39
|
parent: result.opts.from,
|
|
42
40
|
...dependency
|
|
43
41
|
});
|
|
@@ -46,7 +44,7 @@ function processTailwindFeatures(setupContext) {
|
|
|
46
44
|
return (0, _setupContextUtils.createContext)(tailwindConfig, changedContent, root);
|
|
47
45
|
}
|
|
48
46
|
})(root, result);
|
|
49
|
-
if (context.tailwindConfig.separator ===
|
|
47
|
+
if (context.tailwindConfig.separator === "-") {
|
|
50
48
|
throw new Error("The '-' character cannot be used as a custom separator in JIT mode due to parsing ambiguity. Please use another character like '_' instead.");
|
|
51
49
|
}
|
|
52
50
|
(0, _featureFlags.issueFlagNotices)(context.tailwindConfig);
|