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
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
@@ -8,24 +9,27 @@ Object.defineProperty(exports, // DISABLE_TOUCH = TRUE
8
9
  // plugins) then return it
9
10
  "default", {
10
11
  enumerable: true,
11
- get: ()=>setupTrackingContext
12
+ get: function() {
13
+ return setupTrackingContext;
14
+ }
12
15
  });
13
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
14
- const _quickLru = /*#__PURE__*/ _interopRequireDefault(require("quick-lru"));
15
- const _hashConfig = /*#__PURE__*/ _interopRequireDefault(require("../util/hashConfig"));
16
- const _getModuleDependencies = /*#__PURE__*/ _interopRequireDefault(require("../lib/getModuleDependencies"));
17
- const _resolveConfig = /*#__PURE__*/ _interopRequireDefault(require("../public/resolve-config"));
18
- const _resolveConfigPath = /*#__PURE__*/ _interopRequireDefault(require("../util/resolveConfigPath"));
16
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
17
+ const _quicklru = /*#__PURE__*/ _interop_require_default(require("@alloc/quick-lru"));
18
+ const _hashConfig = /*#__PURE__*/ _interop_require_default(require("../util/hashConfig"));
19
+ const _resolveconfig = /*#__PURE__*/ _interop_require_default(require("../public/resolve-config"));
20
+ const _resolveConfigPath = /*#__PURE__*/ _interop_require_default(require("../util/resolveConfigPath"));
19
21
  const _setupContextUtils = require("./setupContextUtils");
