tailwindcss 0.0.0-insiders.fb796cd → 0.0.0-insiders.fb85c8f

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 (189) hide show
  1. package/README.md +1 -1
  2. package/index.css +5 -0
  3. package/lib/cli/build/index.js +24 -19
  4. package/lib/cli/build/plugin.js +178 -125
  5. package/lib/cli/build/utils.js +31 -21
  6. package/lib/cli/build/watching.js +22 -20
  7. package/lib/cli/help/index.js +17 -15
  8. package/lib/cli/index.js +63 -62
  9. package/lib/cli/init/index.js +22 -20
  10. package/lib/cli.js +1 -5
  11. package/lib/corePluginList.js +7 -2
  12. package/lib/corePlugins.js +2006 -1900
  13. package/lib/css/preflight.css +24 -7
  14. package/lib/featureFlags.js +32 -26
  15. package/lib/index.js +1 -5
  16. package/lib/lib/cacheInvalidation.js +13 -9
  17. package/lib/lib/collapseAdjacentRules.js +12 -8
  18. package/lib/lib/collapseDuplicateDeclarations.js +11 -9
  19. package/lib/lib/content.js +50 -20
  20. package/lib/lib/defaultExtractor.js +49 -37
  21. package/lib/lib/detectNesting.js +13 -11
  22. package/lib/lib/evaluateTailwindFunctions.js +42 -38
  23. package/lib/lib/expandApplyAtRules.js +62 -49
  24. package/lib/lib/expandTailwindAtRules.js +102 -58
  25. package/lib/lib/findAtConfigPath.js +11 -9
  26. package/lib/lib/generateRules.js +124 -104
  27. package/lib/lib/getModuleDependencies.js +33 -31
  28. package/lib/lib/handleImportAtRules.js +50 -0
  29. package/lib/lib/load-config.js +29 -12
  30. package/lib/lib/normalizeTailwindDirectives.js +26 -39
  31. package/lib/lib/offsets.js +53 -51
  32. package/lib/lib/partitionApplyAtRules.js +5 -3
  33. package/lib/lib/regex.js +26 -12
  34. package/lib/lib/remap-bitfield.js +3 -1
  35. package/lib/lib/resolveDefaultsAtRules.js +49 -45
  36. package/lib/lib/setupContextUtils.js +237 -213
  37. package/lib/lib/setupTrackingContext.js +30 -27
  38. package/lib/lib/sharedState.js +37 -36
  39. package/lib/lib/substituteScreenAtRules.js +9 -7
  40. package/lib/plugin.js +112 -44
  41. package/lib/postcss-plugins/nesting/index.js +5 -3
  42. package/lib/postcss-plugins/nesting/plugin.js +18 -16
  43. package/lib/processTailwindFeatures.js +19 -17
  44. package/lib/public/colors.js +269 -267
  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 +5 -3
  49. package/lib/public/resolve-config.js +6 -4
  50. package/lib/util/applyImportantSelector.js +27 -13
  51. package/lib/util/bigSign.js +3 -1
  52. package/lib/util/buildMediaQuery.js +5 -3
  53. package/lib/util/cloneDeep.js +4 -2
  54. package/lib/util/cloneNodes.js +36 -14
  55. package/lib/util/color.js +30 -26
  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 +8 -6
  60. package/lib/util/dataTypes.js +262 -121
  61. package/lib/util/defaults.js +6 -4
  62. package/lib/util/escapeClassName.js +7 -5
  63. package/lib/util/escapeCommas.js +4 -2
  64. package/lib/util/flattenColorPalette.js +5 -3
  65. package/lib/util/formatVariantSelector.js +54 -125
  66. package/lib/util/getAllConfigs.js +9 -7
  67. package/lib/util/hashConfig.js +6 -4
  68. package/lib/util/isKeyframeRule.js +4 -2
  69. package/lib/util/isPlainObject.js +5 -3
  70. package/lib/util/isSyntacticallyValidPropertyValue.js +13 -11
  71. package/lib/util/log.js +31 -10
  72. package/lib/util/nameClass.js +16 -10
  73. package/lib/util/negateValue.js +11 -9
  74. package/lib/util/normalizeConfig.js +91 -75
  75. package/lib/util/normalizeScreens.js +30 -22
  76. package/lib/util/parseAnimationValue.js +41 -39
  77. package/lib/util/parseBoxShadowValue.js +24 -20
  78. package/lib/util/parseDependency.js +7 -5
  79. package/lib/util/parseGlob.js +10 -8
  80. package/lib/util/parseObjectStyles.js +10 -8
  81. package/lib/util/pluginUtils.js +62 -39
  82. package/lib/util/prefixSelector.js +9 -7
  83. package/lib/util/pseudoElements.js +209 -0
  84. package/lib/util/removeAlphaVariables.js +4 -2
  85. package/lib/util/resolveConfig.js +60 -51
  86. package/lib/util/resolveConfigPath.js +15 -11
  87. package/lib/util/responsive.js +7 -5
  88. package/lib/util/splitAtTopLevelOnly.js +6 -4
  89. package/lib/util/tap.js +3 -1
  90. package/lib/util/toColorValue.js +4 -2
  91. package/lib/util/toPath.js +5 -3
  92. package/lib/util/transformThemeValue.js +30 -28
  93. package/lib/util/validateConfig.js +31 -7
  94. package/lib/util/validateFormalSyntax.js +8 -6
  95. package/lib/util/withAlphaVariable.js +11 -7
  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/nesting/index.d.ts +4 -0
  105. package/package.json +47 -59
  106. package/resolveConfig.d.ts +22 -3
  107. package/scripts/generate-types.js +1 -2
  108. package/scripts/release-notes.js +1 -1
  109. package/src/cli/build/index.js +4 -0
  110. package/src/cli/build/plugin.js +74 -52
  111. package/src/cli/build/watching.js +1 -1
  112. package/src/cli/index.js +1 -0
  113. package/src/cli.js +1 -5
  114. package/src/corePluginList.js +1 -1
  115. package/src/corePlugins.js +128 -28
  116. package/src/css/preflight.css +24 -7
  117. package/src/featureFlags.js +7 -14
  118. package/src/index.js +1 -5
  119. package/src/lib/content.js +33 -1
  120. package/src/lib/defaultExtractor.js +30 -17
  121. package/src/lib/evaluateTailwindFunctions.js +4 -1
  122. package/src/lib/expandApplyAtRules.js +13 -0
  123. package/src/lib/expandTailwindAtRules.js +76 -33
  124. package/src/lib/generateRules.js +42 -33
  125. package/src/lib/handleImportAtRules.js +34 -0
  126. package/src/lib/load-config.ts +17 -5
  127. package/src/lib/normalizeTailwindDirectives.js +0 -27
  128. package/src/lib/offsets.js +3 -3
  129. package/src/lib/setupContextUtils.js +58 -50
  130. package/src/lib/setupTrackingContext.js +2 -4
  131. package/src/lib/sharedState.js +10 -20
  132. package/src/plugin.js +86 -60
  133. package/src/processTailwindFeatures.js +3 -2
  134. package/src/util/applyImportantSelector.js +20 -12
  135. package/src/util/cloneNodes.js +35 -14
  136. package/src/util/color.js +2 -2
  137. package/src/util/colorNames.js +150 -0
  138. package/src/util/dataTypes.js +135 -24
  139. package/src/util/formatVariantSelector.js +13 -101
  140. package/src/util/isPlainObject.js +1 -1
  141. package/src/util/log.js +24 -0
  142. package/src/util/normalizeConfig.js +37 -27
  143. package/src/util/pluginUtils.js +17 -9
  144. package/src/util/prefixSelector.js +1 -0
  145. package/src/util/pseudoElements.js +167 -0
  146. package/src/util/resolveConfig.js +42 -24
  147. package/src/util/validateConfig.js +23 -0
  148. package/src/value-parser/LICENSE +22 -0
  149. package/src/value-parser/README.md +3 -0
  150. package/src/value-parser/index.d.ts +177 -0
  151. package/src/value-parser/index.js +28 -0
  152. package/src/value-parser/parse.js +303 -0
  153. package/src/value-parser/stringify.js +41 -0
  154. package/src/value-parser/unit.js +118 -0
  155. package/src/value-parser/walk.js +18 -0
  156. package/stubs/config.full.js +110 -15
  157. package/stubs/config.simple.js +1 -1
  158. package/stubs/postcss.config.cjs +0 -1
  159. package/stubs/postcss.config.js +0 -1
  160. package/types/config.d.ts +14 -15
  161. package/types/generated/corePluginList.d.ts +1 -1
  162. package/types/generated/default-theme.d.ts +59 -9
  163. package/types/index.d.ts +7 -3
  164. package/lib/cli/build/deps.js +0 -54
  165. package/lib/cli-peer-dependencies.js +0 -28
  166. package/lib/oxide/cli/build/deps.js +0 -81
  167. package/lib/oxide/cli/build/index.js +0 -51
  168. package/lib/oxide/cli/build/plugin.js +0 -373
  169. package/lib/oxide/cli/build/utils.js +0 -77
  170. package/lib/oxide/cli/build/watching.js +0 -177
  171. package/lib/oxide/cli/help/index.js +0 -70
  172. package/lib/oxide/cli/index.js +0 -214
  173. package/lib/oxide/cli/init/index.js +0 -50
  174. package/lib/oxide/cli.js +0 -5
  175. package/lib/oxide/postcss-plugin.js +0 -2
  176. package/peers/index.js +0 -79461
  177. package/scripts/swap-engines.js +0 -40
  178. package/src/cli/build/deps.js +0 -56
  179. package/src/cli-peer-dependencies.js +0 -15
  180. package/src/oxide/cli/build/deps.ts +0 -91
  181. package/src/oxide/cli/build/index.ts +0 -47
  182. package/src/oxide/cli/build/plugin.ts +0 -442
  183. package/src/oxide/cli/build/utils.ts +0 -74
  184. package/src/oxide/cli/build/watching.ts +0 -225
  185. package/src/oxide/cli/help/index.ts +0 -69
  186. package/src/oxide/cli/index.ts +0 -204
  187. package/src/oxide/cli/init/index.ts +0 -59
  188. package/src/oxide/cli.ts +0 -1
  189. package/src/oxide/postcss-plugin.ts +0 -1
