tailwindcss 0.0.0-insiders.ea10bb9 → 0.0.0-insiders.ea3d9cd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +1 -1
  2. package/index.css +5 -0
  3. package/lib/cli/build/index.js +23 -10
  4. package/lib/cli/build/plugin.js +136 -117
  5. package/lib/cli/build/utils.js +18 -8
  6. package/lib/cli/build/watching.js +16 -12
  7. package/lib/cli/help/index.js +6 -4
  8. package/lib/cli/index.js +223 -10
  9. package/lib/cli/init/index.js +29 -12
  10. package/lib/cli.js +1 -227
  11. package/lib/corePluginList.js +8 -1
  12. package/lib/corePlugins.js +374 -77
  13. package/lib/css/preflight.css +9 -1
  14. package/lib/featureFlags.js +30 -17
  15. package/lib/index.js +1 -47
  16. package/lib/lib/cacheInvalidation.js +7 -5
  17. package/lib/lib/collapseAdjacentRules.js +5 -3
  18. package/lib/lib/collapseDuplicateDeclarations.js +12 -10
  19. package/lib/lib/content.js +61 -31
  20. package/lib/lib/defaultExtractor.js +15 -8
  21. package/lib/lib/detectNesting.js +10 -2
  22. package/lib/lib/evaluateTailwindFunctions.js +24 -20
  23. package/lib/lib/expandApplyAtRules.js +43 -35
  24. package/lib/lib/expandTailwindAtRules.js +89 -22
  25. package/lib/lib/findAtConfigPath.js +9 -7
  26. package/lib/lib/generateRules.js +160 -98
  27. package/lib/lib/getModuleDependencies.js +85 -37
  28. package/lib/lib/handleImportAtRules.js +50 -0
  29. package/lib/lib/load-config.js +42 -0
  30. package/lib/lib/normalizeTailwindDirectives.js +5 -18
  31. package/lib/lib/offsets.js +93 -4
  32. package/lib/lib/partitionApplyAtRules.js +3 -1
  33. package/lib/lib/regex.js +21 -7
  34. package/lib/lib/remap-bitfield.js +89 -0
  35. package/lib/lib/resolveDefaultsAtRules.js +28 -24
  36. package/lib/lib/setupContextUtils.js +191 -142
  37. package/lib/lib/setupTrackingContext.js +50 -26
  38. package/lib/lib/sharedState.js +28 -9
  39. package/lib/lib/substituteScreenAtRules.js +5 -3
  40. package/lib/plugin.js +116 -0
  41. package/lib/postcss-plugins/nesting/index.js +3 -1
  42. package/lib/postcss-plugins/nesting/plugin.js +10 -8
  43. package/lib/processTailwindFeatures.js +14 -12
  44. package/lib/public/colors.js +49 -25
  45. package/lib/public/create-plugin.js +5 -3
  46. package/lib/public/default-config.js +6 -4
  47. package/lib/public/default-theme.js +6 -4
  48. package/lib/public/load-config.js +12 -0
  49. package/lib/public/resolve-config.js +6 -4
  50. package/lib/util/applyImportantSelector.js +36 -0
  51. package/lib/util/bigSign.js +3 -1
  52. package/lib/util/buildMediaQuery.js +3 -1
  53. package/lib/util/cloneDeep.js +3 -1
  54. package/lib/util/cloneNodes.js +5 -3
  55. package/lib/util/color.js +30 -12
  56. package/lib/util/colorNames.js +752 -0
  57. package/lib/util/configurePlugins.js +3 -1
  58. package/lib/util/createPlugin.js +3 -1
  59. package/lib/util/createUtilityPlugin.js +7 -5
  60. package/lib/util/dataTypes.js +88 -23
  61. package/lib/util/defaults.js +9 -7
  62. package/lib/util/escapeClassName.js +10 -8
  63. package/lib/util/escapeCommas.js +3 -1
  64. package/lib/util/flattenColorPalette.js +3 -1
  65. package/lib/util/formatVariantSelector.js +138 -160
  66. package/lib/util/getAllConfigs.js +8 -6
  67. package/lib/util/hashConfig.js +6 -4
  68. package/lib/util/isKeyframeRule.js +3 -1
  69. package/lib/util/isPlainObject.js +3 -1
  70. package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
  71. package/lib/util/log.js +25 -4
  72. package/lib/util/nameClass.js +12 -6
  73. package/lib/util/negateValue.js +4 -2
  74. package/lib/util/normalizeConfig.js +63 -36
  75. package/lib/util/normalizeScreens.js +12 -4
  76. package/lib/util/parseAnimationValue.js +3 -1
  77. package/lib/util/parseBoxShadowValue.js +6 -2
  78. package/lib/util/parseDependency.js +3 -1
  79. package/lib/util/parseGlob.js +6 -4
  80. package/lib/util/parseObjectStyles.js +9 -7
  81. package/lib/util/pluginUtils.js +53 -55
  82. package/lib/util/prefixSelector.js +27 -11
  83. package/lib/util/pseudoElements.js +209 -0
  84. package/lib/util/removeAlphaVariables.js +3 -1
  85. package/lib/util/resolveConfig.js +17 -15
  86. package/lib/util/resolveConfigPath.js +26 -10
  87. package/lib/util/responsive.js +6 -4
  88. package/lib/util/splitAtTopLevelOnly.js +10 -2
  89. package/lib/util/tap.js +3 -1
  90. package/lib/util/toColorValue.js +3 -1
  91. package/lib/util/toPath.js +3 -1
  92. package/lib/util/transformThemeValue.js +6 -4
  93. package/lib/util/validateConfig.js +27 -3
  94. package/lib/util/validateFormalSyntax.js +3 -1
  95. package/lib/util/withAlphaVariable.js +6 -2
  96. package/lib/value-parser/LICENSE +22 -0
  97. package/lib/value-parser/README.md +3 -0
  98. package/lib/value-parser/index.d.js +2 -0
  99. package/lib/value-parser/index.js +22 -0
  100. package/lib/value-parser/parse.js +259 -0
  101. package/lib/value-parser/stringify.js +38 -0
  102. package/lib/value-parser/unit.js +86 -0
  103. package/lib/value-parser/walk.js +16 -0
  104. package/loadConfig.d.ts +4 -0
  105. package/loadConfig.js +2 -0
  106. package/package.json +46 -45
  107. package/resolveConfig.d.ts +11 -2
  108. package/src/cli/build/index.js +17 -9
  109. package/src/cli/build/plugin.js +96 -73
  110. package/src/cli/build/watching.js +4 -2
  111. package/src/cli/index.js +217 -3
  112. package/src/cli/init/index.js +37 -8
  113. package/src/cli.js +1 -221
  114. package/src/corePluginList.js +1 -1
  115. package/src/corePlugins.js +237 -34
  116. package/src/css/preflight.css +9 -1
  117. package/src/featureFlags.js +7 -3
  118. package/src/index.js +1 -47
  119. package/src/lib/content.js +45 -18
  120. package/src/lib/defaultExtractor.js +9 -3
  121. package/src/lib/detectNesting.js +9 -1
  122. package/src/lib/evaluateTailwindFunctions.js +4 -1
  123. package/src/lib/expandApplyAtRules.js +8 -1
  124. package/src/lib/expandTailwindAtRules.js +73 -12
  125. package/src/lib/generateRules.js +127 -49
  126. package/src/lib/getModuleDependencies.js +70 -30
  127. package/src/lib/handleImportAtRules.js +34 -0
  128. package/src/lib/load-config.ts +31 -0
  129. package/src/lib/normalizeTailwindDirectives.js +0 -27
  130. package/src/lib/offsets.js +104 -1
  131. package/src/lib/remap-bitfield.js +82 -0
  132. package/src/lib/setupContextUtils.js +109 -69
  133. package/src/lib/setupTrackingContext.js +37 -14
  134. package/src/lib/sharedState.js +11 -4
  135. package/src/plugin.js +124 -0
  136. package/src/public/colors.js +22 -0
  137. package/src/public/default-config.js +1 -1
  138. package/src/public/default-theme.js +2 -2
  139. package/src/public/load-config.js +2 -0
  140. package/src/util/applyImportantSelector.js +27 -0
  141. package/src/util/color.js +18 -3
  142. package/src/util/colorNames.js +150 -0
  143. package/src/util/dataTypes.js +49 -9
  144. package/src/util/formatVariantSelector.js +160 -163
  145. package/src/util/getAllConfigs.js +2 -2
  146. package/src/util/log.js +24 -0
  147. package/src/util/negateValue.js +1 -1
  148. package/src/util/normalizeConfig.js +39 -11
  149. package/src/util/pluginUtils.js +16 -35
  150. package/src/util/prefixSelector.js +28 -10
  151. package/src/util/pseudoElements.js +167 -0
  152. package/src/util/resolveConfigPath.js +12 -1
  153. package/src/util/splitAtTopLevelOnly.js +8 -1
  154. package/src/util/validateConfig.js +23 -0
  155. package/src/value-parser/LICENSE +22 -0
  156. package/src/value-parser/README.md +3 -0
  157. package/src/value-parser/index.d.ts +177 -0
  158. package/src/value-parser/index.js +28 -0
  159. package/src/value-parser/parse.js +303 -0
  160. package/src/value-parser/stringify.js +41 -0
  161. package/src/value-parser/unit.js +118 -0
  162. package/src/value-parser/walk.js +18 -0
  163. package/stubs/.gitignore +1 -0
  164. package/stubs/.prettierrc.json +6 -0
  165. package/stubs/{defaultConfig.stub.js → config.full.js} +197 -147
  166. package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -2
  167. package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
  168. package/stubs/postcss.config.js +5 -0
  169. package/stubs/tailwind.config.cjs +2 -0
  170. package/stubs/tailwind.config.js +2 -0
  171. package/stubs/tailwind.config.ts +3 -0
  172. package/types/config.d.ts +17 -10
  173. package/types/generated/colors.d.ts +22 -0
  174. package/types/generated/corePluginList.d.ts +1 -1
  175. package/types/generated/default-theme.d.ts +110 -80
  176. package/CHANGELOG.md +0 -2336
  177. package/lib/cli/build/deps.js +0 -54
  178. package/lib/cli/shared.js +0 -12
  179. package/lib/cli-peer-dependencies.js +0 -28
  180. package/lib/constants.js +0 -44
  181. package/peers/index.js +0 -79512
  182. package/scripts/install-integrations.js +0 -27
  183. package/scripts/rebuildFixtures.js +0 -68
  184. package/src/cli/build/deps.js +0 -56
  185. package/src/cli/shared.js +0 -5
  186. package/src/cli-peer-dependencies.js +0 -15
  187. package/src/constants.js +0 -17
