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
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "help", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return help;
9
+ }
10
+ });
11
+ const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../../../package.json"));
12
+ function _interop_require_default(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ function help({ message , usage , commands , options }) {
18
+ let indent = 2;
19
+ // Render header
20
+ console.log();
21
+ console.log(`${_packagejson.default.name} v${_packagejson.default.version}`);
22
+ // Render message
23
+ if (message) {
24
+ console.log();
25
+ for (let msg of message.split("\n")){
26
+ console.log(msg);
27
+ }
28
+ }
29
+ // Render usage
30
+ if (usage && usage.length > 0) {
31
+ console.log();
32
+ console.log("Usage:");
33
+ for (let example of usage){
34
+ console.log(" ".repeat(indent), example);
35
+ }
36
+ }
37
+ // Render commands
38
+ if (commands && commands.length > 0) {
39
+ console.log();
40
+ console.log("Commands:");
41
+ for (let command of commands){
42
+ console.log(" ".repeat(indent), command);
43
+ }
44
+ }
45
+ // Render options
46
+ if (options) {
47
+ let groupedOptions = {};
48
+ for (let [key, value] of Object.entries(options)){
49
+ if (typeof value === "object") {
50
+ groupedOptions[key] = {
51
+ ...value,
52
+ flags: [
53
+ key
54
+ ]
55
+ };
56
+ } else {
57
+ groupedOptions[value].flags.push(key);
58
+ }
59
+ }
60
+ console.log();
61
+ console.log("Options:");
62
+ for (let { flags , description , deprecated } of Object.values(groupedOptions)){
63
+ if (deprecated) continue;
64
+ if (flags.length === 1) {
65
+ console.log(" ".repeat(indent + 4 /* 4 = "-i, ".length */ ), flags.slice().reverse().join(", ").padEnd(20, " "), description);
66
+ } else {
67
+ console.log(" ".repeat(indent), flags.slice().reverse().join(", ").padEnd(24, " "), description);
68
+ }
69
+ }
70
+ }
71
+ console.log();
72
+ }
@@ -0,0 +1,214 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
7
+ const _arg = /*#__PURE__*/ _interop_require_default(require("arg"));
8
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
9
+ const _build = require("./build");
10
+ const _help = require("./help");
11
+ const _init = require("./init");
12
+ function _interop_require_default(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ // ---
18
+ function oneOf(...options) {
19
+ return Object.assign((value = true)=>{
20
+ for (let option of options){
21
+ let parsed = option(value);
22
+ if (parsed === value) {
23
+ return parsed;
24
+ }
25
+ }
26
+ throw new Error("...");
27
+ }, {
28
+ manualParsing: true
29
+ });
30
+ }
31
+ let commands = {
32
+ init: {
33
+ run: _init.init,
34
+ args: {
35
+ "--esm": {
36
+ type: Boolean,
37
+ description: `Initialize configuration file as ESM`
38
+ },
39
+ "--ts": {
40
+ type: Boolean,
41
+ description: `Initialize configuration file as TypeScript`
42
+ },
43
+ "--full": {
44
+ type: Boolean,
45
+ description: `Include the default values for all options in the generated configuration file`
46
+ },
47
+ "-f": "--full"
48
+ }
49
+ },
50
+ build: {
51
+ run: _build.build,
52
+ args: {
53
+ "--input": {
54
+ type: String,
55
+ description: "Input file"
56
+ },
57
+ "--output": {
58
+ type: String,
59
+ description: "Output file"
60
+ },
61
+ "--watch": {
62
+ type: oneOf(String, Boolean),
63
+ description: "Watch for changes and rebuild as needed"
64
+ },
65
+ "--poll": {
66
+ type: Boolean,
67
+ description: "Use polling instead of filesystem events when watching"
68
+ },
69
+ "--content": {
70
+ type: String,
71
+ description: "Content paths to use for removing unused classes"
72
+ },
73
+ "--minify": {
74
+ type: Boolean,
75
+ description: "Minify the output"
76
+ },
77
+ "--config": {
78
+ type: String,
79
+ description: "Path to a custom config file"
80
+ },
81
+ "-c": "--config",
82
+ "-i": "--input",
83
+ "-o": "--output",
84
+ "-m": "--minify",
85
+ "-w": "--watch",
86
+ "-p": "--poll"
87
+ }
88
+ }
89
+ };
90
+ let sharedFlags = {
91
+ "--help": {
92
+ type: Boolean,
93
+ description: "Display usage information"
94
+ },
95
+ "-h": "--help"
96
+ };
97
+ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
98
+ (0, _help.help)({
99
+ usage: [
100
+ "tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
101
+ "tailwindcss init [--full] [options...]"
102
+ ],
103
+ commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
104
+ options: {
105
+ ...commands.build.args,
106
+ ...sharedFlags
107
+ }
108
+ });
109
+ process.exit(0);
110
+ }
111
+ let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
112
+ if (commands[command] === undefined) {
113
+ if (_fs.default.existsSync(_path.default.resolve(command))) {
114
+ // TODO: Deprecate this in future versions
115
+ // Check if non-existing command, might be a file.
116
+ command = "build";
117
+ } else {
118
+ (0, _help.help)({
119
+ message: `Invalid command: ${command}`,
120
+ usage: [
121
+ "tailwindcss <command> [options]"
122
+ ],
123
+ commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
124
+ options: sharedFlags
125
+ });
126
+ process.exit(1);
127
+ }
128
+ }
129
+ // Execute command
130
+ let { args: flags , run } = commands[command];
131
+ let args = (()=>{
132
+ try {
133
+ let result = (0, _arg.default)(Object.fromEntries(Object.entries({
134
+ ...flags,
135
+ ...sharedFlags
136
+ }).filter(([_key, value])=>{
137
+ var _value_type;
138
+ return !(value === null || value === void 0 ? void 0 : (_value_type = value.type) === null || _value_type === void 0 ? void 0 : _value_type.manualParsing);
139
+ }).map(([key, value])=>[
140
+ key,
141
+ typeof value === "object" ? value.type : value
142
+ ])), {
143
+ permissive: true
144
+ });
145
+ // Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
146
+ for(let i = result["_"].length - 1; i >= 0; --i){
147
+ let flag = result["_"][i];
148
+ if (!flag.startsWith("-")) continue;
149
+ let [flagName, flagValue] = flag.split("=");
150
+ let handler = flags[flagName];
151
+ // Resolve flagName & handler
152
+ while(typeof handler === "string"){
153
+ flagName = handler;
154
+ handler = flags[handler];
155
+ }
156
+ if (!handler) continue;
157
+ let args = [];
158
+ let offset = i + 1;
159
+ // --flag value syntax was used so we need to pull `value` from `args`
160
+ if (flagValue === undefined) {
161
+ // Parse args for current flag
162
+ while(result["_"][offset] && !result["_"][offset].startsWith("-")){
163
+ args.push(result["_"][offset++]);
164
+ }
165
+ // Cleanup manually parsed flags + args
166
+ result["_"].splice(i, 1 + args.length);
167
+ // No args were provided, use default value defined in handler
168
+ // One arg was provided, use that directly
169
+ // Multiple args were provided so pass them all in an array
170
+ flagValue = args.length === 0 ? undefined : args.length === 1 ? args[0] : args;
171
+ } else {
172
+ // Remove the whole flag from the args array
173
+ result["_"].splice(i, 1);
174
+ }
175
+ // Set the resolved value in the `result` object
176
+ result[flagName] = handler.type(flagValue, flagName);
177
+ }
178
+ // Ensure that the `command` is always the first argument in the `args`.
179
+ // This is important so that we don't have to check if a default command
180
+ // (build) was used or not from within each plugin.
181
+ //
182
+ // E.g.: tailwindcss input.css -> _: ['build', 'input.css']
183
+ // E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
184
+ if (result["_"][0] !== command) {
185
+ result["_"].unshift(command);
186
+ }
187
+ return result;
188
+ } catch (err) {
189
+ if (err.code === "ARG_UNKNOWN_OPTION") {
190
+ (0, _help.help)({
191
+ message: err.message,
192
+ usage: [
193
+ "tailwindcss <command> [options]"
194
+ ],
195
+ options: sharedFlags
196
+ });
197
+ process.exit(1);
198
+ }
199
+ throw err;
200
+ }
201
+ })();
202
+ if (args["--help"]) {
203
+ (0, _help.help)({
204
+ options: {
205
+ ...flags,
206
+ ...sharedFlags
207
+ },
208
+ usage: [
209
+ `tailwindcss ${command} [options]`
210
+ ]
211
+ });
212
+ process.exit(0);
213
+ }
214
+ run(args);
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "init", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return init;
9
+ }
10
+ });
11
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
+ function _interop_require_default(obj) {
14
+ return obj && obj.__esModule ? obj : {
15
+ default: obj
16
+ };
17
+ }
18
+ function isESM() {
19
+ const pkgPath = _path.default.resolve("./package.json");
20
+ try {
21
+ let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, "utf8"));
22
+ return pkg.type && pkg.type === "module";
23
+ } catch (err) {
24
+ return false;
25
+ }
26
+ }
27
+ function init(args) {
28
+ let messages = [];
29
+ let isProjectESM = args["--ts"] || args["--esm"] || isESM();
30
+ let syntax = args["--ts"] ? "ts" : isProjectESM ? "js" : "cjs";
31
+ let extension = args["--ts"] ? "ts" : "js";
32
+ var _args___;
33
+ let tailwindConfigLocation = _path.default.resolve((_args___ = args["_"][1]) !== null && _args___ !== void 0 ? _args___ : `./tailwind.config.${extension}`);
34
+ if (_fs.default.existsSync(tailwindConfigLocation)) {
35
+ messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
36
+ } else {
37
+ let stubContentsFile = _fs.default.readFileSync(args["--full"] ? _path.default.resolve(__dirname, "../../../../stubs/config.full.js") : _path.default.resolve(__dirname, "../../../../stubs/config.simple.js"), "utf8");
38
+ let stubFile = _fs.default.readFileSync(_path.default.resolve(__dirname, `../../../../stubs/tailwind.config.${syntax}`), "utf8");
39
+ // Change colors import
40
+ stubContentsFile = stubContentsFile.replace("../colors", "tailwindcss/colors");
41
+ // Replace contents of {ts,js,cjs} file with the stub {simple,full}.
42
+ stubFile = stubFile.replace("__CONFIG__", stubContentsFile.replace("module.exports =", "").trim()).trim() + "\n\n";
43
+ _fs.default.writeFileSync(tailwindConfigLocation, stubFile, "utf8");
44
+ messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
45
+ }
46
+ if (messages.length > 0) {
47
+ console.log();
48
+ for (let message of messages){
49
+ console.log(message);
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ require("./cli/index");
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ module.exports = require("../plugin.js");
package/lib/plugin.js ADDED
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _setupTrackingContext = /*#__PURE__*/ _interop_require_default(require("./lib/setupTrackingContext"));
6
+ const _processTailwindFeatures = /*#__PURE__*/ _interop_require_default(require("./processTailwindFeatures"));
7
+ const _sharedState = require("./lib/sharedState");
8
+ const _findAtConfigPath = require("./lib/findAtConfigPath");
9
+ function _interop_require_default(obj) {
10
+ return obj && obj.__esModule ? obj : {
11
+ default: obj
12
+ };
13
+ }
14
+ module.exports = function tailwindcss(configOrPath) {
15
+ return {
16
+ postcssPlugin: "tailwindcss",
17
+ plugins: [
18
+ _sharedState.env.DEBUG && function(root) {
19
+ console.log("\n");
20
+ console.time("JIT TOTAL");
21
+ return root;
22
+ },
23
+ function(root, result) {
24
+ var _findAtConfigPath1;
25
+ // Use the path for the `@config` directive if it exists, otherwise use the
26
+ // path for the file being processed
27
+ configOrPath = (_findAtConfigPath1 = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && _findAtConfigPath1 !== void 0 ? _findAtConfigPath1 : configOrPath;
28
+ let context = (0, _setupTrackingContext.default)(configOrPath);
29
+ if (root.type === "document") {
30
+ let roots = root.nodes.filter((node)=>node.type === "root");
31
+ for (const root of roots){
32
+ if (root.type === "root") {
33
+ (0, _processTailwindFeatures.default)(context)(root, result);
34
+ }
35
+ }
36
+ return;
37
+ }
38
+ (0, _processTailwindFeatures.default)(context)(root, result);
39
+ },
40
+ false && function lightningCssPlugin(_root, result) {
41
+ let postcss = require("postcss");
42
+ let lightningcss = require("lightningcss");
43
+ let browserslist = require("browserslist");
44
+ try {
45
+ let transformed = lightningcss.transform({
46
+ filename: result.opts.from,
47
+ code: Buffer.from(result.root.toString()),
48
+ minify: false,
49
+ sourceMap: !!result.map,
50
+ inputSourceMap: result.map ? result.map.toString() : undefined,
51
+ targets: typeof process !== "undefined" && process.env.JEST_WORKER_ID ? {
52
+ chrome: 106 << 16
53
+ } : lightningcss.browserslistToTargets(browserslist(require("../package.json").browserslist)),
54
+ drafts: {
55
+ nesting: true,
56
+ customMedia: true
57
+ }
58
+ });
59
+ var _result_map;
60
+ result.map = Object.assign((_result_map = result.map) !== null && _result_map !== void 0 ? _result_map : {}, {
61
+ toJSON () {
62
+ return transformed.map.toJSON();
63
+ },
64
+ toString () {
65
+ return transformed.map.toString();
66
+ }
67
+ });
68
+ result.root = postcss.parse(transformed.code.toString("utf8"));
69
+ } catch (err) {
70
+ if (typeof process !== "undefined" && process.env.JEST_WORKER_ID) {
71
+ let lines = err.source.split("\n");
72
+ err = new Error([
73
+ "Error formatting using Lightning CSS:",
74
+ "",
75
+ ...[
76
+ "```css",
77
+ ...lines.slice(Math.max(err.loc.line - 3, 0), err.loc.line),
78
+ " ".repeat(err.loc.column - 1) + "^-- " + err.toString(),
79
+ ...lines.slice(err.loc.line, err.loc.line + 2),
80
+ "```"
81
+ ]
82
+ ].join("\n"));
83
+ }
84
+ if (Error.captureStackTrace) {
85
+ Error.captureStackTrace(err, lightningCssPlugin);
86
+ }
87
+ throw err;
88
+ }
89
+ },
90
+ _sharedState.env.DEBUG && function(root) {
91
+ console.timeEnd("JIT TOTAL");
92
+ console.log("\n");
93
+ return root;
94
+ }
95
+ ].filter(Boolean)
96
+ };
97
+ };
98
+ module.exports.postcss = true;
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>_default
7
+ get: function() {
8
+ return _default;
9
+ }
8
10
  });
9
11
  const _plugin = require("./plugin");
10
12
  const _default = Object.assign(function(opts) {
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "nesting", {
6
6
  enumerable: true,
7
- get: ()=>nesting
7
+ get: function() {
8
+ return nesting;
9
+ }
8
10
  });
9
- const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
10
- const _postcssNested = /*#__PURE__*/ _interopRequireDefault(require("postcss-nested"));
11
- function _interopRequireDefault(obj) {
11
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
12
+ const _postcssnested = /*#__PURE__*/ _interop_require_default(require("postcss-nested"));
13
+ function _interop_require_default(obj) {
12
14
  return obj && obj.__esModule ? obj : {
13
15
  default: obj
14
16
  };
15
17
  }
16
- function nesting(opts = _postcssNested.default) {
18
+ function nesting(opts = _postcssnested.default) {
17
19
  return (root, result)=>{
18
20
  root.walkAtRules("screen", (rule)=>{
19
21
  rule.name = "media";
@@ -28,15 +30,15 @@ function nesting(opts = _postcssNested.default) {
28
30
  rule.remove();
29
31
  });
30
32
  let plugin = (()=>{
31
- var ref;
32
- if (typeof opts === "function" || typeof opts === "object" && (opts === null || opts === void 0 ? void 0 : (ref = opts.hasOwnProperty) === null || ref === void 0 ? void 0 : ref.call(opts, "postcssPlugin"))) {
33
+ var _opts_hasOwnProperty;
34
+ if (typeof opts === "function" || typeof opts === "object" && (opts === null || opts === void 0 ? void 0 : (_opts_hasOwnProperty = opts.hasOwnProperty) === null || _opts_hasOwnProperty === void 0 ? void 0 : _opts_hasOwnProperty.call(opts, "postcssPlugin"))) {
33
35
  return opts;
34
36
  }
35
37
  if (typeof opts === "string") {
36
38
  return require(opts);
37
39
  }
38
40
  if (Object.keys(opts).length <= 0) {
39
- return _postcssNested.default;
41
+ return _postcssnested.default;
40
42
  }
41
43
  throw new Error("tailwindcss/nesting should be loaded with a nesting plugin.");
42
44
  })();
@@ -4,21 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>processTailwindFeatures
7
+ get: function() {
8
+ return processTailwindFeatures;
9
+ }
8
10
  });
9
- const _normalizeTailwindDirectives = /*#__PURE__*/ _interopRequireDefault(require("./lib/normalizeTailwindDirectives"));
10
- const _expandTailwindAtRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/expandTailwindAtRules"));
11
- const _expandApplyAtRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/expandApplyAtRules"));
12
- const _evaluateTailwindFunctions = /*#__PURE__*/ _interopRequireDefault(require("./lib/evaluateTailwindFunctions"));
13
- const _substituteScreenAtRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/substituteScreenAtRules"));
14
- const _resolveDefaultsAtRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/resolveDefaultsAtRules"));
15
- const _collapseAdjacentRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/collapseAdjacentRules"));
16
- const _collapseDuplicateDeclarations = /*#__PURE__*/ _interopRequireDefault(require("./lib/collapseDuplicateDeclarations"));
17
- const _partitionApplyAtRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/partitionApplyAtRules"));
18
- const _detectNesting = /*#__PURE__*/ _interopRequireDefault(require("./lib/detectNesting"));
11
+ const _normalizeTailwindDirectives = /*#__PURE__*/ _interop_require_default(require("./lib/normalizeTailwindDirectives"));
12
+ const _expandTailwindAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/expandTailwindAtRules"));
13
+ const _expandApplyAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/expandApplyAtRules"));
14
+ const _evaluateTailwindFunctions = /*#__PURE__*/ _interop_require_default(require("./lib/evaluateTailwindFunctions"));
15
+ const _substituteScreenAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/substituteScreenAtRules"));
16
+ const _resolveDefaultsAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/resolveDefaultsAtRules"));
17
+ const _collapseAdjacentRules = /*#__PURE__*/ _interop_require_default(require("./lib/collapseAdjacentRules"));
18
+ const _collapseDuplicateDeclarations = /*#__PURE__*/ _interop_require_default(require("./lib/collapseDuplicateDeclarations"));
19
+ const _partitionApplyAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/partitionApplyAtRules"));
20
+ const _detectNesting = /*#__PURE__*/ _interop_require_default(require("./lib/detectNesting"));
19
21
  const _setupContextUtils = require("./lib/setupContextUtils");
20
22
  const _featureFlags = require("./featureFlags");
21
- function _interopRequireDefault(obj) {
23
+ function _interop_require_default(obj) {
22
24
  return obj && obj.__esModule ? obj : {
23
25
  default: obj
24
26
  };