tailwindcss 0.0.0-oxide-insiders.dddaded → 0.0.0-oxide-insiders.b2e3cf2

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