tailwindcss 0.0.0-insiders.ea10bb9 → 0.0.0-insiders.ea4e1cd

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 (184) hide show
  1. package/README.md +1 -1
  2. package/lib/cli/build/deps.js +17 -9
  3. package/lib/cli/build/index.js +20 -10
  4. package/lib/cli/build/plugin.js +86 -70
  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 +222 -10
  9. package/lib/cli/init/index.js +29 -12
  10. package/lib/cli-peer-dependencies.js +12 -4
  11. package/lib/cli.js +4 -226
  12. package/lib/corePluginList.js +7 -1
  13. package/lib/corePlugins.js +348 -75
  14. package/lib/css/preflight.css +2 -0
  15. package/lib/featureFlags.js +27 -15
  16. package/lib/index.js +1 -47
  17. package/lib/lib/cacheInvalidation.js +7 -5
  18. package/lib/lib/collapseAdjacentRules.js +5 -3
  19. package/lib/lib/collapseDuplicateDeclarations.js +12 -10
  20. package/lib/lib/content.js +34 -30
  21. package/lib/lib/defaultExtractor.js +15 -8
  22. package/lib/lib/detectNesting.js +10 -2
  23. package/lib/lib/evaluateTailwindFunctions.js +22 -20
  24. package/lib/lib/expandApplyAtRules.js +43 -35
  25. package/lib/lib/expandTailwindAtRules.js +46 -19
  26. package/lib/lib/findAtConfigPath.js +9 -7
  27. package/lib/lib/generateRules.js +157 -92
  28. package/lib/lib/getModuleDependencies.js +85 -37
  29. package/lib/lib/load-config.js +42 -0
  30. package/lib/lib/normalizeTailwindDirectives.js +5 -3
  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 +190 -131
  37. package/lib/lib/setupTrackingContext.js +49 -26
  38. package/lib/lib/sharedState.js +37 -10
  39. package/lib/lib/substituteScreenAtRules.js +5 -3
  40. package/lib/oxide/cli/build/deps.js +89 -0
  41. package/lib/oxide/cli/build/index.js +53 -0
  42. package/lib/oxide/cli/build/plugin.js +375 -0
  43. package/lib/oxide/cli/build/utils.js +87 -0
  44. package/lib/oxide/cli/build/watching.js +179 -0
  45. package/lib/oxide/cli/help/index.js +72 -0
  46. package/lib/oxide/cli/index.js +214 -0
  47. package/lib/oxide/cli/init/index.js +52 -0
  48. package/lib/oxide/cli.js +5 -0
  49. package/lib/oxide/postcss-plugin.js +2 -0
  50. package/lib/plugin.js +98 -0
  51. package/lib/postcss-plugins/nesting/index.js +3 -1
  52. package/lib/postcss-plugins/nesting/plugin.js +10 -8
  53. package/lib/processTailwindFeatures.js +14 -12
  54. package/lib/public/colors.js +49 -25
  55. package/lib/public/create-plugin.js +5 -3
  56. package/lib/public/default-config.js +6 -4
  57. package/lib/public/default-theme.js +6 -4
  58. package/lib/public/load-config.js +12 -0
  59. package/lib/public/resolve-config.js +6 -4
  60. package/lib/util/applyImportantSelector.js +36 -0
  61. package/lib/util/bigSign.js +3 -1
  62. package/lib/util/buildMediaQuery.js +3 -1
  63. package/lib/util/cloneDeep.js +3 -1
  64. package/lib/util/cloneNodes.js +5 -3
  65. package/lib/util/color.js +30 -12
  66. package/lib/util/colorNames.js +752 -0
  67. package/lib/util/configurePlugins.js +3 -1
  68. package/lib/util/createPlugin.js +3 -1
  69. package/lib/util/createUtilityPlugin.js +7 -5
  70. package/lib/util/dataTypes.js +74 -17
  71. package/lib/util/defaults.js +9 -7
  72. package/lib/util/escapeClassName.js +10 -8
  73. package/lib/util/escapeCommas.js +3 -1
  74. package/lib/util/flattenColorPalette.js +3 -1
  75. package/lib/util/formatVariantSelector.js +138 -160
  76. package/lib/util/getAllConfigs.js +8 -6
  77. package/lib/util/hashConfig.js +6 -4
  78. package/lib/util/isKeyframeRule.js +3 -1
  79. package/lib/util/isPlainObject.js +3 -1
  80. package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
  81. package/lib/util/log.js +8 -4
  82. package/lib/util/nameClass.js +12 -6
  83. package/lib/util/negateValue.js +4 -2
  84. package/lib/util/normalizeConfig.js +28 -27
  85. package/lib/util/normalizeScreens.js +12 -4
  86. package/lib/util/parseAnimationValue.js +3 -1
  87. package/lib/util/parseBoxShadowValue.js +6 -2
  88. package/lib/util/parseDependency.js +3 -1
  89. package/lib/util/parseGlob.js +6 -4
  90. package/lib/util/parseObjectStyles.js +9 -7
  91. package/lib/util/pluginUtils.js +54 -54
  92. package/lib/util/prefixSelector.js +27 -11
  93. package/lib/util/pseudoElements.js +229 -0
  94. package/lib/util/removeAlphaVariables.js +3 -1
  95. package/lib/util/resolveConfig.js +17 -15
  96. package/lib/util/resolveConfigPath.js +26 -10
  97. package/lib/util/responsive.js +6 -4
  98. package/lib/util/splitAtTopLevelOnly.js +10 -2
  99. package/lib/util/tap.js +3 -1
  100. package/lib/util/toColorValue.js +3 -1
  101. package/lib/util/toPath.js +3 -1
  102. package/lib/util/transformThemeValue.js +6 -4
  103. package/lib/util/validateConfig.js +16 -3
  104. package/lib/util/validateFormalSyntax.js +3 -1
  105. package/lib/util/withAlphaVariable.js +6 -2
  106. package/loadConfig.d.ts +4 -0
  107. package/loadConfig.js +2 -0
  108. package/package.json +45 -37
  109. package/peers/index.js +63324 -46417
  110. package/resolveConfig.d.ts +11 -2
  111. package/scripts/swap-engines.js +40 -0
  112. package/src/cli/build/index.js +13 -9
  113. package/src/cli/build/plugin.js +42 -32
  114. package/src/cli/build/watching.js +4 -2
  115. package/src/cli/index.js +216 -3
  116. package/src/cli/init/index.js +37 -8
  117. package/src/cli.js +4 -220
  118. package/src/corePluginList.js +1 -1
  119. package/src/corePlugins.js +207 -32
  120. package/src/css/preflight.css +2 -0
  121. package/src/featureFlags.js +6 -0
  122. package/src/index.js +1 -47
  123. package/src/lib/content.js +12 -17
  124. package/src/lib/defaultExtractor.js +9 -3
  125. package/src/lib/detectNesting.js +9 -1
  126. package/src/lib/expandApplyAtRules.js +8 -1
  127. package/src/lib/expandTailwindAtRules.js +36 -7
  128. package/src/lib/generateRules.js +124 -42
  129. package/src/lib/getModuleDependencies.js +70 -30
  130. package/src/lib/load-config.ts +31 -0
  131. package/src/lib/offsets.js +104 -1
  132. package/src/lib/remap-bitfield.js +82 -0
  133. package/src/lib/setupContextUtils.js +103 -54
  134. package/src/lib/setupTrackingContext.js +36 -11
  135. package/src/lib/sharedState.js +15 -4
  136. package/src/oxide/cli/build/deps.ts +91 -0
  137. package/src/oxide/cli/build/index.ts +47 -0
  138. package/src/oxide/cli/build/plugin.ts +442 -0
  139. package/src/oxide/cli/build/utils.ts +74 -0
  140. package/src/oxide/cli/build/watching.ts +225 -0
  141. package/src/oxide/cli/help/index.ts +69 -0
  142. package/src/oxide/cli/index.ts +204 -0
  143. package/src/oxide/cli/init/index.ts +59 -0
  144. package/src/oxide/cli.ts +1 -0
  145. package/src/oxide/postcss-plugin.ts +1 -0
  146. package/src/plugin.js +107 -0
  147. package/src/public/colors.js +22 -0
  148. package/src/public/default-config.js +1 -1
  149. package/src/public/default-theme.js +2 -2
  150. package/src/public/load-config.js +2 -0
  151. package/src/util/applyImportantSelector.js +27 -0
  152. package/src/util/color.js +18 -3
  153. package/src/util/colorNames.js +150 -0
  154. package/src/util/dataTypes.js +33 -4
  155. package/src/util/formatVariantSelector.js +160 -163
  156. package/src/util/getAllConfigs.js +2 -2
  157. package/src/util/negateValue.js +1 -1
  158. package/src/util/normalizeConfig.js +2 -1
  159. package/src/util/pluginUtils.js +16 -31
  160. package/src/util/prefixSelector.js +28 -10
  161. package/src/util/pseudoElements.js +170 -0
  162. package/src/util/resolveConfigPath.js +12 -1
  163. package/src/util/splitAtTopLevelOnly.js +8 -1
  164. package/src/util/validateConfig.js +13 -0
  165. package/stubs/.gitignore +1 -0
  166. package/stubs/.prettierrc.json +6 -0
  167. package/stubs/{defaultConfig.stub.js → config.full.js} +183 -146
  168. package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -1
  169. package/stubs/postcss.config.js +6 -0
  170. package/stubs/tailwind.config.cjs +2 -0
  171. package/stubs/tailwind.config.js +2 -0
  172. package/stubs/tailwind.config.ts +3 -0
  173. package/types/config.d.ts +15 -9
  174. package/types/generated/colors.d.ts +22 -0
  175. package/types/generated/corePluginList.d.ts +1 -1
  176. package/types/generated/default-theme.d.ts +108 -79
  177. package/CHANGELOG.md +0 -2336
  178. package/lib/cli/shared.js +0 -12
  179. package/lib/constants.js +0 -44
  180. package/scripts/install-integrations.js +0 -27
  181. package/scripts/rebuildFixtures.js +0 -68
  182. package/src/cli/shared.js +0 -5
  183. package/src/constants.js +0 -17
  184. /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
