tailwindcss 0.0.0-oxide-insiders.a7fe2fe → 0.0.0-oxide-insiders.7f555c4

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 (108) hide show
  1. package/lib/cli/build/deps.js +34 -18
  2. package/lib/cli/build/index.js +45 -12
  3. package/lib/cli/build/plugin.js +273 -90
  4. package/lib/cli/build/utils.js +56 -24
  5. package/lib/cli/build/watching.js +156 -38
  6. package/lib/cli/help/index.js +61 -16
  7. package/lib/cli/index.js +121 -62
  8. package/lib/cli/init/index.js +47 -23
  9. package/lib/cli-peer-dependencies.js +23 -13
  10. package/lib/cli.js +5 -1
  11. package/lib/corePluginList.js +7 -4
  12. package/lib/corePlugins.js +855 -386
  13. package/lib/featureFlags.js +43 -18
  14. package/lib/lib/cacheInvalidation.js +78 -30
  15. package/lib/lib/collapseAdjacentRules.js +46 -23
  16. package/lib/lib/collapseDuplicateDeclarations.js +70 -27
  17. package/lib/lib/content.js +134 -41
  18. package/lib/lib/defaultExtractor.js +201 -96
  19. package/lib/lib/detectNesting.js +38 -12
  20. package/lib/lib/evaluateTailwindFunctions.js +192 -103
  21. package/lib/lib/expandApplyAtRules.js +488 -181
  22. package/lib/lib/expandTailwindAtRules.js +240 -70
  23. package/lib/lib/findAtConfigPath.js +34 -15
  24. package/lib/lib/generateRules.js +775 -353
  25. package/lib/lib/getModuleDependencies.js +67 -29
  26. package/lib/lib/load-config.js +27 -17
  27. package/lib/lib/normalizeTailwindDirectives.js +73 -27
  28. package/lib/lib/offsets.js +227 -62
  29. package/lib/lib/partitionApplyAtRules.js +53 -29
  30. package/lib/lib/regex.js +50 -28
  31. package/lib/lib/remap-bitfield.js +86 -9
  32. package/lib/lib/resolveDefaultsAtRules.js +123 -53
  33. package/lib/lib/setupContextUtils.js +1117 -584
  34. package/lib/lib/setupTrackingContext.js +149 -58
  35. package/lib/lib/sharedState.js +71 -23
  36. package/lib/lib/substituteScreenAtRules.js +19 -9
  37. package/lib/oxide/cli/build/deps.js +46 -23
  38. package/lib/oxide/cli/build/index.js +44 -12
  39. package/lib/oxide/cli/build/plugin.js +271 -89
  40. package/lib/oxide/cli/build/utils.js +55 -24
  41. package/lib/oxide/cli/build/watching.js +153 -36
  42. package/lib/oxide/cli/help/index.js +60 -16
  43. package/lib/oxide/cli/index.js +128 -67
  44. package/lib/oxide/cli/init/index.js +40 -19
  45. package/lib/oxide/cli.js +3 -2
  46. package/lib/plugin.js +58 -31
  47. package/lib/postcss-plugins/nesting/index.js +13 -7
  48. package/lib/postcss-plugins/nesting/plugin.js +65 -20
  49. package/lib/processTailwindFeatures.js +41 -10
  50. package/lib/public/colors.js +25 -16
  51. package/lib/public/create-plugin.js +11 -6
  52. package/lib/public/default-config.js +12 -6
  53. package/lib/public/default-theme.js +12 -6
  54. package/lib/public/load-config.js +9 -5
  55. package/lib/public/resolve-config.js +10 -6
  56. package/lib/util/applyImportantSelector.js +28 -17
  57. package/lib/util/bigSign.js +9 -6
  58. package/lib/util/buildMediaQuery.js +19 -10
  59. package/lib/util/cloneDeep.js +19 -9
  60. package/lib/util/cloneNodes.js +29 -14
  61. package/lib/util/color.js +87 -47
  62. package/lib/util/colorNames.js +752 -0
  63. package/lib/util/configurePlugins.js +18 -9
  64. package/lib/util/createPlugin.js +17 -8
  65. package/lib/util/createUtilityPlugin.js +30 -16
  66. package/lib/util/dataTypes.js +189 -38
  67. package/lib/util/defaults.js +21 -9
  68. package/lib/util/escapeClassName.js +15 -9
  69. package/lib/util/escapeCommas.js +9 -6
  70. package/lib/util/flattenColorPalette.js +11 -7
  71. package/lib/util/formatVariantSelector.js +209 -60
  72. package/lib/util/getAllConfigs.js +44 -35
  73. package/lib/util/hashConfig.js +12 -8
  74. package/lib/util/isKeyframeRule.js +10 -7
  75. package/lib/util/isPlainObject.js +14 -9
  76. package/lib/util/isSyntacticallyValidPropertyValue.js +45 -14
  77. package/lib/util/log.js +20 -9
  78. package/lib/util/nameClass.js +31 -10
  79. package/lib/util/negateValue.js +28 -10
  80. package/lib/util/normalizeConfig.js +242 -63
  81. package/lib/util/normalizeScreens.js +145 -70
  82. package/lib/util/parseAnimationValue.js +64 -14
  83. package/lib/util/parseBoxShadowValue.js +63 -14
  84. package/lib/util/parseDependency.js +39 -13
  85. package/lib/util/parseGlob.js +25 -8
  86. package/lib/util/parseObjectStyles.js +29 -18
  87. package/lib/util/pluginUtils.js +196 -77
  88. package/lib/util/prefixSelector.js +31 -12
  89. package/lib/util/pseudoElements.js +116 -34
  90. package/lib/util/removeAlphaVariables.js +23 -8
  91. package/lib/util/resolveConfig.js +224 -105
  92. package/lib/util/resolveConfigPath.js +45 -15
  93. package/lib/util/responsive.js +10 -6
  94. package/lib/util/splitAtTopLevelOnly.js +46 -10
  95. package/lib/util/tap.js +11 -7
  96. package/lib/util/toColorValue.js +10 -7
  97. package/lib/util/toPath.js +28 -8
  98. package/lib/util/transformThemeValue.js +49 -14
  99. package/lib/util/validateConfig.js +25 -15
  100. package/lib/util/validateFormalSyntax.js +14 -6
  101. package/lib/util/withAlphaVariable.js +54 -30
  102. package/package.json +18 -22
  103. package/peers/index.js +57849 -43101
  104. package/src/lib/expandTailwindAtRules.js +1 -1
  105. package/src/lib/setupTrackingContext.js +1 -1
  106. package/src/util/color.js +1 -1
  107. package/src/util/colorNames.js +150 -0
  108. package/src/util/pseudoElements.js +4 -4
