tailwindcss 0.0.0-insiders.eae2b7a → 0.0.0-insiders.eb2fe94
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/lib/cli/build/index.js +14 -14
- package/lib/cli/build/plugin.js +66 -64
- package/lib/cli/build/utils.js +20 -20
- package/lib/cli/build/watching.js +10 -10
- package/lib/cli/help/index.js +11 -11
- package/lib/cli/index.js +58 -58
- package/lib/cli/init/index.js +16 -16
- package/lib/cli.js +1 -1
- package/lib/corePluginList.js +3 -1
- package/lib/corePlugins.js +1934 -1906
- package/lib/css/preflight.css +17 -6
- package/lib/featureFlags.js +16 -16
- package/lib/index.js +1 -1
- package/lib/lib/cacheInvalidation.js +6 -4
- package/lib/lib/collapseAdjacentRules.js +9 -7
- package/lib/lib/collapseDuplicateDeclarations.js +1 -1
- package/lib/lib/content.js +10 -10
- package/lib/lib/defaultExtractor.js +29 -33
- package/lib/lib/detectNesting.js +10 -10
- package/lib/lib/evaluateTailwindFunctions.js +22 -22
- package/lib/lib/expandApplyAtRules.js +24 -18
- package/lib/lib/expandTailwindAtRules.js +61 -62
- package/lib/lib/findAtConfigPath.js +5 -5
- package/lib/lib/generateRules.js +87 -74
- package/lib/lib/getModuleDependencies.js +23 -23
- package/lib/lib/handleImportAtRules.js +3 -3
- package/lib/lib/load-config.js +3 -3
- package/lib/lib/normalizeTailwindDirectives.js +21 -21
- package/lib/lib/offsets.js +44 -44
- package/lib/lib/partitionApplyAtRules.js +2 -2
- package/lib/lib/regex.js +17 -17
- package/lib/lib/resolveDefaultsAtRules.js +28 -28
- package/lib/lib/setupContextUtils.js +177 -154
- package/lib/lib/setupTrackingContext.js +3 -3
- package/lib/lib/sharedState.js +22 -22
- package/lib/lib/substituteScreenAtRules.js +4 -4
- package/lib/plugin.js +32 -26
- package/lib/postcss-plugins/nesting/index.js +2 -2
- package/lib/postcss-plugins/nesting/plugin.js +10 -10
- package/lib/processTailwindFeatures.js +5 -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 +1 -1
- package/lib/util/color.js +23 -23
- package/lib/util/createUtilityPlugin.js +3 -3
- package/lib/util/dataTypes.js +233 -130
- package/lib/util/escapeCommas.js +1 -1
- package/lib/util/flattenColorPalette.js +2 -2
- package/lib/util/formatVariantSelector.js +29 -22
- package/lib/util/getAllConfigs.js +3 -3
- 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 +14 -14
- package/lib/util/nameClass.js +4 -4
- package/lib/util/negateValue.js +8 -8
- package/lib/util/normalizeConfig.js +60 -58
- package/lib/util/normalizeScreens.js +22 -22
- package/lib/util/parseAnimationValue.js +38 -38
- package/lib/util/parseBoxShadowValue.js +21 -21
- 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 +32 -32
- package/lib/util/prefixSelector.js +4 -4
- package/lib/util/pseudoElements.js +69 -69
- package/lib/util/removeAlphaVariables.js +1 -1
- package/lib/util/resolveConfig.js +50 -43
- 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 +13 -13
- package/lib/util/validateFormalSyntax.js +5 -5
- package/lib/util/withAlphaVariable.js +8 -8
- 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 +17 -16
- package/resolveConfig.d.ts +22 -3
- package/scripts/generate-types.js +1 -2
- package/scripts/release-notes.js +1 -1
- package/src/cli/build/plugin.js +13 -12
- package/src/cli/build/watching.js +1 -1
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +29 -15
- package/src/css/preflight.css +17 -6
- package/src/featureFlags.js +1 -5
- package/src/lib/defaultExtractor.js +14 -16
- package/src/lib/expandApplyAtRules.js +7 -0
- package/src/lib/expandTailwindAtRules.js +39 -31
- package/src/lib/generateRules.js +30 -22
- package/src/lib/setupContextUtils.js +51 -35
- package/src/plugin.js +10 -5
- package/src/processTailwindFeatures.js +3 -2
- package/src/util/color.js +1 -1
- package/src/util/dataTypes.js +120 -20
- package/src/util/formatVariantSelector.js +11 -3
- package/src/util/isPlainObject.js +1 -1
- package/src/util/normalizeConfig.js +1 -1
- package/src/util/prefixSelector.js +1 -0
- package/src/util/resolveConfig.js +42 -24
- package/stubs/config.full.js +73 -14
- package/types/config.d.ts +12 -9
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +34 -9
- package/types/index.d.ts +7 -3
package/lib/cli/index.js
CHANGED
|
@@ -22,7 +22,7 @@ function oneOf(...options) {
|
|
|
22
22
|
return parsed;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
throw new Error(
|
|
25
|
+
throw new Error('...');
|
|
26
26
|
}, {
|
|
27
27
|
manualParsing: true
|
|
28
28
|
});
|
|
@@ -31,93 +31,93 @@ let commands = {
|
|
|
31
31
|
init: {
|
|
32
32
|
run: _init.init,
|
|
33
33
|
args: {
|
|
34
|
-
|
|
34
|
+
'--esm': {
|
|
35
35
|
type: Boolean,
|
|
36
36
|
description: `Initialize configuration file as ESM`
|
|
37
37
|
},
|
|
38
|
-
|
|
38
|
+
'--ts': {
|
|
39
39
|
type: Boolean,
|
|
40
40
|
description: `Initialize configuration file as TypeScript`
|
|
41
41
|
},
|
|
42
|
-
|
|
42
|
+
'--postcss': {
|
|
43
43
|
type: Boolean,
|
|
44
44
|
description: `Initialize a \`postcss.config.js\` file`
|
|
45
45
|
},
|
|
46
|
-
|
|
46
|
+
'--full': {
|
|
47
47
|
type: Boolean,
|
|
48
48
|
description: `Include the default values for all options in the generated configuration file`
|
|
49
49
|
},
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
'-f': '--full',
|
|
51
|
+
'-p': '--postcss'
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
build: {
|
|
55
55
|
run: _build.build,
|
|
56
56
|
args: {
|
|
57
|
-
|
|
57
|
+
'--input': {
|
|
58
58
|
type: String,
|
|
59
|
-
description:
|
|
59
|
+
description: 'Input file'
|
|
60
60
|
},
|
|
61
|
-
|
|
61
|
+
'--output': {
|
|
62
62
|
type: String,
|
|
63
|
-
description:
|
|
63
|
+
description: 'Output file'
|
|
64
64
|
},
|
|
65
|
-
|
|
65
|
+
'--watch': {
|
|
66
66
|
type: oneOf(String, Boolean),
|
|
67
|
-
description:
|
|
67
|
+
description: 'Watch for changes and rebuild as needed'
|
|
68
68
|
},
|
|
69
|
-
|
|
69
|
+
'--poll': {
|
|
70
70
|
type: Boolean,
|
|
71
|
-
description:
|
|
71
|
+
description: 'Use polling instead of filesystem events when watching'
|
|
72
72
|
},
|
|
73
|
-
|
|
73
|
+
'--content': {
|
|
74
74
|
type: String,
|
|
75
|
-
description:
|
|
75
|
+
description: 'Content paths to use for removing unused classes'
|
|
76
76
|
},
|
|
77
|
-
|
|
77
|
+
'--purge': {
|
|
78
78
|
type: String,
|
|
79
79
|
deprecated: true
|
|
80
80
|
},
|
|
81
|
-
|
|
81
|
+
'--postcss': {
|
|
82
82
|
type: oneOf(String, Boolean),
|
|
83
|
-
description:
|
|
83
|
+
description: 'Load custom PostCSS configuration'
|
|
84
84
|
},
|
|
85
|
-
|
|
85
|
+
'--minify': {
|
|
86
86
|
type: Boolean,
|
|
87
|
-
description:
|
|
87
|
+
description: 'Minify the output'
|
|
88
88
|
},
|
|
89
|
-
|
|
89
|
+
'--config': {
|
|
90
90
|
type: String,
|
|
91
|
-
description:
|
|
91
|
+
description: 'Path to a custom config file'
|
|
92
92
|
},
|
|
93
|
-
|
|
93
|
+
'--no-autoprefixer': {
|
|
94
94
|
deprecated: true,
|
|
95
95
|
type: Boolean,
|
|
96
|
-
description:
|
|
96
|
+
description: 'Disable autoprefixer'
|
|
97
97
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
'-c': '--config',
|
|
99
|
+
'-i': '--input',
|
|
100
|
+
'-o': '--output',
|
|
101
|
+
'-m': '--minify',
|
|
102
|
+
'-w': '--watch',
|
|
103
|
+
'-p': '--poll'
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
let sharedFlags = {
|
|
108
|
-
|
|
108
|
+
'--help': {
|
|
109
109
|
type: Boolean,
|
|
110
|
-
description:
|
|
110
|
+
description: 'Display usage information'
|
|
111
111
|
},
|
|
112
|
-
|
|
112
|
+
'-h': '--help'
|
|
113
113
|
};
|
|
114
114
|
if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
|
|
115
115
|
(0, _help.help)({
|
|
116
116
|
usage: [
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
'tailwindcss [--input input.css] [--output output.css] [--watch] [options...]',
|
|
118
|
+
'tailwindcss init [--full] [--postcss] [options...]'
|
|
119
119
|
],
|
|
120
|
-
commands: Object.keys(commands).filter((command)=>command !==
|
|
120
|
+
commands: Object.keys(commands).filter((command)=>command !== 'build').map((command)=>`${command} [options]`),
|
|
121
121
|
options: {
|
|
122
122
|
...commands.build.args,
|
|
123
123
|
...sharedFlags
|
|
@@ -125,26 +125,26 @@ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.
|
|
|
125
125
|
});
|
|
126
126
|
process.exit(0);
|
|
127
127
|
}
|
|
128
|
-
let command = ((arg =
|
|
128
|
+
let command = ((arg = '')=>arg.startsWith('-') ? undefined : arg)(process.argv[2]) || 'build';
|
|
129
129
|
if (commands[command] === undefined) {
|
|
130
130
|
if (_fs.default.existsSync(_path.default.resolve(command))) {
|
|
131
131
|
// TODO: Deprecate this in future versions
|
|
132
132
|
// Check if non-existing command, might be a file.
|
|
133
|
-
command =
|
|
133
|
+
command = 'build';
|
|
134
134
|
} else {
|
|
135
135
|
(0, _help.help)({
|
|
136
136
|
message: `Invalid command: ${command}`,
|
|
137
137
|
usage: [
|
|
138
|
-
|
|
138
|
+
'tailwindcss <command> [options]'
|
|
139
139
|
],
|
|
140
|
-
commands: Object.keys(commands).filter((command)=>command !==
|
|
140
|
+
commands: Object.keys(commands).filter((command)=>command !== 'build').map((command)=>`${command} [options]`),
|
|
141
141
|
options: sharedFlags
|
|
142
142
|
});
|
|
143
143
|
process.exit(1);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
// Execute command
|
|
147
|
-
let { args: flags
|
|
147
|
+
let { args: flags, run } = commands[command];
|
|
148
148
|
let args = (()=>{
|
|
149
149
|
try {
|
|
150
150
|
let result = (0, _arg.default)(Object.fromEntries(Object.entries({
|
|
@@ -155,18 +155,18 @@ let args = (()=>{
|
|
|
155
155
|
return !(value === null || value === void 0 ? void 0 : (_value_type = value.type) === null || _value_type === void 0 ? void 0 : _value_type.manualParsing);
|
|
156
156
|
}).map(([key, value])=>[
|
|
157
157
|
key,
|
|
158
|
-
typeof value ===
|
|
158
|
+
typeof value === 'object' ? value.type : value
|
|
159
159
|
])), {
|
|
160
160
|
permissive: true
|
|
161
161
|
});
|
|
162
162
|
// Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
|
|
163
|
-
for(let i = result[
|
|
164
|
-
let flag = result[
|
|
165
|
-
if (!flag.startsWith(
|
|
166
|
-
let [flagName, flagValue] = flag.split(
|
|
163
|
+
for(let i = result['_'].length - 1; i >= 0; --i){
|
|
164
|
+
let flag = result['_'][i];
|
|
165
|
+
if (!flag.startsWith('-')) continue;
|
|
166
|
+
let [flagName, flagValue] = flag.split('=');
|
|
167
167
|
let handler = flags[flagName];
|
|
168
168
|
// Resolve flagName & handler
|
|
169
|
-
while(typeof handler ===
|
|
169
|
+
while(typeof handler === 'string'){
|
|
170
170
|
flagName = handler;
|
|
171
171
|
handler = flags[handler];
|
|
172
172
|
}
|
|
@@ -176,18 +176,18 @@ let args = (()=>{
|
|
|
176
176
|
// --flag value syntax was used so we need to pull `value` from `args`
|
|
177
177
|
if (flagValue === undefined) {
|
|
178
178
|
// Parse args for current flag
|
|
179
|
-
while(result[
|
|
180
|
-
args.push(result[
|
|
179
|
+
while(result['_'][offset] && !result['_'][offset].startsWith('-')){
|
|
180
|
+
args.push(result['_'][offset++]);
|
|
181
181
|
}
|
|
182
182
|
// Cleanup manually parsed flags + args
|
|
183
|
-
result[
|
|
183
|
+
result['_'].splice(i, 1 + args.length);
|
|
184
184
|
// No args were provided, use default value defined in handler
|
|
185
185
|
// One arg was provided, use that directly
|
|
186
186
|
// Multiple args were provided so pass them all in an array
|
|
187
187
|
flagValue = args.length === 0 ? undefined : args.length === 1 ? args[0] : args;
|
|
188
188
|
} else {
|
|
189
189
|
// Remove the whole flag from the args array
|
|
190
|
-
result[
|
|
190
|
+
result['_'].splice(i, 1);
|
|
191
191
|
}
|
|
192
192
|
// Set the resolved value in the `result` object
|
|
193
193
|
result[flagName] = handler.type(flagValue, flagName);
|
|
@@ -198,16 +198,16 @@ let args = (()=>{
|
|
|
198
198
|
//
|
|
199
199
|
// E.g.: tailwindcss input.css -> _: ['build', 'input.css']
|
|
200
200
|
// E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
|
|
201
|
-
if (result[
|
|
202
|
-
result[
|
|
201
|
+
if (result['_'][0] !== command) {
|
|
202
|
+
result['_'].unshift(command);
|
|
203
203
|
}
|
|
204
204
|
return result;
|
|
205
205
|
} catch (err) {
|
|
206
|
-
if (err.code ===
|
|
206
|
+
if (err.code === 'ARG_UNKNOWN_OPTION') {
|
|
207
207
|
(0, _help.help)({
|
|
208
208
|
message: err.message,
|
|
209
209
|
usage: [
|
|
210
|
-
|
|
210
|
+
'tailwindcss <command> [options]'
|
|
211
211
|
],
|
|
212
212
|
options: sharedFlags
|
|
213
213
|
});
|
|
@@ -216,7 +216,7 @@ let args = (()=>{
|
|
|
216
216
|
throw err;
|
|
217
217
|
}
|
|
218
218
|
})();
|
|
219
|
-
if (args[
|
|
219
|
+
if (args['--help']) {
|
|
220
220
|
(0, _help.help)({
|
|
221
221
|
options: {
|
|
222
222
|
...flags,
|
package/lib/cli/init/index.js
CHANGED
|
@@ -17,40 +17,40 @@ function _interop_require_default(obj) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
function isESM() {
|
|
20
|
-
const pkgPath = _path.default.resolve(
|
|
20
|
+
const pkgPath = _path.default.resolve('./package.json');
|
|
21
21
|
try {
|
|
22
|
-
let pkg = JSON.parse(_fs.default.readFileSync(pkgPath,
|
|
23
|
-
return pkg.type && pkg.type ===
|
|
22
|
+
let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, 'utf8'));
|
|
23
|
+
return pkg.type && pkg.type === 'module';
|
|
24
24
|
} catch (err) {
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
function init(args) {
|
|
29
29
|
let messages = [];
|
|
30
|
-
let isProjectESM = args[
|
|
31
|
-
let syntax = args[
|
|
32
|
-
let extension = args[
|
|
30
|
+
let isProjectESM = args['--ts'] || args['--esm'] || isESM();
|
|
31
|
+
let syntax = args['--ts'] ? 'ts' : isProjectESM ? 'js' : 'cjs';
|
|
32
|
+
let extension = args['--ts'] ? 'ts' : 'js';
|
|
33
33
|
var _args___;
|
|
34
|
-
let tailwindConfigLocation = _path.default.resolve((_args___ = args[
|
|
34
|
+
let tailwindConfigLocation = _path.default.resolve((_args___ = args['_'][1]) !== null && _args___ !== void 0 ? _args___ : `./tailwind.config.${extension}`);
|
|
35
35
|
if (_fs.default.existsSync(tailwindConfigLocation)) {
|
|
36
36
|
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
|
|
37
37
|
} else {
|
|
38
|
-
let stubContentsFile = _fs.default.readFileSync(args[
|
|
39
|
-
let stubFile = _fs.default.readFileSync(_path.default.resolve(__dirname, `../../../stubs/tailwind.config.${syntax}`),
|
|
38
|
+
let stubContentsFile = _fs.default.readFileSync(args['--full'] ? _path.default.resolve(__dirname, '../../../stubs/config.full.js') : _path.default.resolve(__dirname, '../../../stubs/config.simple.js'), 'utf8');
|
|
39
|
+
let stubFile = _fs.default.readFileSync(_path.default.resolve(__dirname, `../../../stubs/tailwind.config.${syntax}`), 'utf8');
|
|
40
40
|
// Change colors import
|
|
41
|
-
stubContentsFile = stubContentsFile.replace(
|
|
41
|
+
stubContentsFile = stubContentsFile.replace('../colors', 'tailwindcss/colors');
|
|
42
42
|
// Replace contents of {ts,js,cjs} file with the stub {simple,full}.
|
|
43
|
-
stubFile = stubFile.replace(
|
|
44
|
-
_fs.default.writeFileSync(tailwindConfigLocation, stubFile,
|
|
43
|
+
stubFile = stubFile.replace('__CONFIG__', stubContentsFile.replace('module.exports =', '').trim()).trim() + '\n\n';
|
|
44
|
+
_fs.default.writeFileSync(tailwindConfigLocation, stubFile, 'utf8');
|
|
45
45
|
messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
|
|
46
46
|
}
|
|
47
|
-
if (args[
|
|
48
|
-
let postcssConfigLocation = _path.default.resolve(
|
|
47
|
+
if (args['--postcss']) {
|
|
48
|
+
let postcssConfigLocation = _path.default.resolve('./postcss.config.js');
|
|
49
49
|
if (_fs.default.existsSync(postcssConfigLocation)) {
|
|
50
50
|
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
|
|
51
51
|
} else {
|
|
52
|
-
let stubFile = _fs.default.readFileSync(isProjectESM ? _path.default.resolve(__dirname,
|
|
53
|
-
_fs.default.writeFileSync(postcssConfigLocation, stubFile,
|
|
52
|
+
let stubFile = _fs.default.readFileSync(isProjectESM ? _path.default.resolve(__dirname, '../../../stubs/postcss.config.js') : _path.default.resolve(__dirname, '../../../stubs/postcss.config.cjs'), 'utf8');
|
|
53
|
+
_fs.default.writeFileSync(postcssConfigLocation, stubFile, 'utf8');
|
|
54
54
|
messages.push(`Created PostCSS config file: ${_path.default.basename(postcssConfigLocation)}`);
|
|
55
55
|
}
|
|
56
56
|
}
|
package/lib/cli.js
CHANGED
package/lib/corePluginList.js
CHANGED
|
@@ -32,6 +32,7 @@ const _default = [
|
|
|
32
32
|
"lineClamp",
|
|
33
33
|
"display",
|
|
34
34
|
"aspectRatio",
|
|
35
|
+
"size",
|
|
35
36
|
"height",
|
|
36
37
|
"maxHeight",
|
|
37
38
|
"minHeight",
|
|
@@ -184,5 +185,6 @@ const _default = [
|
|
|
184
185
|
"transitionDuration",
|
|
185
186
|
"transitionTimingFunction",
|
|
186
187
|
"willChange",
|
|
187
|
-
"content"
|
|
188
|
+
"content",
|
|
189
|
+
"forcedColorAdjust"
|
|
188
190
|
];
|