package/lib/cli/index.js CHANGED
@@ -1,18 +1,230 @@
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
+ type: Boolean,
95
+ description: "Disable autoprefixer"
96
+ },
97
+ "-c": "--config",
98
+ "-i": "--input",
99
+ "-o": "--output",
100
+ "-m": "--minify",
101
+ "-w": "--watch",
102
+ "-p": "--poll"
103
+ }
104
+ }
105
+ };
106
+ let sharedFlags = {
107
+ "--help": {
108
+ type: Boolean,
109
+ description: "Display usage information"
110
+ },
111
+ "-h": "--help"
112
+ };
113
+ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
114
+ (0, _help.help)({
115
+ usage: [
116
+ "tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
117
+ "tailwindcss init [--full] [--postcss] [options...]"
118
+ ],
119
+ commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
120
+ options: {
121
+ ...commands.build.args,
122
+ ...sharedFlags
123
+ }
124
+ });
125
+ process.exit(0);
126
+ }
127
+ let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
128
+ if (commands[command] === undefined) {
129
+ if (_fs.default.existsSync(_path.default.resolve(command))) {
130
+ // TODO: Deprecate this in future versions
131
+ // Check if non-existing command, might be a file.
132
+ command = "build";
133
+ } else {
134
+ (0, _help.help)({
135
+ message: `Invalid command: ${command}`,
136
+ usage: [
137
+ "tailwindcss <command> [options]"
138
+ ],
139
+ commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
140
+ options: sharedFlags
15
141
  });
142
+ process.exit(1);
143
+ }
144
+ }
145
+ // Execute command
146
+ let { args: flags , run } = commands[command];
147
+ let args = (()=>{
148
+ try {
149
+ let result = (0, _arg.default)(Object.fromEntries(Object.entries({
150
+ ...flags,
151
+ ...sharedFlags
152
+ }).filter(([_key, value])=>{
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);
155
+ }).map(([key, value])=>[
156
+ key,
157
+ typeof value === "object" ? value.type : value
158
+ ])), {
159
+ permissive: true
160
+ });
161
+ // Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
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("=");
166
+ let handler = flags[flagName];
167
+ // Resolve flagName & handler
168
+ while(typeof handler === "string"){
169
+ flagName = handler;
170
+ handler = flags[handler];
171
+ }
172
+ if (!handler) continue;
173
+ let args = [];
174
+ let offset = i + 1;
175
+ // --flag value syntax was used so we need to pull `value` from `args`
176
+ if (flagValue === undefined) {
177
+ // Parse args for current flag
178
+ while(result["_"][offset] && !result["_"][offset].startsWith("-")){
179
+ args.push(result["_"][offset++]);
180
+ }
181
+ // Cleanup manually parsed flags + args
182
+ result["_"].splice(i, 1 + args.length);
183
+ // No args were provided, use default value defined in handler
184
+ // One arg was provided, use that directly
185
+ // Multiple args were provided so pass them all in an array
186
+ flagValue = args.length === 0 ? undefined : args.length === 1 ? args[0] : args;
187
+ } else {
188
+ // Remove the whole flag from the args array
189
+ result["_"].splice(i, 1);
190
+ }
191
+ // Set the resolved value in the `result` object
192
+ result[flagName] = handler.type(flagValue, flagName);
193
+ }
194
+ // Ensure that the `command` is always the first argument in the `args`.
195
+ // This is important so that we don't have to check if a default command
196
+ // (build) was used or not from within each plugin.
197
+ //
198
+ // E.g.: tailwindcss input.css -> _: ['build', 'input.css']
199
+ // E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
200
+ if (result["_"][0] !== command) {
201
+ result["_"].unshift(command);
202
+ }
203
+ return result;
204
+ } catch (err) {
205
+ if (err.code === "ARG_UNKNOWN_OPTION") {
206
+ (0, _help.help)({
207
+ message: err.message,
208
+ usage: [
209
+ "tailwindcss <command> [options]"
210
+ ],
211
+ options: sharedFlags
212
+ });
213
+ process.exit(1);
214
+ }
215
+ throw err;
216
+ }
217
+ })();
218
+ if (args["--help"]) {
219
+ (0, _help.help)({
220
+ options: {
221
+ ...flags,
222
+ ...sharedFlags
223
+ },
224
+ usage: [
225
+ `tailwindcss ${command} [options]`
226
+ ]
16
227
  });
17
- return from;
228
+ process.exit(0);
18
229
  }
230
+ 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
  }
@@ -9,10 +9,18 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- lazyPostcss: ()=>lazyPostcss,
13
- lazyPostcssImport: ()=>lazyPostcssImport,
14
- lazyAutoprefixer: ()=>lazyAutoprefixer,
15
- lazyCssnano: ()=>lazyCssnano
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
+ }
16
24
  });
17
25
  function lazyPostcss() {
18
26
  return require("postcss");
package/lib/cli.js CHANGED
@@ -1,229 +1,7 @@
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
- };
3
+ if (false) {
4
+ module.exports = require("./oxide/cli");
5
+ } else {
6
+ module.exports = require("./cli/index");
16
7
  }
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);
@@ -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,6 +96,7 @@ const _default = [
91
96
  "overscrollBehavior",
92
97
  "scrollBehavior",
93
98
  "textOverflow",
99
+ "hyphens",
94
100
  "whitespace",
95
101
  "wordBreak",
96
102
  "borderRadius",