@@ -1,74 +1,165 @@
1
+ // @ts-check
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), Object.defineProperty(exports, "default", {
5
- enumerable: !0,
6
- get: ()=>setupTrackingContext
4
+ value: true
7
5
  });
8
- const _fs = _interopRequireDefault(require("fs")), _quickLru = _interopRequireDefault(require("quick-lru")), _hashConfig = _interopRequireDefault(require("../util/hashConfig")), _resolveConfig = _interopRequireDefault(require("../public/resolve-config")), _resolveConfigPath = _interopRequireDefault(require("../util/resolveConfigPath")), _setupContextUtils = require("./setupContextUtils"), _parseDependency = _interopRequireDefault(require("../util/parseDependency")), _validateConfigJs = require("../util/validateConfig.js"), _contentJs = require("./content.js"), _loadConfig = require("../lib/load-config"), _getModuleDependencies = _interopRequireDefault(require("./getModuleDependencies"));
9
- function _interopRequireDefault(obj) {
6
+ Object.defineProperty(exports, // DISABLE_TOUCH = TRUE
7
+ // Retrieve an existing context from cache if possible (since contexts are unique per
8
+ // source path), or set up a new one (including setting up watchers and registering
9
+ // plugins) then return it
10
+ "default", {
11
+ enumerable: true,
12
+ get: function() {
13
+ return setupTrackingContext;
14
+ }
15
+ });
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"));
21
+ const _setupContextUtils = require("./setupContextUtils");
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) {
10
28
  return obj && obj.__esModule ? obj : {
11
29
  default: obj
12
30
  };
13
31
  }