@@ -10,41 +10,51 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- indentRecursive: ()=>indentRecursive,
14
- formatNodes: ()=>formatNodes,
15
- readFileWithRetries: ()=>readFileWithRetries,
16
- drainStdin: ()=>drainStdin,
17
- outputFile: ()=>outputFile
13
+ drainStdin: function() {
14
+ return drainStdin;
15
+ },
16
+ formatNodes: function() {
17
+ return formatNodes;
18
+ },
19
+ indentRecursive: function() {
20
+ return indentRecursive;
21
+ },
22
+ outputFile: function() {
23
+ return outputFile;
24
+ },
25
+ readFileWithRetries: function() {
26
+ return readFileWithRetries;
27
+ }
18
28
  });
19
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
20
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
21
- function _interopRequireDefault(obj) {
29
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
30
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
31
+ function _interop_require_default(obj) {
22
32
  return obj && obj.__esModule ? obj : {
23
33
  default: obj
24
34
  };
25
35
  }
26
36
  function indentRecursive(node, indent = 0) {
27
37
  node.each && node.each((child, i)=>{
28
- if (!child.raws.before || !child.raws.before.trim() || child.raws.before.includes("\n")) {
29
- child.raws.before = `\n${node.type !== "rule" && i > 0 ? "\n" : ""}${" ".repeat(indent)}`;
38
+ if (!child.raws.before || !child.raws.before.trim() || child.raws.before.includes('\n')) {
39
+ child.raws.before = `\n${node.type !== 'rule' && i > 0 ? '\n' : ''}${' '.repeat(indent)}`;
30
40
  }
31
- child.raws.after = `\n${" ".repeat(indent)}`;
41
+ child.raws.after = `\n${' '.repeat(indent)}`;
32
42
  indentRecursive(child, indent + 1);
33
43
  });
34
44
  }
35
45
  function formatNodes(root) {
36
46
  indentRecursive(root);
37
47
  if (root.first) {
38
- root.first.raws.before = "";
48
+ root.first.raws.before = '';
39
49
  }
40
50
  }
41
51
  async function readFileWithRetries(path, tries = 5) {
42
52
  for(let n = 0; n <= tries; n++){
43
53
  try {
44
- return await _fs.default.promises.readFile(path, "utf8");
54
+ return await _fs.default.promises.readFile(path, 'utf8');
45
55
  } catch (err) {
46
56
  if (n !== tries) {
47
- if (err.code === "ENOENT" || err.code === "EBUSY") {
57
+ if (err.code === 'ENOENT' || err.code === 'EBUSY') {
48
58
  await new Promise((resolve)=>setTimeout(resolve, 10));
49
59
  continue;
50
60
  }
@@ -55,24 +65,24 @@ async function readFileWithRetries(path, tries = 5) {
55
65
  }
56
66
  function drainStdin() {
57
67
  return new Promise((resolve, reject)=>{
58
- let result = "";
59
- process.stdin.on("data", (chunk)=>{
68
+ let result = '';
69
+ process.stdin.on('data', (chunk)=>{
60
70
  result += chunk;
61
71
  });
62
- process.stdin.on("end", ()=>resolve(result));
63
- process.stdin.on("error", (err)=>reject(err));
72
+ process.stdin.on('end', ()=>resolve(result));
73
+ process.stdin.on('error', (err)=>reject(err));
64
74
  });
65
75
  }
66
76
  async function outputFile(file, newContents) {
67
77
  try {
68
- let currentContents = await _fs.default.promises.readFile(file, "utf8");
78
+ let currentContents = await _fs.default.promises.readFile(file, 'utf8');
69
79
  if (currentContents === newContents) {
70
80
  return; // Skip writing the file
71
81
  }
72
- } catch {}
82
+ } catch (e) {}
73
83
  // Write the file
74
84
  await _fs.default.promises.mkdir(_path.default.dirname(file), {
75
85
  recursive: true
76
86
  });
77
- await _fs.default.promises.writeFile(file, newContents, "utf8");
87
+ await _fs.default.promises.writeFile(file, newContents, 'utf8');
78
88
  }
@@ -5,22 +5,24 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "createWatcher", {
7
7
  enumerable: true,
8
- get: ()=>createWatcher
8
+ get: function() {
9
+ return createWatcher;
10
+ }
9
11
  });
10
- const _chokidar = /*#__PURE__*/ _interopRequireDefault(require("chokidar"));
11
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
12
- const _micromatch = /*#__PURE__*/ _interopRequireDefault(require("micromatch"));
13
- const _normalizePath = /*#__PURE__*/ _interopRequireDefault(require("normalize-path"));
14
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
15
- const _utilsJs = require("./utils.js");
16
- function _interopRequireDefault(obj) {
12
+ const _chokidar = /*#__PURE__*/ _interop_require_default(require("chokidar"));
13
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
14
+ const _micromatch = /*#__PURE__*/ _interop_require_default(require("micromatch"));
15
+ const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
16
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
17
+ const _utils = require("./utils.js");
18
+ function _interop_require_default(obj) {
17
19
  return obj && obj.__esModule ? obj : {
18
20
  default: obj
19
21
  };
20
22
  }
21
- function createWatcher(args, { state , rebuild }) {
22
- let shouldPoll = args["--poll"];
23
- let shouldCoalesceWriteEvents = shouldPoll || process.platform === "win32";
23
+ function createWatcher(args, { state, rebuild }) {
24
+ let shouldPoll = args['--poll'];
25
+ let shouldCoalesceWriteEvents = shouldPoll || process.platform === 'win32';
24
26
  // Polling interval in milliseconds
25
27
  // Used only when polling or coalescing add/change events on Windows
26
28
  let pollInterval = 10;
@@ -86,7 +88,7 @@ function createWatcher(args, { state , rebuild }) {
86
88
  pendingRebuilds.add(file);
87
89
  changedContent.push({
88
90
  file,
89
- content: content !== null && content !== void 0 ? content : ()=>_fs.default.promises.readFile(file, "utf8"),
91
+ content: content !== null && content !== void 0 ? content : ()=>_fs.default.promises.readFile(file, 'utf8'),
90
92
  extension: _path.default.extname(file).slice(1)
91
93
  });
92
94
  if (_timer) {
@@ -105,13 +107,13 @@ function createWatcher(args, { state , rebuild }) {
105
107
  chain = chain.then(rebuildAndContinue, rebuildAndContinue);
106
108
  return chain;
107
109
  }
108
- watcher.on("change", (file)=>recordChangedFile(file));
109
- watcher.on("add", (file)=>recordChangedFile(file));
110
+ watcher.on('change', (file)=>recordChangedFile(file));
111
+ watcher.on('add', (file)=>recordChangedFile(file));
110
112
  // Restore watching any files that are "removed"
111
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)
112
114
  // TODO: An an optimization we should allow removal when the config changes
113
- watcher.on("unlink", (file)=>{
114
- file = (0, _normalizePath.default)(file);
115
+ watcher.on('unlink', (file)=>{
116
+ file = (0, _normalizepath.default)(file);
115
117
  // Only re-add the file if it's not covered by a dynamic pattern
116
118
  if (!_micromatch.default.some([
117
119
  file
@@ -123,8 +125,8 @@ function createWatcher(args, { state , rebuild }) {
123
125
  // will only fire a rename event for atomic writes and not a change event
124
126
  // This is very likely a chokidar bug but it's one we need to work around
125
127
  // We treat this as a change event and rebuild the CSS
126
- watcher.on("raw", (evt, filePath, meta)=>{
127
- if (evt !== "rename") {
128
+ watcher.on('raw', (evt, filePath, meta)=>{
129
+ if (evt !== 'rename' || filePath === null) {
128
130
  return;
129
131
  }
130
132
  let watchedPath = meta.watchedPath;
@@ -150,7 +152,7 @@ function createWatcher(args, { state , rebuild }) {
150
152
  // We need to read the file as early as possible outside of the chain
151
153
  // because it may be gone by the time we get to it. doing the read
152
154
  // immediately increases the chance that the file is still there
153
- let content = await (0, _utilsJs.readFileWithRetries)(_path.default.resolve(filePath));
155
+ let content = await (0, _utils.readFileWithRetries)(_path.default.resolve(filePath));
154
156
  if (content === undefined) {
155
157
  return;
156
158
  }
@@ -159,7 +161,7 @@ function createWatcher(args, { state , rebuild }) {
159
161
  // This is because the order of events and timing is different on Linux
160
162
  // @ts-ignore: TypeScript isn't picking up that content is a string here
161
163
  await recordChangedFile(filePath, ()=>content, true);
162
- } catch {
164
+ } catch (e) {
163
165
  // If reading the file fails, it's was probably a deleted temporary file
164
166
  // So we can ignore it and no rebuild is needed
165
167
  }
@@ -5,47 +5,49 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "help", {
7
7
  enumerable: true,
8
- get: ()=>help
8
+ get: function() {
9
+ return help;
10
+ }
9
11
  });
10
- const _packageJson = /*#__PURE__*/ _interopRequireDefault(require("../../../package.json"));
11
- function _interopRequireDefault(obj) {
12
+ const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../../package.json"));
13
+ function _interop_require_default(obj) {
12
14
  return obj && obj.__esModule ? obj : {
13
15
  default: obj
14
16
  };
15
17
  }
16
- function help({ message , usage , commands , options }) {
18
+ function help({ message, usage, commands, options }) {
17
19
  let indent = 2;
18
20
  // Render header
19
21
  console.log();
20
- console.log(`${_packageJson.default.name} v${_packageJson.default.version}`);
22
+ console.log(`${_packagejson.default.name} v${_packagejson.default.version}`);
21
23
  // Render message
22
24
  if (message) {
23
25
  console.log();
24
- for (let msg of message.split("\n")){
26
+ for (let msg of message.split('\n')){
25
27
  console.log(msg);
26
28
  }
27
29
  }
28
30
  // Render usage
29
31
  if (usage && usage.length > 0) {
30
32
  console.log();
31
- console.log("Usage:");
33
+ console.log('Usage:');
32
34
  for (let example of usage){
33
- console.log(" ".repeat(indent), example);
35
+ console.log(' '.repeat(indent), example);
34
36
  }
35
37
  }
36
38
  // Render commands
37
39
  if (commands && commands.length > 0) {
38
40
  console.log();
39
- console.log("Commands:");
41
+ console.log('Commands:');
40
42
  for (let command of commands){
41
- console.log(" ".repeat(indent), command);
43
+ console.log(' '.repeat(indent), command);
42
44
  }
43
45
  }
44
46
  // Render options
45
47
  if (options) {
46
48
  let groupedOptions = {};
47
49
  for (let [key, value] of Object.entries(options)){
48
- if (typeof value === "object") {
50
+ if (typeof value === 'object') {
49
51
  groupedOptions[key] = {
50
52
  ...value,
51
53
  flags: [
@@ -57,13 +59,13 @@ function help({ message , usage , commands , options }) {
57
59
  }
58
60
  }
59
61
  console.log();
60
- console.log("Options:");
61
- for (let { flags , description , deprecated } of Object.values(groupedOptions)){
62
+ console.log('Options:');
63
+ for (let { flags, description, deprecated } of Object.values(groupedOptions)){
62
64
  if (deprecated) continue;
63
65
  if (flags.length === 1) {
64
- console.log(" ".repeat(indent + 4 /* 4 = "-i, ".length */ ), flags.slice().reverse().join(", ").padEnd(20, " "), description);
66
+ console.log(' '.repeat(indent + 4 /* 4 = "-i, ".length */ ), flags.slice().reverse().join(', ').padEnd(20, ' '), description);
65
67
  } else {
66
- console.log(" ".repeat(indent), flags.slice().reverse().join(", ").padEnd(24, " "), description);
68
+ console.log(' '.repeat(indent), flags.slice().reverse().join(', ').padEnd(24, ' '), description);
67
69
  }
68
70
  }
69
71
  }
package/lib/cli/index.js CHANGED
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
7
- const _arg = /*#__PURE__*/ _interopRequireDefault(require("arg"));
8
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
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
9
  const _build = require("./build");
10
10
  const _help = require("./help");
11
11
  const _init = require("./init");
12
- function _interopRequireDefault(obj) {
12
+ function _interop_require_default(obj) {
13
13
  return obj && obj.__esModule ? obj : {
14
14
  default: obj
15
15
  };
@@ -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,92 +31,93 @@ let commands = {
31
31
  init: {
32
32
  run: _init.init,
33
33
  args: {
34
- "--esm": {
34
+ '--esm': {
35
35
  type: Boolean,
36
36
  description: `Initialize configuration file as ESM`
37
37
  },
38
- "--ts": {
38
+ '--ts': {
39
39
  type: Boolean,
40
40
  description: `Initialize configuration file as TypeScript`
41
41
  },
42
- "--postcss": {
42
+ '--postcss': {
43
43
  type: Boolean,
44
44
  description: `Initialize a \`postcss.config.js\` file`
45
45
  },
46
- "--full": {
46
+ '--full': {
47
47
  type: Boolean,
48
48
  description: `Include the default values for all options in the generated configuration file`
49
49
  },
50
- "-f": "--full",
51
- "-p": "--postcss"
50
+ '-f': '--full',
51
+ '-p': '--postcss'
52
52
  }
53
53
  },
54
54
  build: {
55
55
  run: _build.build,
56
56
  args: {
57
- "--input": {
57
+ '--input': {
58
58
  type: String,
59
- description: "Input file"
59
+ description: 'Input file'
60
60
  },
61
- "--output": {
61
+ '--output': {
62
62
  type: String,
63
- description: "Output file"
63
+ description: 'Output file'
64
64
  },
65
- "--watch": {
65
+ '--watch': {
66
66
  type: oneOf(String, Boolean),
67
- description: "Watch for changes and rebuild as needed"
67
+ description: 'Watch for changes and rebuild as needed'
68
68
  },
69
- "--poll": {
69
+ '--poll': {
70
70
  type: Boolean,
71
- description: "Use polling instead of filesystem events when watching"
71
+ description: 'Use polling instead of filesystem events when watching'
72
72
  },
73
- "--content": {
73
+ '--content': {
74
74
  type: String,
75
- description: "Content paths to use for removing unused classes"
75
+ description: 'Content paths to use for removing unused classes'
76
76
  },
77
- "--purge": {
77
+ '--purge': {
78
78
  type: String,
79
79
  deprecated: true
80
80
  },
81
- "--postcss": {
81
+ '--postcss': {
82
82
  type: oneOf(String, Boolean),
83
- description: "Load custom PostCSS configuration"
83
+ description: 'Load custom PostCSS configuration'
84
84
  },
85
- "--minify": {
85
+ '--minify': {
86
86
  type: Boolean,
87
- description: "Minify the output"
87
+ description: 'Minify the output'
88
88
  },
89
- "--config": {
89
+ '--config': {
90
90
  type: String,
91
- description: "Path to a custom config file"
91
+ description: 'Path to a custom config file'
92
92
  },
93
- "--no-autoprefixer": {
93
+ '--no-autoprefixer': {
94
+ deprecated: true,
94
95
  type: Boolean,
95
- description: "Disable autoprefixer"
96
+ description: 'Disable autoprefixer'
96
97
  },
97
- "-c": "--config",
98
- "-i": "--input",
99
- "-o": "--output",
100
- "-m": "--minify",
101
- "-w": "--watch",
102
- "-p": "--poll"
98
+ '-c': '--config',
99
+ '-i': '--input',
100
+ '-o': '--output',
101
+ '-m': '--minify',
102
+ '-w': '--watch',
103
+ '-p': '--poll'
103
104
  }
104
105
  }
105
106
  };
106
107
  let sharedFlags = {
107
- "--help": {
108
+ '--help': {
108
109
  type: Boolean,
109
- description: "Display usage information"
110
+ description: 'Display usage information'
110
111
  },
111
- "-h": "--help"
112
+ '-h': '--help'
112
113
  };
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))) {
114
115
  (0, _help.help)({
115
116
  usage: [
116
- "tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
117
- "tailwindcss init [--full] [--postcss] [options...]"
117
+ 'tailwindcss [--input input.css] [--output output.css] [--watch] [options...]',
118
+ 'tailwindcss init [--full] [--postcss] [options...]'
118
119
  ],
119
- commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
120
+ commands: Object.keys(commands).filter((command)=>command !== 'build').map((command)=>`${command} [options]`),
120
121
  options: {
121
122
  ...commands.build.args,
122
123
  ...sharedFlags
@@ -124,26 +125,26 @@ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.
124
125
  });
125
126
  process.exit(0);
126
127
  }
127
- let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
128
+ let command = ((arg = '')=>arg.startsWith('-') ? undefined : arg)(process.argv[2]) || 'build';
128
129
  if (commands[command] === undefined) {
129
130
  if (_fs.default.existsSync(_path.default.resolve(command))) {
130
131
  // TODO: Deprecate this in future versions
131
132
  // Check if non-existing command, might be a file.
132
- command = "build";
133
+ command = 'build';
133
134
  } else {
134
135
  (0, _help.help)({
135
136
  message: `Invalid command: ${command}`,
136
137
  usage: [
137
- "tailwindcss <command> [options]"
138
+ 'tailwindcss <command> [options]'
138
139
  ],
139
- commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
140
+ commands: Object.keys(commands).filter((command)=>command !== 'build').map((command)=>`${command} [options]`),
140
141
  options: sharedFlags
141
142
  });
142
143
  process.exit(1);
143
144
  }
144
145
  }
145
146
  // Execute command
146
- let { args: flags , run } = commands[command];
147
+ let { args: flags, run } = commands[command];
147
148
  let args = (()=>{
148
149
  try {
149
150
  let result = (0, _arg.default)(Object.fromEntries(Object.entries({
@@ -154,18 +155,18 @@ let args = (()=>{
154
155
  return !(value === null || value === void 0 ? void 0 : (_value_type = value.type) === null || _value_type === void 0 ? void 0 : _value_type.manualParsing);
155
156
  }).map(([key, value])=>[
156
157
  key,
157
- typeof value === "object" ? value.type : value
158
+ typeof value === 'object' ? value.type : value
158
159
  ])), {
159
160
  permissive: true
160
161
  });
161
162
  // 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("=");
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('=');
166
167
  let handler = flags[flagName];
167
168
  // Resolve flagName & handler
168
- while(typeof handler === "string"){
169
+ while(typeof handler === 'string'){
169
170
  flagName = handler;
170
171
  handler = flags[handler];
171
172
  }
@@ -175,18 +176,18 @@ let args = (()=>{
175
176
  // --flag value syntax was used so we need to pull `value` from `args`
176
177
  if (flagValue === undefined) {
177
178
  // Parse args for current flag
178
- while(result["_"][offset] && !result["_"][offset].startsWith("-")){
179
- args.push(result["_"][offset++]);
179
+ while(result['_'][offset] && !result['_'][offset].startsWith('-')){
180
+ args.push(result['_'][offset++]);
180
181
  }
181
182
  // Cleanup manually parsed flags + args
182
- result["_"].splice(i, 1 + args.length);
183
+ result['_'].splice(i, 1 + args.length);
183
184
  // No args were provided, use default value defined in handler
184
185
  // One arg was provided, use that directly
185
186
  // Multiple args were provided so pass them all in an array
186
187
  flagValue = args.length === 0 ? undefined : args.length === 1 ? args[0] : args;
187
188
  } else {
188
189
  // Remove the whole flag from the args array
189
- result["_"].splice(i, 1);
190
+ result['_'].splice(i, 1);
190
191
  }
191
192
  // Set the resolved value in the `result` object
192
193
  result[flagName] = handler.type(flagValue, flagName);
@@ -197,16 +198,16 @@ let args = (()=>{
197
198
  //
198
199
  // E.g.: tailwindcss input.css -> _: ['build', 'input.css']
199
200
  // E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
200
- if (result["_"][0] !== command) {
201
- result["_"].unshift(command);
201
+ if (result['_'][0] !== command) {
202
+ result['_'].unshift(command);
202
203
  }
203
204
  return result;
204
205
  } catch (err) {
205
- if (err.code === "ARG_UNKNOWN_OPTION") {
206
+ if (err.code === 'ARG_UNKNOWN_OPTION') {
206
207
  (0, _help.help)({
207
208
  message: err.message,
208
209
  usage: [
209
- "tailwindcss <command> [options]"
210
+ 'tailwindcss <command> [options]'
210
211
  ],
211
212
  options: sharedFlags
212
213
  });
@@ -215,7 +216,7 @@ let args = (()=>{
215
216
  throw err;
216
217
  }
217
218
  })();
218
- if (args["--help"]) {
219
+ if (args['--help']) {
219
220
  (0, _help.help)({
220
221
  options: {
221
222
  ...flags,
@@ -5,50 +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
19
  function isESM() {
18
- const pkgPath = _path.default.resolve("./package.json");
20
+ const pkgPath = _path.default.resolve('./package.json');
19
21
  try {
20
- let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, "utf8"));
21
- return pkg.type && pkg.type === "module";
22
+ let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, 'utf8'));
23
+ return pkg.type && pkg.type === 'module';
22
24
  } catch (err) {
23
25
  return false;
24
26
  }
25
27
  }
26
28
  function init(args) {
27
29
  let messages = [];
28
- let isProjectESM = args["--ts"] || args["--esm"] || isESM();
29
- let syntax = args["--ts"] ? "ts" : isProjectESM ? "js" : "cjs";
30
- let extension = args["--ts"] ? "ts" : "js";
30
+ let isProjectESM = args['--ts'] || args['--esm'] || isESM();
31
+ let syntax = args['--ts'] ? 'ts' : isProjectESM ? 'js' : 'cjs';
32
+ let extension = args['--ts'] ? 'ts' : 'js';
31
33
  var _args___;
32
- let tailwindConfigLocation = _path.default.resolve((_args___ = args["_"][1]) !== null && _args___ !== void 0 ? _args___ : `./tailwind.config.${extension}`);
34
+ let tailwindConfigLocation = _path.default.resolve((_args___ = args['_'][1]) !== null && _args___ !== void 0 ? _args___ : `./tailwind.config.${extension}`);
33
35
  if (_fs.default.existsSync(tailwindConfigLocation)) {
34
36
  messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
35
37
  } else {
36
- let stubContentsFile = _fs.default.readFileSync(args["--full"] ? _path.default.resolve(__dirname, "../../../stubs/config.full.js") : _path.default.resolve(__dirname, "../../../stubs/config.simple.js"), "utf8");
37
- let stubFile = _fs.default.readFileSync(_path.default.resolve(__dirname, `../../../stubs/tailwind.config.${syntax}`), "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');
38
40
  // Change colors import
39
- stubContentsFile = stubContentsFile.replace("../colors", "tailwindcss/colors");
41
+ stubContentsFile = stubContentsFile.replace('../colors', 'tailwindcss/colors');
40
42
  // Replace contents of {ts,js,cjs} file with the stub {simple,full}.
41
- stubFile = stubFile.replace("__CONFIG__", stubContentsFile.replace("module.exports =", "").trim()).trim() + "\n\n";
42
- _fs.default.writeFileSync(tailwindConfigLocation, stubFile, "utf8");
43
+ stubFile = stubFile.replace('__CONFIG__', stubContentsFile.replace('module.exports =', '').trim()).trim() + '\n\n';
44
+ _fs.default.writeFileSync(tailwindConfigLocation, stubFile, 'utf8');
43
45
  messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
44
46
  }
45
- if (args["--postcss"]) {
46
- let postcssConfigLocation = _path.default.resolve("./postcss.config.js");
47
+ if (args['--postcss']) {
48
+ let postcssConfigLocation = _path.default.resolve('./postcss.config.js');
47
49
  if (_fs.default.existsSync(postcssConfigLocation)) {
48
50
  messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
49
51
  } else {
50
- let stubFile1 = _fs.default.readFileSync(isProjectESM ? _path.default.resolve(__dirname, "../../../stubs/postcss.config.js") : _path.default.resolve(__dirname, "../../../stubs/postcss.config.cjs"), "utf8");
51
- _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');
52
54
  messages.push(`Created PostCSS config file: ${_path.default.basename(postcssConfigLocation)}`);
53
55
  }
54
56
  }
package/lib/cli.js CHANGED
@@ -1,7 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- if (process.env.OXIDE) {
4
- module.exports = require("./oxide/cli");
5
- } else {
6
- module.exports = require("./cli/index");
7
- }
3
+ module.exports = require('./cli/index');