package/lib/cli/index.js CHANGED
@@ -1,18 +1,231 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
4
5
  });
5
- _exportStar(require("./build"), exports);
6
- _exportStar(require("./config"), exports);
7
- _exportStar(require("./content"), exports);
8
- function _exportStar(from, to) {
9
- Object.keys(from).forEach(function(k) {
10
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
11
- enumerable: true,
12
- get: function() {
13
- return from[k];
6
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
7
+ const _arg = /*#__PURE__*/ _interop_require_default(require("arg"));
8
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
9
+ const _build = require("./build");
10
+ const _help = require("./help");
11
+ const _init = require("./init");
12
+ function _interop_require_default(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ function oneOf(...options) {
18
+ return Object.assign((value = true)=>{
19
+ for (let option of options){
20
+ let parsed = option(value);
21
+ if (parsed === value) {
22
+ return parsed;
14
23
  }
24
+ }
25
+ throw new Error("...");
26
+ }, {
27
+ manualParsing: true
28
+ });
29
+ }
30
+ let commands = {
31
+ init: {
32
+ run: _init.init,
33
+ args: {
34
+ "--esm": {
35
+ type: Boolean,
36
+ description: `Initialize configuration file as ESM`
37
+ },
38
+ "--ts": {
39
+ type: Boolean,
40
+ description: `Initialize configuration file as TypeScript`
41
+ },
42
+ "--postcss": {
43
+ type: Boolean,
44
+ description: `Initialize a \`postcss.config.js\` file`
45
+ },
46
+ "--full": {
47
+ type: Boolean,
48
+ description: `Include the default values for all options in the generated configuration file`
49
+ },
50
+ "-f": "--full",
51
+ "-p": "--postcss"
52
+ }
53
+ },
54
+ build: {
55
+ run: _build.build,
56
+ args: {
57
+ "--input": {
58
+ type: String,
59
+ description: "Input file"
60
+ },
61
+ "--output": {
62
+ type: String,
63
+ description: "Output file"
64
+ },
65
+ "--watch": {
66
+ type: oneOf(String, Boolean),
67
+ description: "Watch for changes and rebuild as needed"
68
+ },
69
+ "--poll": {
70
+ type: Boolean,
71
+ description: "Use polling instead of filesystem events when watching"
72
+ },
73
+ "--content": {
74
+ type: String,
75
+ description: "Content paths to use for removing unused classes"
76
+ },
77
+ "--purge": {
78
+ type: String,
79
+ deprecated: true
80
+ },
81
+ "--postcss": {
82
+ type: oneOf(String, Boolean),
83
+ description: "Load custom PostCSS configuration"
84
+ },
85
+ "--minify": {
86
+ type: Boolean,
87
+ description: "Minify the output"
88
+ },
89
+ "--config": {
90
+ type: String,
91
+ description: "Path to a custom config file"
92
+ },
93
+ "--no-autoprefixer": {
94
+ deprecated: true,
95
+ type: Boolean,
96
+ description: "Disable autoprefixer"
97
+ },
98
+ "-c": "--config",
99
+ "-i": "--input",
100
+ "-o": "--output",
101
+ "-m": "--minify",
102
+ "-w": "--watch",
103
+ "-p": "--poll"
104
+ }
105
+ }
106
+ };
107
+ let sharedFlags = {
108
+ "--help": {
109
+ type: Boolean,
110
+ description: "Display usage information"
111
+ },
112
+ "-h": "--help"
113
+ };
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
+ (0, _help.help)({
116
+ usage: [
117
+ "tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
118
+ "tailwindcss init [--full] [--postcss] [options...]"
119
+ ],
120
+ commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
121
+ options: {
122
+ ...commands.build.args,
123
+ ...sharedFlags
124
+ }
125
+ });
126
+ process.exit(0);
127
+ }
128
+ let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
129
+ if (commands[command] === undefined) {
130
+ if (_fs.default.existsSync(_path.default.resolve(command))) {
131
+ // TODO: Deprecate this in future versions
132
+ // Check if non-existing command, might be a file.
133
+ command = "build";
134
+ } else {
135
+ (0, _help.help)({
136
+ message: `Invalid command: ${command}`,
137
+ usage: [
138
+ "tailwindcss <command> [options]"
139
+ ],
140
+ commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
141
+ options: sharedFlags
15
142
  });
143
+ process.exit(1);
144
+ }
145
+ }
146
+ // Execute command
147
+ let { args: flags , run } = commands[command];
148
+ let args = (()=>{
149
+ try {
150
+ let result = (0, _arg.default)(Object.fromEntries(Object.entries({
151
+ ...flags,
152
+ ...sharedFlags
153
+ }).filter(([_key, value])=>{
154
+ var _value_type;
155
+ return !(value === null || value === void 0 ? void 0 : (_value_type = value.type) === null || _value_type === void 0 ? void 0 : _value_type.manualParsing);
156
+ }).map(([key, value])=>[
157
+ key,
158
+ typeof value === "object" ? value.type : value
159
+ ])), {
160
+ permissive: true
161
+ });
162
+ // Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
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
+ let handler = flags[flagName];
168
+ // Resolve flagName & handler
169
+ while(typeof handler === "string"){
170
+ flagName = handler;
171
+ handler = flags[handler];
172
+ }
173
+ if (!handler) continue;
174
+ let args = [];
175
+ let offset = i + 1;
176
+ // --flag value syntax was used so we need to pull `value` from `args`
177
+ if (flagValue === undefined) {
178
+ // Parse args for current flag
179
+ while(result["_"][offset] && !result["_"][offset].startsWith("-")){
180
+ args.push(result["_"][offset++]);
181
+ }
182
+ // Cleanup manually parsed flags + args
183
+ result["_"].splice(i, 1 + args.length);
184
+ // No args were provided, use default value defined in handler
185
+ // One arg was provided, use that directly
186
+ // Multiple args were provided so pass them all in an array
187
+ flagValue = args.length === 0 ? undefined : args.length === 1 ? args[0] : args;
188
+ } else {
189
+ // Remove the whole flag from the args array
190
+ result["_"].splice(i, 1);
191
+ }
192
+ // Set the resolved value in the `result` object
193
+ result[flagName] = handler.type(flagValue, flagName);
194
+ }
195
+ // Ensure that the `command` is always the first argument in the `args`.
196
+ // This is important so that we don't have to check if a default command
197
+ // (build) was used or not from within each plugin.
198
+ //
199
+ // E.g.: tailwindcss input.css -> _: ['build', 'input.css']
200
+ // E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
201
+ if (result["_"][0] !== command) {
202
+ result["_"].unshift(command);
203
+ }
204
+ return result;
205
+ } catch (err) {
206
+ if (err.code === "ARG_UNKNOWN_OPTION") {
207
+ (0, _help.help)({
208
+ message: err.message,
209
+ usage: [
210
+ "tailwindcss <command> [options]"
211
+ ],
212
+ options: sharedFlags
213
+ });
214
+ process.exit(1);
215
+ }
216
+ throw err;
217
+ }
218
+ })();
219
+ if (args["--help"]) {
220
+ (0, _help.help)({
221
+ options: {
222
+ ...flags,
223
+ ...sharedFlags
224
+ },
225
+ usage: [
226
+ `tailwindcss ${command} [options]`
227
+ ]
16
228
  });
17
- return from;
229
+ process.exit(0);
18
230
  }
231
+ run(args);
@@ -5,35 +5,52 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "init", {
7
7
  enumerable: true,
8
- get: ()=>init
8
+ get: function() {
9
+ return init;
10
+ }
9
11
  });
10
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
11
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
12
- function _interopRequireDefault(obj) {
12
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
13
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
14
+ function _interop_require_default(obj) {
13
15
  return obj && obj.__esModule ? obj : {
14
16
  default: obj
15
17
  };
16
18
  }
17
- function init(args, configs) {
19
+ function isESM() {
20
+ const pkgPath = _path.default.resolve("./package.json");
21
+ try {
22
+ let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, "utf8"));
23
+ return pkg.type && pkg.type === "module";
24
+ } catch (err) {
25
+ return false;
26
+ }
27
+ }
28
+ function init(args) {
18
29
  let messages = [];
19
- var ref;
20
- let tailwindConfigLocation = _path.default.resolve((ref = args["_"][1]) !== null && ref !== void 0 ? ref : `./${configs.tailwind}`);
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
+ var _args___;
34
+ let tailwindConfigLocation = _path.default.resolve((_args___ = args["_"][1]) !== null && _args___ !== void 0 ? _args___ : `./tailwind.config.${extension}`);
21
35
  if (_fs.default.existsSync(tailwindConfigLocation)) {
22
36
  messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
23
37
  } else {
24
- let stubFile = _fs.default.readFileSync(args["--full"] ? _path.default.resolve(__dirname, "../../../stubs/defaultConfig.stub.js") : _path.default.resolve(__dirname, "../../../stubs/simpleConfig.stub.js"), "utf8");
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");
25
40
  // Change colors import
26
- stubFile = stubFile.replace("../colors", "tailwindcss/colors");
41
+ stubContentsFile = stubContentsFile.replace("../colors", "tailwindcss/colors");
42
+ // Replace contents of {ts,js,cjs} file with the stub {simple,full}.
43
+ stubFile = stubFile.replace("__CONFIG__", stubContentsFile.replace("module.exports =", "").trim()).trim() + "\n\n";
27
44
  _fs.default.writeFileSync(tailwindConfigLocation, stubFile, "utf8");
28
45
  messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
29
46
  }
30
47
  if (args["--postcss"]) {
31
- let postcssConfigLocation = _path.default.resolve(`./${configs.postcss}`);
48
+ let postcssConfigLocation = _path.default.resolve("./postcss.config.js");
32
49
  if (_fs.default.existsSync(postcssConfigLocation)) {
33
50
  messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
34
51
  } else {
35
- let stubFile1 = _fs.default.readFileSync(_path.default.resolve(__dirname, "../../../stubs/defaultPostCssConfig.stub.js"), "utf8");
36
- _fs.default.writeFileSync(postcssConfigLocation, stubFile1, "utf8");
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");
37
54
  messages.push(`Created PostCSS config file: ${_path.default.basename(postcssConfigLocation)}`);
38
55
  }
39
56
  }
package/lib/cli.js CHANGED
@@ -1,229 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
7
- const _arg = /*#__PURE__*/ _interopRequireDefault(require("arg"));
8
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
9
- const _build = require("./cli/build");
10
- const _help = require("./cli/help");
11
- const _init = require("./cli/init");
12
- function _interopRequireDefault(obj) {
13
- return obj && obj.__esModule ? obj : {
14
- default: obj
15
- };
16
- }
17
- function isESM() {
18
- const pkgPath = _path.default.resolve("./package.json");
19
- try {
20
- let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, "utf8"));
21
- return pkg.type && pkg.type === "module";
22
- } catch (err) {
23
- return false;
24
- }
25
- }
26
- let configs = isESM() ? {
27
- tailwind: "tailwind.config.cjs",
28
- postcss: "postcss.config.cjs"
29
- } : {
30
- tailwind: "tailwind.config.js",
31
- postcss: "postcss.config.js"
32
- };
33
- // ---
34
- function oneOf(...options) {
35
- return Object.assign((value = true)=>{
36
- for (let option of options){
37
- let parsed = option(value);
38
- if (parsed === value) {
39
- return parsed;
40
- }
41
- }
42
- throw new Error("...");
43
- }, {
44
- manualParsing: true
45
- });
46
- }
47
- let commands = {
48
- init: {
49
- run: _init.init,
50
- args: {
51
- "--full": {
52
- type: Boolean,
53
- description: `Initialize a full \`${configs.tailwind}\` file`
54
- },
55
- "--postcss": {
56
- type: Boolean,
57
- description: `Initialize a \`${configs.postcss}\` file`
58
- },
59
- "-f": "--full",
60
- "-p": "--postcss"
61
- }
62
- },
63
- build: {
64
- run: _build.build,
65
- args: {
66
- "--input": {
67
- type: String,
68
- description: "Input file"
69
- },
70
- "--output": {
71
- type: String,
72
- description: "Output file"
73
- },
74
- "--watch": {
75
- type: Boolean,
76
- description: "Watch for changes and rebuild as needed"
77
- },
78
- "--poll": {
79
- type: Boolean,
80
- description: "Use polling instead of filesystem events when watching"
81
- },
82
- "--content": {
83
- type: String,
84
- description: "Content paths to use for removing unused classes"
85
- },
86
- "--purge": {
87
- type: String,
88
- deprecated: true
89
- },
90
- "--postcss": {
91
- type: oneOf(String, Boolean),
92
- description: "Load custom PostCSS configuration"
93
- },
94
- "--minify": {
95
- type: Boolean,
96
- description: "Minify the output"
97
- },
98
- "--config": {
99
- type: String,
100
- description: "Path to a custom config file"
101
- },
102
- "--no-autoprefixer": {
103
- type: Boolean,
104
- description: "Disable autoprefixer"
105
- },
106
- "-c": "--config",
107
- "-i": "--input",
108
- "-o": "--output",
109
- "-m": "--minify",
110
- "-w": "--watch",
111
- "-p": "--poll"
112
- }
113
- }
114
- };
115
- let sharedFlags = {
116
- "--help": {
117
- type: Boolean,
118
- description: "Display usage information"
119
- },
120
- "-h": "--help"
121
- };
122
- if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
123
- (0, _help.help)({
124
- usage: [
125
- "tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
126
- "tailwindcss init [--full] [--postcss] [options...]"
127
- ],
128
- commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
129
- options: {
130
- ...commands.build.args,
131
- ...sharedFlags
132
- }
133
- });
134
- process.exit(0);
135
- }
136
- let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
137
- if (commands[command] === undefined) {
138
- if (_fs.default.existsSync(_path.default.resolve(command))) {
139
- // TODO: Deprecate this in future versions
140
- // Check if non-existing command, might be a file.
141
- command = "build";
142
- } else {
143
- (0, _help.help)({
144
- message: `Invalid command: ${command}`,
145
- usage: [
146
- "tailwindcss <command> [options]"
147
- ],
148
- commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
149
- options: sharedFlags
150
- });
151
- process.exit(1);
152
- }
153
- }
154
- // Execute command
155
- let { args: flags , run } = commands[command];
156
- let args = (()=>{
157
- try {
158
- let result = (0, _arg.default)(Object.fromEntries(Object.entries({
159
- ...flags,
160
- ...sharedFlags
161
- }).filter(([_key, value])=>{
162
- var ref;
163
- return !(value === null || value === void 0 ? void 0 : (ref = value.type) === null || ref === void 0 ? void 0 : ref.manualParsing);
164
- }).map(([key, value])=>[
165
- key,
166
- typeof value === "object" ? value.type : value
167
- ])), {
168
- permissive: true
169
- });
170
- // Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
171
- for(let i = result["_"].length - 1; i >= 0; --i){
172
- let flag = result["_"][i];
173
- if (!flag.startsWith("-")) continue;
174
- let flagName = flag;
175
- let handler = flags[flag];
176
- // Resolve flagName & handler
177
- while(typeof handler === "string"){
178
- flagName = handler;
179
- handler = flags[handler];
180
- }
181
- if (!handler) continue;
182
- let args = [];
183
- let offset = i + 1;
184
- // Parse args for current flag
185
- while(result["_"][offset] && !result["_"][offset].startsWith("-")){
186
- args.push(result["_"][offset++]);
187
- }
188
- // Cleanup manually parsed flags + args
189
- result["_"].splice(i, 1 + args.length);
190
- // Set the resolved value in the `result` object
191
- result[flagName] = handler.type(args.length === 0 ? undefined : args.length === 1 ? args[0] : args, flagName);
192
- }
193
- // Ensure that the `command` is always the first argument in the `args`.
194
- // This is important so that we don't have to check if a default command
195
- // (build) was used or not from within each plugin.
196
- //
197
- // E.g.: tailwindcss input.css -> _: ['build', 'input.css']
198
- // E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
199
- if (result["_"][0] !== command) {
200
- result["_"].unshift(command);
201
- }
202
- return result;
203
- } catch (err) {
204
- if (err.code === "ARG_UNKNOWN_OPTION") {
205
- (0, _help.help)({
206
- message: err.message,
207
- usage: [
208
- "tailwindcss <command> [options]"
209
- ],
210
- options: sharedFlags
211
- });
212
- process.exit(1);
213
- }
214
- throw err;
215
- }
216
- })();
217
- if (args["--help"]) {
218
- (0, _help.help)({
219
- options: {
220
- ...flags,
221
- ...sharedFlags
222
- },
223
- usage: [
224
- `tailwindcss ${command} [options]`
225
- ]
226
- });
227
- process.exit(0);
228
- }
229
- run(args, configs);
3
+ module.exports = require("./cli/index");
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>_default
7
+ get: function() {
8
+ return _default;
9
+ }
8
10
  });
9
11
  const _default = [
10
12
  "preflight",
@@ -27,6 +29,7 @@ const _default = [
27
29
  "clear",
28
30
  "margin",
29
31
  "boxSizing",
32
+ "lineClamp",
30
33
  "display",
31
34
  "aspectRatio",
32
35
  "height",
@@ -40,6 +43,7 @@ const _default = [
40
43
  "flexGrow",
41
44
  "flexBasis",
42
45
  "tableLayout",
46
+ "captionSide",
43
47
  "borderCollapse",
44
48
  "borderSpacing",
45
49
  "transformOrigin",
@@ -60,6 +64,7 @@ const _default = [
60
64
  "scrollPadding",
61
65
  "listStylePosition",
62
66
  "listStyleType",
67
+ "listStyleImage",
63
68
  "appearance",
64
69
  "columns",
65
70
  "breakBefore",
@@ -91,7 +96,9 @@ const _default = [
91
96
  "overscrollBehavior",
92
97
  "scrollBehavior",
93
98
  "textOverflow",
99
+ "hyphens",
94
100
  "whitespace",
101
+ "textWrap",
95
102
  "wordBreak",
96
103
  "borderRadius",
97
104
  "borderWidth",