14
- let configPathCache = new _quickLru.default({
32
+ let configPathCache = new _quicklru.default({
15
33
  maxSize: 100
16
- }), candidateFilesCache = new WeakMap();
34
+ });
35
+ let candidateFilesCache = new WeakMap();
36
+ function getCandidateFiles(context, tailwindConfig) {
37
+ if (candidateFilesCache.has(context)) {
38
+ return candidateFilesCache.get(context);
39
+ }
40
+ let candidateFiles = (0, _content.parseCandidateFiles)(context, tailwindConfig);
41
+ return candidateFilesCache.set(context, candidateFiles).get(context);
42
+ }
43
+ // Get the config object based on a path
44
+ function getTailwindConfig(configOrPath) {
45
+ let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
46
+ if (userConfigPath !== null) {
47
+ let [prevConfig, prevConfigHash, prevDeps, prevModified] = configPathCache.get(userConfigPath) || [];
48
+ let newDeps = (0, _getModuleDependencies.default)(userConfigPath);
49
+ let modified = false;
50
+ let newModified = new Map();
51
+ for (let file of newDeps){
52
+ let time = _fs.default.statSync(file).mtimeMs;
53
+ newModified.set(file, time);
54
+ if (!prevModified || !prevModified.has(file) || time > prevModified.get(file)) {
55
+ modified = true;
56
+ }
57
+ }
58
+ // It hasn't changed (based on timestamps)
59
+ if (!modified) {
60
+ return [
61
+ prevConfig,
62
+ userConfigPath,
63
+ prevConfigHash,
64
+ prevDeps
65
+ ];
66
+ }
67
+ // It has changed (based on timestamps), or first run
68
+ for (let file of newDeps){
69
+ delete require.cache[file];
70
+ }
71
+ let newConfig = (0, _validateConfig.validateConfig)((0, _resolveconfig.default)((0, _loadconfig.loadConfig)(userConfigPath)));
72
+ let newHash = (0, _hashConfig.default)(newConfig);
73
+ configPathCache.set(userConfigPath, [
74
+ newConfig,
75
+ newHash,
76
+ newDeps,
77
+ newModified
78
+ ]);
79
+ return [
80
+ newConfig,
81
+ userConfigPath,
82
+ newHash,
83
+ newDeps
84
+ ];
85
+ }
86
+ // It's a plain object, not a path
87
+ let newConfig = (0, _resolveconfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
88
+ newConfig = (0, _validateConfig.validateConfig)(newConfig);
89
+ return [
90
+ newConfig,
91
+ null,
92
+ (0, _hashConfig.default)(newConfig),
93
+ []
94
+ ];
95
+ }
17
96
  function setupTrackingContext(configOrPath) {
18
- return ({ tailwindDirectives , registerDependency })=>(root, result)=>{
19
- let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = function(configOrPath) {
20
- let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
21
- if (null !== userConfigPath) {
22
- let [prevConfig, prevConfigHash, prevDeps, prevModified] = configPathCache.get(userConfigPath) || [], newDeps = (0, _getModuleDependencies.default)(userConfigPath), modified = !1, newModified = new Map();
23
- for (let file of newDeps){
24
- let time = _fs.default.statSync(file).mtimeMs;
25
- newModified.set(file, time), (!prevModified || !prevModified.has(file) || time > prevModified.get(file)) && (modified = !0);
97
+ return ({ tailwindDirectives , registerDependency })=>{
98
+ return (root, result)=>{
99
+ let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
100
+ let contextDependencies = new Set(configDependencies);
101
+ // If there are no @tailwind or @apply rules, we don't consider this CSS
102
+ // file or its dependencies to be dependencies of the context. Can reuse
103
+ // the context even if they change. We may want to think about `@layer`
104
+ // being part of this trigger too, but it's tough because it's impossible
105
+ // for a layer in one file to end up in the actual @tailwind rule in
106
+ // another file since independent sources are effectively isolated.
107
+ if (tailwindDirectives.size > 0) {
108
+ // Add current css file as a context dependencies.
109
+ contextDependencies.add(result.opts.from);
110
+ // Add all css @import dependencies as context dependencies.
111
+ for (let message of result.messages){
112
+ if (message.type === "dependency") {
113
+ contextDependencies.add(message.file);
26
114
  }
27
- if (!modified) return [
28
- prevConfig,
29
- userConfigPath,
30
- prevConfigHash,
31
- prevDeps
32
- ];
33
- for (let file of newDeps)delete require.cache[file];
34
- let newConfig = (0, _validateConfigJs.validateConfig)((0, _resolveConfig.default)((0, _loadConfig.loadConfig)(userConfigPath))), newHash = (0, _hashConfig.default)(newConfig);
35
- return configPathCache.set(userConfigPath, [
36
- newConfig,
37
- newHash,
38
- newDeps,
39
- newModified
40
- ]), [
41
- newConfig,
42
- userConfigPath,
43
- newHash,
44
- newDeps
45
- ];
46
115
  }
47
- let newConfig = (0, _resolveConfig.default)(void 0 === configOrPath.config ? configOrPath : configOrPath.config);
48
- return [
49
- newConfig = (0, _validateConfigJs.validateConfig)(newConfig),
50
- null,
51
- (0, _hashConfig.default)(newConfig),
52
- []
53
- ];
54
- }(configOrPath), contextDependencies = new Set(configDependencies);
55
- if (tailwindDirectives.size > 0) for (let message of (contextDependencies.add(result.opts.from), result.messages))"dependency" === message.type && contextDependencies.add(message.file);
56
- let [context, , mTimesToCommit] = (0, _setupContextUtils.getContext)(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies), fileModifiedMap = (0, _setupContextUtils.getFileModifiedMap)(context), candidateFiles = function(context, tailwindConfig) {
57
- if (candidateFilesCache.has(context)) return candidateFilesCache.get(context);
58
- let candidateFiles = (0, _contentJs.parseCandidateFiles)(context, tailwindConfig);
59
- return candidateFilesCache.set(context, candidateFiles).get(context);
60
- }(context, tailwindConfig);
116
+ }
117
+ let [context, , mTimesToCommit] = (0, _setupContextUtils.getContext)(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
118
+ let fileModifiedMap = (0, _setupContextUtils.getFileModifiedMap)(context);
119
+ let candidateFiles = getCandidateFiles(context, tailwindConfig);
120
+ // If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
121
+ // dependencies to be dependencies of the context. Can reuse the context even if they change.
122
+ // We may want to think about `@layer` being part of this trigger too, but it's tough
123
+ // because it's impossible for a layer in one file to end up in the actual @tailwind rule
124
+ // in another file since independent sources are effectively isolated.
61
125
  if (tailwindDirectives.size > 0) {
62
- for (let contentPath of candidateFiles)for (let dependency of (0, _parseDependency.default)(contentPath))registerDependency(dependency);
63
- let [changedContent, contentMTimesToCommit] = (0, _contentJs.resolvedChangedContent)(context, candidateFiles, fileModifiedMap);
64
- for (let content of changedContent)context.changedContent.push(content);
65
- for (let [path, mtime] of contentMTimesToCommit.entries())mTimesToCommit.set(path, mtime);
126
+ // Add template paths as postcss dependencies.
127
+ for (let contentPath of candidateFiles){
128
+ for (let dependency of (0, _parseDependency.default)(contentPath)){
129
+ registerDependency(dependency);
130
+ }
131
+ }
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);
148
+ }
149
+ }
150
+ for (let file of configDependencies){
151
+ registerDependency({
152
+ type: "dependency",
153
+ file
154
+ });
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);
66
161
  }
67
- for (let file of configDependencies)registerDependency({
68
- type: "dependency",
69
- file
70
- });
71
- for (let [path, mtime] of mTimesToCommit.entries())fileModifiedMap.set(path, mtime);
72
162
  return context;
73
163
  };
164
+ };
74
165
  }
@@ -1,39 +1,87 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), function(target, all) {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
5
6
  for(var name in all)Object.defineProperty(target, name, {
6
- enumerable: !0,
7
+ enumerable: true,
7
8
  get: all[name]
8
9
  });
9
- }(exports, {
10
- env: ()=>env,
11
- contextMap: ()=>contextMap,
12
- configContextMap: ()=>configContextMap,
13
- contextSourcesMap: ()=>contextSourcesMap,
14
- sourceHashMap: ()=>sourceHashMap,
15
- NOT_ON_DEMAND: ()=>NOT_ON_DEMAND,
16
- NONE: ()=>NONE,
17
- resolveDebug: ()=>resolveDebug
10
+ }
11
+ _export(exports, {
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
+ }
18
36
  });
19
- const _packageJson = function(obj) {
37
+ const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../package.json"));
38
+ function _interop_require_default(obj) {
20
39
  return obj && obj.__esModule ? obj : {
21
40
  default: obj
22
41
  };
23
- }(require("../../package.json")), env = "undefined" != typeof process ? {
42
+ }
43
+ const env = typeof process !== "undefined" ? {
24
44
  NODE_ENV: process.env.NODE_ENV,
25
45
  DEBUG: resolveDebug(process.env.DEBUG),
26
- ENGINE: _packageJson.default.tailwindcss.engine
46
+ ENGINE: _packagejson.default.tailwindcss.engine
27
47
  } : {
28
48
  NODE_ENV: "production",
29
- DEBUG: !1,
30
- ENGINE: _packageJson.default.tailwindcss.engine
31
- }, contextMap = new Map(), configContextMap = new Map(), contextSourcesMap = new Map(), sourceHashMap = new Map(), NOT_ON_DEMAND = new String("*"), NONE = Symbol("__NONE__");
49
+ DEBUG: false,
50
+ ENGINE: _packagejson.default.tailwindcss.engine
51
+ };
52
+ const contextMap = new Map();
53
+ const configContextMap = new Map();
54
+ const contextSourcesMap = new Map();
55
+ const sourceHashMap = new Map();
56
+ const NOT_ON_DEMAND = new String("*");
57
+ const NONE = Symbol("__NONE__");
32
58
  function resolveDebug(debug) {
33
- if (void 0 === debug) return !1;
34
- if ("true" === debug || "1" === debug) return !0;
35
- if ("false" === debug || "0" === debug) return !1;
36
- if ("*" === debug) return !0;
59
+ if (debug === undefined) {
60
+ return false;
61
+ }
62
+ // Environment variables are strings, so convert to boolean
63
+ if (debug === "true" || debug === "1") {
64
+ return true;
65
+ }
66
+ if (debug === "false" || debug === "0") {
67
+ return false;
68
+ }
69
+ // Keep the debug convention into account:
70
+ // DEBUG=* -> This enables all debug modes
71
+ // DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC
72
+ // DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types)
73
+ // DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB
74
+ if (debug === "*") {
75
+ return true;
76
+ }
37
77
  let debuggers = debug.split(",").map((d)=>d.split(":")[0]);
38
- return !debuggers.includes("-tailwindcss") && !!debuggers.includes("tailwindcss");
78
+ // Ignoring tailwindcss
79
+ if (debuggers.includes("-tailwindcss")) {
80
+ return false;
81
+ }
82
+ // Including tailwindcss
83
+ if (debuggers.includes("tailwindcss")) {
84
+ return true;
85
+ }
86
+ return false;
39
87
  }
@@ -1,21 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), Object.defineProperty(exports, "default", {
5
- enumerable: !0,
6
- get: ()=>_default
3
+ value: true
7
4
  });
