You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
3.3 KiB

2 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. Object.defineProperty(exports, "default", {
  6. enumerable: true,
  7. get: ()=>processTailwindFeatures
  8. });
  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"));
  19. const _setupContextUtils = require("./lib/setupContextUtils");
  20. const _featureFlags = require("./featureFlags");
  21. function _interopRequireDefault(obj) {
  22. return obj && obj.__esModule ? obj : {
  23. default: obj
  24. };
  25. }
  26. function processTailwindFeatures(setupContext) {
  27. return function(root, result) {
  28. let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives.default)(root);
  29. (0, _detectNesting.default)()(root, result);
  30. // Partition apply rules that are found in the css
  31. // itself.
  32. (0, _partitionApplyAtRules.default)()(root, result);
  33. let context = setupContext({
  34. tailwindDirectives,
  35. applyDirectives,
  36. registerDependency (dependency) {
  37. result.messages.push({
  38. plugin: "tailwindcss",
  39. parent: result.opts.from,
  40. ...dependency
  41. });
  42. },
  43. createContext (tailwindConfig, changedContent) {
  44. return (0, _setupContextUtils.createContext)(tailwindConfig, changedContent, root);
  45. }
  46. })(root, result);
  47. if (context.tailwindConfig.separator === "-") {
  48. throw new Error("The '-' character cannot be used as a custom separator in JIT mode due to parsing ambiguity. Please use another character like '_' instead.");
  49. }
  50. (0, _featureFlags.issueFlagNotices)(context.tailwindConfig);
  51. (0, _expandTailwindAtRules.default)(context)(root, result);
  52. // Partition apply rules that are generated by
  53. // addComponents, addUtilities and so on.
  54. (0, _partitionApplyAtRules.default)()(root, result);
  55. (0, _expandApplyAtRules.default)(context)(root, result);
  56. (0, _evaluateTailwindFunctions.default)(context)(root, result);
  57. (0, _substituteScreenAtRules.default)(context)(root, result);
  58. (0, _resolveDefaultsAtRules.default)(context)(root, result);
  59. (0, _collapseAdjacentRules.default)(context)(root, result);
  60. (0, _collapseDuplicateDeclarations.default)(context)(root, result);
  61. };
  62. }