20
- const _parseDependency = /*#__PURE__*/ _interopRequireDefault(require("../util/parseDependency"));
21
- const _validateConfigJs = require("../util/validateConfig.js");
22
- const _contentJs = require("./content.js");
23
- function _interopRequireDefault(obj) {
22
+ const _parseDependency = /*#__PURE__*/ _interop_require_default(require("../util/parseDependency"));
23
+ const _validateConfig = require("../util/validateConfig.js");
24
+ const _content = require("./content.js");
25
+ const _loadconfig = require("../lib/load-config");
26
+ const _getModuleDependencies = /*#__PURE__*/ _interop_require_default(require("./getModuleDependencies"));
27
+ function _interop_require_default(obj) {
24
28
  return obj && obj.__esModule ? obj : {
25
29
  default: obj
26
30
  };
27
31
  }
28
- let configPathCache = new _quickLru.default({
32
+ let configPathCache = new _quicklru.default({
29
33
  maxSize: 100
30
34
  });
31
35
  let candidateFilesCache = new WeakMap();
@@ -33,7 +37,7 @@ function getCandidateFiles(context, tailwindConfig) {
33
37
  if (candidateFilesCache.has(context)) {
34
38
  return candidateFilesCache.get(context);
35
39
  }
36
- let candidateFiles = (0, _contentJs.parseCandidateFiles)(context, tailwindConfig);
40
+ let candidateFiles = (0, _content.parseCandidateFiles)(context, tailwindConfig);
37
41
  return candidateFilesCache.set(context, candidateFiles).get(context);
38
42
  }
39
43
  // Get the config object based on a path
@@ -41,7 +45,7 @@ function getTailwindConfig(configOrPath) {
41
45
  let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
42
46
  if (userConfigPath !== null) {
43
47
  let [prevConfig, prevConfigHash, prevDeps, prevModified] = configPathCache.get(userConfigPath) || [];
44
- let newDeps = (0, _getModuleDependencies.default)(userConfigPath).map((dep)=>dep.file);
48
+ let newDeps = (0, _getModuleDependencies.default)(userConfigPath);
45
49
  let modified = false;
46
50
  let newModified = new Map();
47
51
  for (let file of newDeps){
@@ -61,11 +65,10 @@ function getTailwindConfig(configOrPath) {
61
65
  ];
62
66
  }
63
67
  // It has changed (based on timestamps), or first run
64
- for (let file1 of newDeps){
65
- delete require.cache[file1];
68
+ for (let file of newDeps){
69
+ delete require.cache[file];
66
70
  }
67
- let newConfig = (0, _resolveConfig.default)(require(userConfigPath));
68
- newConfig = (0, _validateConfigJs.validateConfig)(newConfig);
71
+ let newConfig = (0, _validateConfig.validateConfig)((0, _resolveconfig.default)((0, _loadconfig.loadConfig)(userConfigPath)));
69
72
  let newHash = (0, _hashConfig.default)(newConfig);
70
73
  configPathCache.set(userConfigPath, [
71
74
  newConfig,
@@ -81,12 +84,12 @@ function getTailwindConfig(configOrPath) {
81
84
  ];
82
85
  }
83
86
  // It's a plain object, not a path
84
- let newConfig1 = (0, _resolveConfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
85
- newConfig1 = (0, _validateConfigJs.validateConfig)(newConfig1);
87
+ let newConfig = (0, _resolveconfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
88
+ newConfig = (0, _validateConfig.validateConfig)(newConfig);
86
89
  return [
87
- newConfig1,
90
+ newConfig,
88
91
  null,
89
- (0, _hashConfig.default)(newConfig1),
92
+ (0, _hashConfig.default)(newConfig),
90
93
  []
91
94
  ];
92
95
  }
@@ -111,7 +114,8 @@ function setupTrackingContext(configOrPath) {
111
114
  }
112
115
  }
113
116
  }
114
- let [context] = (0, _setupContextUtils.getContext)(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
117
+ let [context, , mTimesToCommit] = (0, _setupContextUtils.getContext)(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
118
+ let fileModifiedMap = (0, _setupContextUtils.getFileModifiedMap)(context);
115
119
  let candidateFiles = getCandidateFiles(context, tailwindConfig);
116
120
  // If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
117
121
  // dependencies to be dependencies of the context. Can reuse the context even if they change.
@@ -119,15 +123,28 @@ function setupTrackingContext(configOrPath) {
119
123
  // because it's impossible for a layer in one file to end up in the actual @tailwind rule
120
124
  // in another file since independent sources are effectively isolated.
121
125
  if (tailwindDirectives.size > 0) {
122
- let fileModifiedMap = (0, _setupContextUtils.getFileModifiedMap)(context);
123
126
  // Add template paths as postcss dependencies.
124
127
  for (let contentPath of candidateFiles){
125
128
  for (let dependency of (0, _parseDependency.default)(contentPath)){
126
129
  registerDependency(dependency);
127
130
  }
128
131
  }
129
- for (let changedContent of (0, _contentJs.resolvedChangedContent)(context, candidateFiles, fileModifiedMap)){
130
- context.changedContent.push(changedContent);
132
+ let [changedContent, contentMTimesToCommit] = (0, _content.resolvedChangedContent)(context, candidateFiles, fileModifiedMap);
133
+ for (let content of changedContent){
134
+ context.changedContent.push(content);
135
+ }
136
+ // Add the mtimes of the content files to the commit list
137
+ // We can overwrite the existing values because unconditionally
138
+ // This is because:
139
+ // 1. Most of the files here won't be in the map yet
140
+ // 2. If they are that means it's a context dependency
141
+ // and we're reading this after the context. This means
142
+ // that the mtime we just read is strictly >= the context
143
+ // mtime. Unless the user / os is doing something weird
144
+ // in which the mtime would be going backwards. If that
145
+ // happens there's already going to be problems.
146
+ for (let [path, mtime] of contentMTimesToCommit.entries()){
147
+ mTimesToCommit.set(path, mtime);
131
148
  }
132
149
  }
133
150
  for (let file of configDependencies){
@@ -136,6 +153,12 @@ function setupTrackingContext(configOrPath) {
136
153
  file
137
154
  });
138
155
  }
156
+ // "commit" the new modified time for all context deps
157
+ // We do this here because we want content tracking to
158
+ // read the "old" mtime even when it's a context dependency.
159
+ for (let [path, mtime] of mTimesToCommit.entries()){
160
+ fileModifiedMap.set(path, mtime);
161
+ }
139
162
  return context;
140
163
  };
141
164
  };
@@ -9,18 +9,45 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- env: ()=>env,
13
- contextMap: ()=>contextMap,
14
- configContextMap: ()=>configContextMap,
15
- contextSourcesMap: ()=>contextSourcesMap,
16
- sourceHashMap: ()=>sourceHashMap,
17
- NOT_ON_DEMAND: ()=>NOT_ON_DEMAND,
18
- NONE: ()=>NONE,
19
- resolveDebug: ()=>resolveDebug
12
+ env: function() {
13
+ return env;
14
+ },
15
+ contextMap: function() {
16
+ return contextMap;
17
+ },
18
+ configContextMap: function() {
19
+ return configContextMap;
20
+ },
21
+ contextSourcesMap: function() {
22
+ return contextSourcesMap;
23
+ },
24
+ sourceHashMap: function() {
25
+ return sourceHashMap;
26
+ },
27
+ NOT_ON_DEMAND: function() {
28
+ return NOT_ON_DEMAND;
29
+ },
30
+ NONE: function() {
31
+ return NONE;
32
+ },
33
+ resolveDebug: function() {
34
+ return resolveDebug;
35
+ }
20
36
  });
21
- const env = {
37
+ const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../package.json"));
38
+ function _interop_require_default(obj) {
39
+ return obj && obj.__esModule ? obj : {
40
+ default: obj
41
+ };
42
+ }
43
+ const env = typeof process !== "undefined" ? {
22
44
  NODE_ENV: process.env.NODE_ENV,
23
- DEBUG: resolveDebug(process.env.DEBUG)
45
+ DEBUG: resolveDebug(process.env.DEBUG),
46
+ ENGINE: _packagejson.default.tailwindcss.engine
47
+ } : {
48
+ NODE_ENV: "production",
49
+ DEBUG: false,
50
+ ENGINE: _packagejson.default.tailwindcss.engine
24
51
  };
25
52
  const contextMap = new Map();
26
53
  const configContextMap = new Map();
@@ -4,11 +4,13 @@ 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 _normalizeScreens = require("../util/normalizeScreens");
10
- const _buildMediaQuery = /*#__PURE__*/ _interopRequireDefault(require("../util/buildMediaQuery"));
11
- function _interopRequireDefault(obj) {
12
+ const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
13
+ function _interop_require_default(obj) {
12
14
  return obj && obj.__esModule ? obj : {
13
15
  default: obj
14
16
  };
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ lazyLightningCss: function() {
13
+ return lazyLightningCss;
14
+ },
15
+ lightningcss: function() {
16
+ return lightningcss;
17
+ },
18
+ loadPostcss: function() {
19
+ return loadPostcss;
20
+ },
21
+ loadPostcssImport: function() {
22
+ return loadPostcssImport;
23
+ }
24
+ });
25
+ const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../../../package.json"));
26
+ const _browserslist = /*#__PURE__*/ _interop_require_default(require("browserslist"));
27
+ const _index = require("../../../../peers/index");
28
+ function _interop_require_default(obj) {
29
+ return obj && obj.__esModule ? obj : {
30
+ default: obj
31
+ };
32
+ }
33
+ function lazyLightningCss() {
34
+ // TODO: Make this lazy/bundled
35
+ return require("lightningcss");
36
+ }
37
+ let lightningCss;
38
+ function loadLightningCss() {
39
+ if (lightningCss) {
40
+ return lightningCss;
41
+ }
42
+ // Try to load a local version first
43
+ try {
44
+ return lightningCss = require("lightningcss");
45
+ } catch {}
46
+ return lightningCss = lazyLightningCss();
47
+ }
48
+ async function lightningcss(shouldMinify, result) {
49
+ let css = loadLightningCss();
50
+ try {
51
+ let transformed = css.transform({
52
+ filename: result.opts.from || "input.css",
53
+ code: Buffer.from(result.css, "utf-8"),
54
+ minify: shouldMinify,
55
+ sourceMap: !!result.map,
56
+ inputSourceMap: result.map ? result.map.toString() : undefined,
57
+ targets: css.browserslistToTargets((0, _browserslist.default)(_packagejson.default.browserslist)),
58
+ drafts: {
59
+ nesting: true
60
+ }
61
+ });
62
+ return Object.assign(result, {
63
+ css: transformed.code.toString("utf8"),
64
+ map: result.map ? Object.assign(result.map, {
65
+ toString () {
66
+ return transformed.map.toString();
67
+ }
68
+ }) : result.map
69
+ });
70
+ } catch (err) {
71
+ console.error("Unable to use Lightning CSS. Using raw version instead.");
72
+ console.error(err);
73
+ return result;
74
+ }
75
+ }
76
+ function loadPostcss() {
77
+ // Try to load a local `postcss` version first
78
+ try {
79
+ return require("postcss");
80
+ } catch {}
81
+ return (0, _index.lazyPostcss)();
82
+ }
83
+ function loadPostcssImport() {
84
+ // Try to load a local `postcss-import` version first
85
+ try {
86
+ return require("postcss-import");
87
+ } catch {}
88
+ return (0, _index.lazyPostcssImport)();
89
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "build", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return build;
9
+ }
10
+ });
11
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
+ const _resolveConfigPath = require("../../../util/resolveConfigPath");
14
+ const _plugin = require("./plugin");
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ async function build(args) {
21
+ let input = args["--input"];
22
+ let shouldWatch = args["--watch"];
23
+ // TODO: Deprecate this in future versions
24
+ if (!input && args["_"][1]) {
25
+ console.error("[deprecation] Running tailwindcss without -i, please provide an input file.");
26
+ input = args["--input"] = args["_"][1];
27
+ }
28
+ if (input && input !== "-" && !_fs.default.existsSync(input = _path.default.resolve(input))) {
29
+ console.error(`Specified input file ${args["--input"]} does not exist.`);
30
+ process.exit(9);
31
+ }
32
+ if (args["--config"] && !_fs.default.existsSync(args["--config"] = _path.default.resolve(args["--config"]))) {
33
+ console.error(`Specified config file ${args["--config"]} does not exist.`);
34
+ process.exit(9);
35
+ }
36
+ // TODO: Reference the @config path here if exists
37
+ let configPath = args["--config"] ? args["--config"] : (0, _resolveConfigPath.resolveDefaultConfigPath)();
38
+ let processor = await (0, _plugin.createProcessor)(args, configPath);
39
+ if (shouldWatch) {
40
+ // Abort the watcher if stdin is closed to avoid zombie processes
41
+ // You can disable this behavior with --watch=always
42
+ if (args["--watch"] !== "always") {
43
+ process.stdin.on("end", ()=>process.exit(0));
44
+ }
45
+ process.stdin.resume();
46
+ await processor.watch();
47
+ } else {
48
+ await processor.build().catch((e)=>{
49
+ console.error(e);
50
+ process.exit(1);
51
+ });
52
+ }
53
+ }