8
- const _normalizeScreens = require("../util/normalizeScreens"), _buildMediaQuery = function(obj) {
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _default;
9
+ }
10
+ });
11
+ const _normalizeScreens = require("../util/normalizeScreens");
12
+ const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
13
+ function _interop_require_default(obj) {
9
14
  return obj && obj.__esModule ? obj : {
10
15
  default: obj
11
16
  };
12
- }(require("../util/buildMediaQuery"));
17
+ }
13
18
  function _default({ tailwindConfig: { theme } }) {
14
19
  return function(css) {
15
20
  css.walkAtRules("screen", (atRule)=>{
16
- let screen = atRule.params, screenDefinition = (0, _normalizeScreens.normalizeScreens)(theme.screens).find(({ name })=>name === screen);
17
- if (!screenDefinition) throw atRule.error(`No \`${screen}\` screen found.`);
18
- atRule.name = "media", atRule.params = (0, _buildMediaQuery.default)(screenDefinition);
21
+ let screen = atRule.params;
22
+ let screens = (0, _normalizeScreens.normalizeScreens)(theme.screens);
23
+ let screenDefinition = screens.find(({ name })=>name === screen);
24
+ if (!screenDefinition) {
25
+ throw atRule.error(`No \`${screen}\` screen found.`);
26
+ }
27
+ atRule.name = "media";
28
+ atRule.params = (0, _buildMediaQuery.default)(screenDefinition);
19
29
  });
20
30
  };
21
31
  }
