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
|
@@ -20,9 +20,9 @@ function _interop_require_default(obj) {
|
|
|
20
20
|
default: obj
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
function createWatcher(args, { state, rebuild
|
|
24
|
-
let shouldPoll = args[
|
|
25
|
-
let shouldCoalesceWriteEvents = shouldPoll || process.platform ===
|
|
23
|
+
function createWatcher(args, { state , rebuild }) {
|
|
24
|
+
let shouldPoll = args["--poll"];
|
|
25
|
+
let shouldCoalesceWriteEvents = shouldPoll || process.platform === "win32";
|
|
26
26
|
// Polling interval in milliseconds
|
|
27
27
|
// Used only when polling or coalescing add/change events on Windows
|
|
28
28
|
let pollInterval = 10;
|
|
@@ -88,7 +88,7 @@ function createWatcher(args, { state, rebuild }) {
|
|
|
88
88
|
pendingRebuilds.add(file);
|
|
89
89
|
changedContent.push({
|
|
90
90
|
file,
|
|
91
|
-
content: content !== null && content !== void 0 ? content : ()=>_fs.default.promises.readFile(file,
|
|
91
|
+
content: content !== null && content !== void 0 ? content : ()=>_fs.default.promises.readFile(file, "utf8"),
|
|
92
92
|
extension: _path.default.extname(file).slice(1)
|
|
93
93
|
});
|
|
94
94
|
if (_timer) {
|
|
@@ -107,12 +107,12 @@ function createWatcher(args, { state, rebuild }) {
|
|
|
107
107
|
chain = chain.then(rebuildAndContinue, rebuildAndContinue);
|
|
108
108
|
return chain;
|
|
109
109
|
}
|
|
110
|
-
watcher.on(
|
|
111
|
-
watcher.on(
|
|
110
|
+
watcher.on("change", (file)=>recordChangedFile(file));
|
|
111
|
+
watcher.on("add", (file)=>recordChangedFile(file));
|
|
112
112
|
// Restore watching any files that are "removed"
|
|
113
113
|
// This can happen when a file is pseudo-atomically replaced (a copy is created, overwritten, the old one is unlinked, and the new one is renamed)
|
|
114
114
|
// TODO: An an optimization we should allow removal when the config changes
|
|
115
|
-
watcher.on(
|
|
115
|
+
watcher.on("unlink", (file)=>{
|
|
116
116
|
file = (0, _normalizepath.default)(file);
|
|
117
117
|
// Only re-add the file if it's not covered by a dynamic pattern
|
|
118
118
|
if (!_micromatch.default.some([
|
|
@@ -125,8 +125,8 @@ function createWatcher(args, { state, rebuild }) {
|
|
|
125
125
|
// will only fire a rename event for atomic writes and not a change event
|
|
126
126
|
// This is very likely a chokidar bug but it's one we need to work around
|
|
127
127
|
// We treat this as a change event and rebuild the CSS
|
|
128
|
-
watcher.on(
|
|
129
|
-
if (evt !==
|
|
128
|
+
watcher.on("raw", (evt, filePath, meta)=>{
|
|
129
|
+
if (evt !== "rename" || filePath === null) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
let watchedPath = meta.watchedPath;
|
|
@@ -161,7 +161,7 @@ function createWatcher(args, { state, rebuild }) {
|
|
|
161
161
|
// This is because the order of events and timing is different on Linux
|
|
162
162
|
// @ts-ignore: TypeScript isn't picking up that content is a string here
|
|
163
163
|
await recordChangedFile(filePath, ()=>content, true);
|
|
164
|
-
} catch
|
|
164
|
+
} catch {
|
|
165
165
|
// If reading the file fails, it's was probably a deleted temporary file
|
|
166
166
|
// So we can ignore it and no rebuild is needed
|
|
167
167
|
}
|
package/lib/cli/help/index.js
CHANGED
|
@@ -15,7 +15,7 @@ function _interop_require_default(obj) {
|
|
|
15
15
|
default: obj
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function help({ message, usage, commands, options
|
|
18
|
+
function help({ message , usage , commands , options }) {
|
|
19
19
|
let indent = 2;
|
|
20
20
|
// Render header
|
|
21
21
|
console.log();
|
|
@@ -23,31 +23,31 @@ function help({ message, usage, commands, options }) {
|
|
|
23
23
|
// Render message
|
|
24
24
|
if (message) {
|
|
25
25
|
console.log();
|
|
26
|
-
for (let msg of message.split(
|
|
26
|
+
for (let msg of message.split("\n")){
|
|
27
27
|
console.log(msg);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
// Render usage
|
|
31
31
|
if (usage && usage.length > 0) {
|
|
32
32
|
console.log();
|
|
33
|
-
console.log(
|
|
33
|
+
console.log("Usage:");
|
|
34
34
|
for (let example of usage){
|
|
35
|
-
console.log(
|
|
35
|
+
console.log(" ".repeat(indent), example);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
// Render commands
|
|
39
39
|
if (commands && commands.length > 0) {
|
|
40
40
|
console.log();
|
|
41
|
-
console.log(
|
|
41
|
+
console.log("Commands:");
|
|
42
42
|
for (let command of commands){
|
|
43
|
-
console.log(
|
|
43
|
+
console.log(" ".repeat(indent), command);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
// Render options
|
|
47
47
|
if (options) {
|
|
48
48
|
let groupedOptions = {};
|
|
49
49
|
for (let [key, value] of Object.entries(options)){
|
|
50
|
-
if (typeof value ===
|
|
50
|
+
if (typeof value === "object") {
|
|
51
51
|
groupedOptions[key] = {
|
|
52
52
|
...value,
|
|
53
53
|
flags: [
|
|
@@ -59,13 +59,13 @@ function help({ message, usage, commands, options }) {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
console.log();
|
|
62
|
-
console.log(
|
|
63
|
-
for (let { flags, description, deprecated
|
|
62
|
+
console.log("Options:");
|
|
63
|
+
for (let { flags , description , deprecated } of Object.values(groupedOptions)){
|
|
64
64
|
if (deprecated) continue;
|
|
65
65
|
if (flags.length === 1) {
|
|
66
|
-
console.log(
|
|
66
|
+
console.log(" ".repeat(indent + 4 /* 4 = "-i, ".length */ ), flags.slice().reverse().join(", ").padEnd(20, " "), description);
|
|
67
67
|
} else {
|
|
68
|
-
console.log(
|
|
68
|
+
console.log(" ".repeat(indent), flags.slice().reverse().join(", ").padEnd(24, " "), description);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
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,92 @@ 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
|
-
|
|
94
|
-
deprecated: true,
|
|
93
|
+
"--no-autoprefixer": {
|
|
95
94
|
type: Boolean,
|
|
96
|
-
description:
|
|
95
|
+
description: "Disable autoprefixer"
|
|
97
96
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
"-c": "--config",
|
|
98
|
+
"-i": "--input",
|
|
99
|
+
"-o": "--output",
|
|
100
|
+
"-m": "--minify",
|
|
101
|
+
"-w": "--watch",
|
|
102
|
+
"-p": "--poll"
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
};
|
|
107
106
|
let sharedFlags = {
|
|
108
|
-
|
|
107
|
+
"--help": {
|
|
109
108
|
type: Boolean,
|
|
110
|
-
description:
|
|
109
|
+
description: "Display usage information"
|
|
111
110
|
},
|
|
112
|
-
|
|
111
|
+
"-h": "--help"
|
|
113
112
|
};
|
|
114
113
|
if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
|
|
115
114
|
(0, _help.help)({
|
|
116
115
|
usage: [
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
"tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
|
|
117
|
+
"tailwindcss init [--full] [--postcss] [options...]"
|
|
119
118
|
],
|
|
120
|
-
commands: Object.keys(commands).filter((command)=>command !==
|
|
119
|
+
commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
|
|
121
120
|
options: {
|
|
122
121
|
...commands.build.args,
|
|
123
122
|
...sharedFlags
|
|
@@ -125,48 +124,48 @@ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.
|
|
|
125
124
|
});
|
|
126
125
|
process.exit(0);
|
|
127
126
|
}
|
|
128
|
-
let command = ((arg =
|
|
127
|
+
let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
|
|
129
128
|
if (commands[command] === undefined) {
|
|
130
129
|
if (_fs.default.existsSync(_path.default.resolve(command))) {
|
|
131
130
|
// TODO: Deprecate this in future versions
|
|
132
131
|
// Check if non-existing command, might be a file.
|
|
133
|
-
command =
|
|
132
|
+
command = "build";
|
|
134
133
|
} else {
|
|
135
134
|
(0, _help.help)({
|
|
136
135
|
message: `Invalid command: ${command}`,
|
|
137
136
|
usage: [
|
|
138
|
-
|
|
137
|
+
"tailwindcss <command> [options]"
|
|
139
138
|
],
|
|
140
|
-
commands: Object.keys(commands).filter((command)=>command !==
|
|
139
|
+
commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
|
|
141
140
|
options: sharedFlags
|
|
142
141
|
});
|
|
143
142
|
process.exit(1);
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
145
|
// Execute command
|
|
147
|
-
let { args: flags, run
|
|
146
|
+
let { args: flags , run } = commands[command];
|
|
148
147
|
let args = (()=>{
|
|
149
148
|
try {
|
|
150
149
|
let result = (0, _arg.default)(Object.fromEntries(Object.entries({
|
|
151
150
|
...flags,
|
|
152
151
|
...sharedFlags
|
|
153
152
|
}).filter(([_key, value])=>{
|
|
154
|
-
var _value_type
|
|
155
|
-
return !(
|
|
153
|
+
var _value_type;
|
|
154
|
+
return !(value === null || value === void 0 ? void 0 : (_value_type = value.type) === null || _value_type === void 0 ? void 0 : _value_type.manualParsing);
|
|
156
155
|
}).map(([key, value])=>[
|
|
157
156
|
key,
|
|
158
|
-
typeof value ===
|
|
157
|
+
typeof value === "object" ? value.type : value
|
|
159
158
|
])), {
|
|
160
159
|
permissive: true
|
|
161
160
|
});
|
|
162
161
|
// 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(
|
|
162
|
+
for(let i = result["_"].length - 1; i >= 0; --i){
|
|
163
|
+
let flag = result["_"][i];
|
|
164
|
+
if (!flag.startsWith("-")) continue;
|
|
165
|
+
let [flagName, flagValue] = flag.split("=");
|
|
167
166
|
let handler = flags[flagName];
|
|
168
167
|
// Resolve flagName & handler
|
|
169
|
-
while(typeof handler ===
|
|
168
|
+
while(typeof handler === "string"){
|
|
170
169
|
flagName = handler;
|
|
171
170
|
handler = flags[handler];
|
|
172
171
|
}
|
|
@@ -176,18 +175,18 @@ let args = (()=>{
|
|
|
176
175
|
// --flag value syntax was used so we need to pull `value` from `args`
|
|
177
176
|
if (flagValue === undefined) {
|
|
178
177
|
// Parse args for current flag
|
|
179
|
-
while(result[
|
|
180
|
-
args.push(result[
|
|
178
|
+
while(result["_"][offset] && !result["_"][offset].startsWith("-")){
|
|
179
|
+
args.push(result["_"][offset++]);
|
|
181
180
|
}
|
|
182
181
|
// Cleanup manually parsed flags + args
|
|
183
|
-
result[
|
|
182
|
+
result["_"].splice(i, 1 + args.length);
|
|
184
183
|
// No args were provided, use default value defined in handler
|
|
185
184
|
// One arg was provided, use that directly
|
|
186
185
|
// Multiple args were provided so pass them all in an array
|
|
187
186
|
flagValue = args.length === 0 ? undefined : args.length === 1 ? args[0] : args;
|
|
188
187
|
} else {
|
|
189
188
|
// Remove the whole flag from the args array
|
|
190
|
-
result[
|
|
189
|
+
result["_"].splice(i, 1);
|
|
191
190
|
}
|
|
192
191
|
// Set the resolved value in the `result` object
|
|
193
192
|
result[flagName] = handler.type(flagValue, flagName);
|
|
@@ -198,16 +197,16 @@ let args = (()=>{
|
|
|
198
197
|
//
|
|
199
198
|
// E.g.: tailwindcss input.css -> _: ['build', 'input.css']
|
|
200
199
|
// E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
|
|
201
|
-
if (result[
|
|
202
|
-
result[
|
|
200
|
+
if (result["_"][0] !== command) {
|
|
201
|
+
result["_"].unshift(command);
|
|
203
202
|
}
|
|
204
203
|
return result;
|
|
205
204
|
} catch (err) {
|
|
206
|
-
if (err.code ===
|
|
205
|
+
if (err.code === "ARG_UNKNOWN_OPTION") {
|
|
207
206
|
(0, _help.help)({
|
|
208
207
|
message: err.message,
|
|
209
208
|
usage: [
|
|
210
|
-
|
|
209
|
+
"tailwindcss <command> [options]"
|
|
211
210
|
],
|
|
212
211
|
options: sharedFlags
|
|
213
212
|
});
|
|
@@ -216,7 +215,7 @@ let args = (()=>{
|
|
|
216
215
|
throw err;
|
|
217
216
|
}
|
|
218
217
|
})();
|
|
219
|
-
if (args[
|
|
218
|
+
if (args["--help"]) {
|
|
220
219
|
(0, _help.help)({
|
|
221
220
|
options: {
|
|
222
221
|
...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
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
lazyPostcss: function() {
|
|
13
|
+
return lazyPostcss;
|
|
14
|
+
},
|
|
15
|
+
lazyPostcssImport: function() {
|
|
16
|
+
return lazyPostcssImport;
|
|
17
|
+
},
|
|
18
|
+
lazyAutoprefixer: function() {
|
|
19
|
+
return lazyAutoprefixer;
|
|
20
|
+
},
|
|
21
|
+
lazyCssnano: function() {
|
|
22
|
+
return lazyCssnano;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
function lazyPostcss() {
|
|
26
|
+
return require("postcss");
|
|
27
|
+
}
|
|
28
|
+
function lazyPostcssImport() {
|
|
29
|
+
return require("postcss-import");
|
|
30
|
+
}
|
|
31
|
+
function lazyAutoprefixer() {
|
|
32
|
+
return require("autoprefixer");
|
|
33
|
+
}
|
|
34
|
+
function lazyCssnano() {
|
|
35
|
+
return require("cssnano");
|
|
36
|
+
}
|
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,7 @@ const _default = [
|
|
|
184
185
|
"transitionDuration",
|
|
185
186
|
"transitionTimingFunction",
|
|
186
187
|
"willChange",
|
|
187
|
-
"
|
|
188
|
+
"contain",
|
|
189
|
+
"content",
|
|
190
|
+
"forcedColorAdjust"
|
|
188
191
|
];
|