@@ -1,64 +1,87 @@
1
1
  "use strict";
2
- let lightningCss;
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: !0
5
- }), function(target, all) {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: !0,
7
+ enumerable: true,
8
8
  get: all[name]
9
9
  });
10
- }(exports, {
11
- lazyLightningCss: ()=>lazyLightningCss,
12
- lightningcss: ()=>lightningcss,
13
- loadPostcss: ()=>loadPostcss,
14
- loadPostcssImport: ()=>loadPostcssImport
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
+ }
15
24
  });
16
- const _packageJson = _interopRequireDefault(require("../../../../package.json")), _browserslist = _interopRequireDefault(require("browserslist")), _index = require("../../../../peers/index");
17
- function _interopRequireDefault(obj) {
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) {
18
29
  return obj && obj.__esModule ? obj : {
19
30
  default: obj
20
31
  };
21
32
  }
22
33
  function lazyLightningCss() {
34
+ // TODO: Make this lazy/bundled
23
35
  return require("lightningcss");
24
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
+ }
25
48
  async function lightningcss(shouldMinify, result) {
26
- let css = function() {
27
- if (lightningCss) return lightningCss;
28
- try {
29
- return lightningCss = require("lightningcss");
30
- } catch {}
31
- return lightningCss = lazyLightningCss();
32
- }();
49
+ let css = loadLightningCss();
33
50
  try {
34
51
  let transformed = css.transform({
35
52
  filename: result.opts.from || "input.css",
36
53
  code: Buffer.from(result.css, "utf-8"),
37
54
  minify: shouldMinify,
38
55
  sourceMap: !!result.map,
39
- inputSourceMap: result.map ? result.map.toString() : void 0,
40
- targets: css.browserslistToTargets((0, _browserslist.default)(_packageJson.default.browserslist)),
56
+ inputSourceMap: result.map ? result.map.toString() : undefined,
57
+ targets: css.browserslistToTargets((0, _browserslist.default)(_packagejson.default.browserslist)),
41
58
  drafts: {
42
- nesting: !0
59
+ nesting: true
43
60
  }
44
61
  });
45
62
  return Object.assign(result, {
46
63
  css: transformed.code.toString("utf8"),
47
64
  map: result.map ? Object.assign(result.map, {
48
- toString: ()=>transformed.map.toString()
65
+ toString () {
66
+ return transformed.map.toString();
67
+ }
49
68
  }) : result.map
50
69
  });
51
70
  } catch (err) {
52
- return console.error("Unable to use Lightning CSS. Using raw version instead."), console.error(err), result;
71
+ console.error("Unable to use Lightning CSS. Using raw version instead.");
72
+ console.error(err);
73
+ return result;
53
74
  }
54
75
  }
55
76
  function loadPostcss() {
77
+ // Try to load a local `postcss` version first
56
78
  try {
57
79
  return require("postcss");
58
80
  } catch {}
59
81
  return (0, _index.lazyPostcss)();
60
82
  }
61
83
  function loadPostcssImport() {
84
+ // Try to load a local `postcss-import` version first
62
85
  try {
63
86
  return require("postcss-import");
64
87
  } catch {}
@@ -1,21 +1,53 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), Object.defineProperty(exports, "build", {
5
- enumerable: !0,
6
- get: ()=>build
3
+ value: true
7
4
  });
8
- const _fs = _interopRequireDefault(require("fs")), _path = _interopRequireDefault(require("path")), _resolveConfigPath = require("../../../util/resolveConfigPath"), _plugin = require("./plugin");
9
- function _interopRequireDefault(obj) {
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) {
10
16
  return obj && obj.__esModule ? obj : {
11
17
  default: obj
12
18
  };
13
19
  }
14
20
  async function build(args) {
15
- let input = args["--input"], shouldWatch = args["--watch"];
16
- !input && args._[1] && (console.error("[deprecation] Running tailwindcss without -i, please provide an input file."), input = args["--input"] = args._[1]), input && "-" !== input && !_fs.default.existsSync(input = _path.default.resolve(input)) && (console.error(`Specified input file ${args["--input"]} does not exist.`), process.exit(9)), args["--config"] && !_fs.default.existsSync(args["--config"] = _path.default.resolve(args["--config"])) && (console.error(`Specified config file ${args["--config"]} does not exist.`), process.exit(9));
17
- let configPath = args["--config"] ? args["--config"] : (0, _resolveConfigPath.resolveDefaultConfigPath)(), processor = await (0, _plugin.createProcessor)(args, configPath);
18
- shouldWatch ? ("always" !== args["--watch"] && process.stdin.on("end", ()=>process.exit(0)), process.stdin.resume(), await processor.watch()) : await processor.build().catch((e)=>{
19
- console.error(e), process.exit(1);
20
- });
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
+ }
21
53
  }