tailwindcss 3.2.4 → 3.2.6

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 (98) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/README.md +1 -1
  3. package/lib/cli/build/index.js +5 -1
  4. package/lib/cli/build/plugin.js +39 -34
  5. package/lib/cli/index.js +231 -10
  6. package/lib/cli/init/index.js +2 -2
  7. package/lib/cli.js +4 -226
  8. package/lib/corePlugins.js +45 -27
  9. package/lib/featureFlags.js +8 -8
  10. package/lib/index.js +4 -46
  11. package/lib/lib/collapseAdjacentRules.js +2 -2
  12. package/lib/lib/collapseDuplicateDeclarations.js +2 -2
  13. package/lib/lib/content.js +16 -16
  14. package/lib/lib/defaultExtractor.js +10 -5
  15. package/lib/lib/detectNesting.js +7 -1
  16. package/lib/lib/evaluateTailwindFunctions.js +4 -4
  17. package/lib/lib/expandApplyAtRules.js +2 -2
  18. package/lib/lib/expandTailwindAtRules.js +34 -9
  19. package/lib/lib/findAtConfigPath.js +3 -3
  20. package/lib/lib/generateRules.js +105 -50
  21. package/lib/lib/offsets.js +88 -1
  22. package/lib/lib/remap-bitfield.js +87 -0
  23. package/lib/lib/resolveDefaultsAtRules.js +4 -4
  24. package/lib/lib/setupContextUtils.js +121 -80
  25. package/lib/lib/setupTrackingContext.js +25 -4
  26. package/lib/lib/sharedState.js +19 -1
  27. package/lib/oxide/cli/build/deps.js +81 -0
  28. package/lib/oxide/cli/build/index.js +47 -0
  29. package/lib/oxide/cli/build/plugin.js +364 -0
  30. package/lib/oxide/cli/build/utils.js +77 -0
  31. package/lib/oxide/cli/build/watching.js +177 -0
  32. package/lib/oxide/cli/help/index.js +70 -0
  33. package/lib/oxide/cli/index.js +220 -0
  34. package/lib/oxide/cli/init/index.js +35 -0
  35. package/lib/oxide/cli.js +5 -0
  36. package/lib/oxide/postcss-plugin.js +2 -0
  37. package/lib/plugin.js +98 -0
  38. package/lib/postcss-plugins/nesting/plugin.js +2 -2
  39. package/lib/util/cloneNodes.js +2 -2
  40. package/lib/util/color.js +20 -6
  41. package/lib/util/createUtilityPlugin.js +2 -2
  42. package/lib/util/dataTypes.js +26 -2
  43. package/lib/util/defaults.js +4 -4
  44. package/lib/util/escapeClassName.js +3 -3
  45. package/lib/util/formatVariantSelector.js +171 -105
  46. package/lib/util/getAllConfigs.js +2 -2
  47. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +2 -2
  48. package/lib/util/negateValue.js +2 -2
  49. package/lib/util/normalizeConfig.js +22 -22
  50. package/lib/util/pluginUtils.js +38 -40
  51. package/lib/util/prefixSelector.js +22 -8
  52. package/lib/util/resolveConfig.js +8 -10
  53. package/package.json +30 -19
  54. package/peers/index.js +61 -42
  55. package/resolveConfig.d.ts +11 -2
  56. package/scripts/swap-engines.js +40 -0
  57. package/src/cli/build/index.js +6 -2
  58. package/src/cli/build/plugin.js +14 -9
  59. package/src/cli/index.js +234 -3
  60. package/src/cli.js +4 -220
  61. package/src/corePlugins.js +31 -3
  62. package/src/index.js +4 -46
  63. package/src/lib/content.js +12 -17
  64. package/src/lib/defaultExtractor.js +9 -3
  65. package/src/lib/detectNesting.js +9 -1
  66. package/src/lib/expandTailwindAtRules.js +35 -6
  67. package/src/lib/generateRules.js +90 -28
  68. package/src/lib/offsets.js +104 -1
  69. package/src/lib/remap-bitfield.js +82 -0
  70. package/src/lib/setupContextUtils.js +97 -55
  71. package/src/lib/setupTrackingContext.js +31 -6
  72. package/src/lib/sharedState.js +17 -0
  73. package/src/oxide/cli/build/deps.ts +91 -0
  74. package/src/oxide/cli/build/index.ts +47 -0
  75. package/src/oxide/cli/build/plugin.ts +436 -0
  76. package/src/oxide/cli/build/utils.ts +74 -0
  77. package/src/oxide/cli/build/watching.ts +225 -0
  78. package/src/oxide/cli/help/index.ts +69 -0
  79. package/src/oxide/cli/index.ts +212 -0
  80. package/src/oxide/cli/init/index.ts +32 -0
  81. package/src/oxide/cli.ts +1 -0
  82. package/src/oxide/postcss-plugin.ts +1 -0
  83. package/src/plugin.js +107 -0
  84. package/src/util/color.js +17 -2
  85. package/src/util/dataTypes.js +29 -4
  86. package/src/util/formatVariantSelector.js +215 -122
  87. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  88. package/src/util/negateValue.js +1 -1
  89. package/src/util/pluginUtils.js +22 -19
  90. package/src/util/prefixSelector.js +28 -10
  91. package/src/util/resolveConfig.js +0 -2
  92. package/stubs/defaultConfig.stub.js +149 -165
  93. package/types/config.d.ts +7 -2
  94. package/types/generated/default-theme.d.ts +77 -77
  95. package/lib/cli/shared.js +0 -12
  96. package/scripts/install-integrations.js +0 -27
  97. package/scripts/rebuildFixtures.js +0 -68
  98. package/src/cli/shared.js +0 -5
@@ -2,7 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "default", {
5
+ Object.defineProperty(exports, /**
6
+ * @template {string | import('postcss-selector-parser').Root} T
7
+ *
8
+ * Prefix all classes in the selector with the given prefix
9
+ *
10
+ * It can take either a string or a selector AST and will return the same type
11
+ *
12
+ * @param {string} prefix
13
+ * @param {T} selector
14
+ * @param {boolean} prependNegative
15
+ * @returns {T}
16
+ */ "default", {
6
17
  enumerable: true,
7
18
  get: ()=>_default
8
19
  });
@@ -13,11 +24,14 @@ function _interopRequireDefault(obj) {
13
24
  };
14
25
  }
15
26
  function _default(prefix, selector, prependNegative = false) {
16
- return (0, _postcssSelectorParser.default)((selectors)=>{
17
- selectors.walkClasses((classSelector)=>{
18
- let baseClass = classSelector.value;
19
- let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith("-");
20
- classSelector.value = shouldPlaceNegativeBeforePrefix ? `-${prefix}${baseClass.slice(1)}` : `${prefix}${baseClass}`;
21
- });
22
- }).processSync(selector);
27
+ if (prefix === "") {
28
+ return selector;
29
+ }
30
+ let ast = typeof selector === "string" ? (0, _postcssSelectorParser.default)().astSync(selector) : selector;
31
+ ast.walkClasses((classSelector)=>{
32
+ let baseClass = classSelector.value;
33
+ let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith("-");
34
+ classSelector.value = shouldPlaceNegativeBeforePrefix ? `-${prefix}${baseClass.slice(1)}` : `${prefix}${baseClass}`;
35
+ });
36
+ return typeof selector === "string" ? ast.toString() : ast;
23
37
  }
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "default", {
9
9
  const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
10
10
  const _corePluginList = /*#__PURE__*/ _interopRequireDefault(require("../corePluginList"));
11
11
  const _configurePlugins = /*#__PURE__*/ _interopRequireDefault(require("./configurePlugins"));
12
- const _defaultConfigStub = /*#__PURE__*/ _interopRequireDefault(require("../../stubs/defaultConfig.stub"));
13
12
  const _colors = /*#__PURE__*/ _interopRequireDefault(require("../public/colors"));
14
13
  const _defaults = require("./defaults");
15
14
  const _toPath = require("./toPath");
@@ -189,8 +188,8 @@ function extractPluginConfigs(configs) {
189
188
  ...allConfigs,
190
189
  config
191
190
  ];
192
- var ref;
193
- const plugins = (ref = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref !== void 0 ? ref : [];
191
+ var _config_plugins;
192
+ const plugins = (_config_plugins = config === null || config === void 0 ? void 0 : config.plugins) !== null && _config_plugins !== void 0 ? _config_plugins : [];
194
193
  if (plugins.length === 0) {
195
194
  return;
196
195
  }
@@ -198,11 +197,11 @@ function extractPluginConfigs(configs) {
198
197
  if (plugin.__isOptionsFunction) {
199
198
  plugin = plugin();
200
199
  }
201
- var ref;
200
+ var _plugin_config;
202
201
  allConfigs = [
203
202
  ...allConfigs,
204
203
  ...extractPluginConfigs([
205
- (ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {}
204
+ (_plugin_config = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && _plugin_config !== void 0 ? _plugin_config : {}
206
205
  ])
207
206
  ];
208
207
  });
@@ -239,18 +238,17 @@ function resolveConfig(configs) {
239
238
  {
240
239
  prefix: "",
241
240
  important: false,
242
- separator: ":",
243
- variantOrder: _defaultConfigStub.default.variantOrder
241
+ separator: ":"
244
242
  }
245
243
  ];
246
- var ref, ref1;
244
+ var _t_theme, _c_plugins;
247
245
  return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
248
246
  theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
249
- return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {};
247
+ return (_t_theme = t === null || t === void 0 ? void 0 : t.theme) !== null && _t_theme !== void 0 ? _t_theme : {};
250
248
  })))),
251
249
  corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
252
250
  plugins: resolvePluginLists(configs.map((c)=>{
253
- return (ref1 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref1 !== void 0 ? ref1 : [];
251
+ return (_c_plugins = c === null || c === void 0 ? void 0 : c.plugins) !== null && _c_plugins !== void 0 ? _c_plugins : [];
254
252
  }))
255
253
  }, ...allConfigs));
256
254
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.2.4",
3
+ "version": "3.2.6",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -12,12 +12,14 @@
12
12
  "tailwind": "lib/cli.js",
13
13
  "tailwindcss": "lib/cli.js"
14
14
  },
15
+ "tailwindcss": {
16
+ "engine": "stable"
17
+ },
15
18
  "scripts": {
16
- "preswcify": "npm run generate && rimraf lib",
17
- "swcify": "swc src --out-dir lib --copy-files",
18
- "postswcify": "esbuild lib/cli-peer-dependencies.js --bundle --platform=node --outfile=peers/index.js",
19
- "rebuild-fixtures": "npm run swcify && node -r @swc/register scripts/rebuildFixtures.js",
20
- "prepublishOnly": "npm install --force && npm run swcify",
19
+ "prebuild": "npm run generate && rimraf lib",
20
+ "build": "swc src --out-dir lib --copy-files",
21
+ "postbuild": "esbuild lib/cli-peer-dependencies.js --bundle --platform=node --outfile=peers/index.js --define:process.env.CSS_TRANSFORMER_WASM=false",
22
+ "rebuild-fixtures": "npm run build && node -r @swc/register scripts/rebuildFixtures.js",
21
23
  "style": "eslint .",
22
24
  "pretest": "npm run generate",
23
25
  "test": "jest",
@@ -27,7 +29,8 @@
27
29
  "generate:types": "node -r @swc/register scripts/generate-types.js",
28
30
  "generate": "npm run generate:plugin-list && npm run generate:types",
29
31
  "release-channel": "node ./scripts/release-channel.js",
30
- "release-notes": "node ./scripts/release-notes.js"
32
+ "release-notes": "node ./scripts/release-notes.js",
33
+ "prepublishOnly": "npm install --force && npm run build"
31
34
  },
32
35
  "files": [
33
36
  "src/*",
@@ -43,21 +46,25 @@
43
46
  "*.js"
44
47
  ],
45
48
  "devDependencies": {
46
- "@swc/cli": "^0.1.57",
47
- "@swc/core": "^1.3.11",
48
- "@swc/jest": "^0.2.23",
49
- "@swc/register": "^0.1.10",
49
+ "@swc/cli": "0.1.59",
50
+ "@swc/core": "1.3.24",
51
+ "@swc/jest": "0.2.24",
52
+ "@swc/register": "0.1.10",
50
53
  "autoprefixer": "^10.4.13",
54
+ "browserslist": "^4.21.4",
55
+ "concurrently": "^7.5.0",
51
56
  "cssnano": "^5.1.14",
52
- "esbuild": "^0.15.12",
53
- "eslint": "^8.26.0",
54
- "eslint-config-prettier": "^8.5.0",
57
+ "esbuild": "^0.16.10",
58
+ "eslint": "^8.31.0",
59
+ "eslint-config-prettier": "^8.6.0",
55
60
  "eslint-plugin-prettier": "^4.2.1",
56
61
  "jest": "^28.1.3",
57
62
  "jest-diff": "^28.1.3",
58
- "prettier": "^2.7.1",
63
+ "lightningcss": "^1.18.0",
64
+ "prettier": "^2.8.1",
59
65
  "rimraf": "^3.0.0",
60
- "source-map-js": "^1.0.2"
66
+ "source-map-js": "^1.0.2",
67
+ "turbo": "^1.6.3"
61
68
  },
62
69
  "peerDependencies": {
63
70
  "postcss": "^8.0.9"
@@ -77,12 +84,12 @@
77
84
  "normalize-path": "^3.0.0",
78
85
  "object-hash": "^3.0.0",
79
86
  "picocolors": "^1.0.0",
80
- "postcss": "^8.4.18",
87
+ "postcss": "^8.0.9",
81
88
  "postcss-import": "^14.1.0",
82
89
  "postcss-js": "^4.0.0",
83
90
  "postcss-load-config": "^3.1.4",
84
91
  "postcss-nested": "6.0.0",
85
- "postcss-selector-parser": "^6.0.10",
92
+ "postcss-selector-parser": "^6.0.11",
86
93
  "postcss-value-parser": "^4.2.0",
87
94
  "quick-lru": "^5.1.1",
88
95
  "resolve": "^1.22.1"
@@ -104,8 +111,12 @@
104
111
  "/standalone-cli/",
105
112
  "\\.test\\.skip\\.js$"
106
113
  ],
114
+ "transformIgnorePatterns": [
115
+ "node_modules/(?!lightningcss)"
116
+ ],
107
117
  "transform": {
108
- "\\.js$": "@swc/jest"
118
+ "\\.js$": "@swc/jest",
119
+ "\\.ts$": "@swc/jest"
109
120
  }
110
121
  },
111
122
  "engines": {
package/peers/index.js CHANGED
@@ -3248,7 +3248,7 @@ var require_input = __commonJS({
3248
3248
  if (line && typeof line === "object") {
3249
3249
  let start = line;
3250
3250
  let end = column;
3251
- if (typeof line.offset === "number") {
3251
+ if (typeof start.offset === "number") {
3252
3252
  let pos = this.fromOffset(start.offset);
3253
3253
  line = pos.line;
3254
3254
  column = pos.col;
@@ -3636,7 +3636,8 @@ var require_map_generator = __commonJS({
3636
3636
  }
3637
3637
  if (node && type !== "start") {
3638
3638
  let p = node.parent || { raws: {} };
3639
- if (node.type !== "decl" || node !== p.last || p.raws.semicolon) {
3639
+ let childless = node.type === "decl" || node.type === "atrule" && !node.nodes;
3640
+ if (!childless || node !== p.last || p.raws.semicolon) {
3640
3641
  if (node.source && node.source.end) {
3641
3642
  mapping.source = this.sourcePath(node);
3642
3643
  mapping.original.line = node.source.end.line;
@@ -3856,7 +3857,7 @@ var require_container = __commonJS({
3856
3857
  }
3857
3858
  insertBefore(exist, add) {
3858
3859
  let existIndex = this.index(exist);
3859
- let type = exist === 0 ? "prepend" : false;
3860
+ let type = existIndex === 0 ? "prepend" : false;
3860
3861
  let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();
3861
3862
  existIndex = this.index(exist);
3862
3863
  for (let node of nodes)
@@ -5576,7 +5577,7 @@ var require_processor = __commonJS({
5576
5577
  var Root = require_root();
5577
5578
  var Processor = class {
5578
5579
  constructor(plugins = []) {
5579
- this.version = "8.4.18";
5580
+ this.version = "8.4.21";
5580
5581
  this.plugins = this.normalize(plugins);
5581
5582
  }
5582
5583
  use(plugin) {
@@ -56608,12 +56609,6 @@ var require_walker = __commonJS({
56608
56609
  var require_package = __commonJS({
56609
56610
  "node_modules/css-tree/package.json"(exports2, module2) {
56610
56611
  module2.exports = {
56611
- _args: [
56612
- [
56613
- "css-tree@1.1.3",
56614
- "/home/runner/work/tailwindcss/tailwindcss"
56615
- ]
56616
- ],
56617
56612
  _development: true,
56618
56613
  _from: "css-tree@1.1.3",
56619
56614
  _id: "css-tree@1.1.3",
@@ -56636,7 +56631,8 @@ var require_package = __commonJS({
56636
56631
  "/svgo"
56637
56632
  ],
56638
56633
  _resolved: "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz",
56639
- _spec: "1.1.3",
56634
+ _shasum: "eb4870fb6fd7707327ec95c2ff2ab09b5e8db91d",
56635
+ _spec: "css-tree@1.1.3",
56640
56636
  _where: "/home/runner/work/tailwindcss/tailwindcss",
56641
56637
  author: {
56642
56638
  name: "Roman Dvornov",
@@ -56646,10 +56642,12 @@ var require_package = __commonJS({
56646
56642
  bugs: {
56647
56643
  url: "https://github.com/csstree/csstree/issues"
56648
56644
  },
56645
+ bundleDependencies: false,
56649
56646
  dependencies: {
56650
56647
  "mdn-data": "2.0.14",
56651
56648
  "source-map": "^0.6.1"
56652
56649
  },
56650
+ deprecated: false,
56653
56651
  description: "A tool set for CSS: fast detailed parser (CSS \u2192 AST), walker (AST traversal), generator (AST \u2192 CSS) and lexer (validation and matching) based on specs and browser implementations",
56654
56652
  devDependencies: {
56655
56653
  "@rollup/plugin-commonjs": "^11.0.2",
@@ -60328,12 +60326,6 @@ var require_compress = __commonJS({
60328
60326
  var require_package2 = __commonJS({
60329
60327
  "node_modules/csso/package.json"(exports2, module2) {
60330
60328
  module2.exports = {
60331
- _args: [
60332
- [
60333
- "csso@4.2.0",
60334
- "/home/runner/work/tailwindcss/tailwindcss"
60335
- ]
60336
- ],
60337
60329
  _development: true,
60338
60330
  _from: "csso@4.2.0",
60339
60331
  _id: "csso@4.2.0",
@@ -60355,7 +60347,8 @@ var require_package2 = __commonJS({
60355
60347
  "/svgo"
60356
60348
  ],
60357
60349
  _resolved: "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz",
60358
- _spec: "4.2.0",
60350
+ _shasum: "ea3a561346e8dc9f546d6febedd50187cf389529",
60351
+ _spec: "csso@4.2.0",
60359
60352
  _where: "/home/runner/work/tailwindcss/tailwindcss",
60360
60353
  author: {
60361
60354
  name: "Sergey Kryzhanovsky",
@@ -60368,9 +60361,11 @@ var require_package2 = __commonJS({
60368
60361
  bugs: {
60369
60362
  url: "https://github.com/css/csso/issues"
60370
60363
  },
60364
+ bundleDependencies: false,
60371
60365
  dependencies: {
60372
60366
  "css-tree": "^1.1.2"
60373
60367
  },
60368
+ deprecated: false,
60374
60369
  description: "CSS minifier with structural optimisations",
60375
60370
  devDependencies: {
60376
60371
  "@rollup/plugin-commonjs": "^11.0.1",
@@ -69659,6 +69654,20 @@ var require_attribute = __commonJS({
69659
69654
  this._value = v;
69660
69655
  }
69661
69656
  }
69657
+ }, {
69658
+ key: "insensitive",
69659
+ get: function get() {
69660
+ return this._insensitive;
69661
+ },
69662
+ set: function set(insensitive) {
69663
+ if (!insensitive) {
69664
+ this._insensitive = false;
69665
+ if (this.raws && (this.raws.insensitiveFlag === "I" || this.raws.insensitiveFlag === "i")) {
69666
+ this.raws.insensitiveFlag = void 0;
69667
+ }
69668
+ }
69669
+ this._insensitive = insensitive;
69670
+ }
69662
69671
  }, {
69663
69672
  key: "attribute",
69664
69673
  get: function get() {
@@ -70462,7 +70471,7 @@ var require_parser4 = __commonJS({
70462
70471
  node.raws.attribute += content;
70463
70472
  }
70464
70473
  lastAdded = "attribute";
70465
- } else if (!node.value && node.value !== "" || lastAdded === "value" && !spaceAfterMeaningfulToken) {
70474
+ } else if (!node.value && node.value !== "" || lastAdded === "value" && !(spaceAfterMeaningfulToken || node.quoteMark)) {
70466
70475
  var _unescaped = (0, _util.unesc)(content);
70467
70476
  var _oldRawValue = (0, _util.getProp)(node, "raws", "value") || "";
70468
70477
  var oldValue = node.value || "";
@@ -79487,26 +79496,36 @@ function lazyAutoprefixer() {
79487
79496
  function lazyCssnano() {
79488
79497
  return require_src32();
79489
79498
  }
79490
- /*! https://mths.be/cssesc v3.0.0 by @mathias */
79491
- /**
79492
- * @author Ben Briggs
79493
- * @license MIT
79494
- * @module cssnano:preset:default
79495
- * @overview
79496
- *
79497
- * This default preset for cssnano only includes transforms that make no
79498
- * assumptions about your CSS other than what is passed in. In previous
79499
- * iterations of cssnano, assumptions were made about your CSS which caused
79500
- * output to look different in certain use cases, but not others. These
79501
- * transforms have been moved from the defaults to other presets, to make
79502
- * this preset require only minimal configuration.
79503
- */
79504
- /**
79505
- * @license Fraction.js v4.2.0 05/03/2022
79506
- * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
79507
- *
79508
- * Copyright (c) 2021, Robert Eisele (robert@xarg.org)
79509
- * Dual licensed under the MIT or GPL Version 2 licenses.
79510
- **/
79511
- //! stable.js 0.1.8, https://github.com/Two-Screen/stable
79512
- //! © 2018 Angry Bytes and contributors. MIT licensed.
79499
+ /*! Bundled license information:
79500
+
79501
+ fraction.js/fraction.js:
79502
+ (**
79503
+ * @license Fraction.js v4.2.0 05/03/2022
79504
+ * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
79505
+ *
79506
+ * Copyright (c) 2021, Robert Eisele (robert@xarg.org)
79507
+ * Dual licensed under the MIT or GPL Version 2 licenses.
79508
+ **)
79509
+
79510
+ stable/stable.js:
79511
+ (*! stable.js 0.1.8, https://github.com/Two-Screen/stable *)
79512
+ (*! © 2018 Angry Bytes and contributors. MIT licensed. *)
79513
+
79514
+ cssesc/cssesc.js:
79515
+ (*! https://mths.be/cssesc v3.0.0 by @mathias *)
79516
+
79517
+ cssnano-preset-default/src/index.js:
79518
+ (**
79519
+ * @author Ben Briggs
79520
+ * @license MIT
79521
+ * @module cssnano:preset:default
79522
+ * @overview
79523
+ *
79524
+ * This default preset for cssnano only includes transforms that make no
79525
+ * assumptions about your CSS other than what is passed in. In previous
79526
+ * iterations of cssnano, assumptions were made about your CSS which caused
79527
+ * output to look different in certain use cases, but not others. These
79528
+ * transforms have been moved from the defaults to other presets, to make
79529
+ * this preset require only minimal configuration.
79530
+ *)
79531
+ */
@@ -1,3 +1,12 @@
1
- import type { Config } from './types/config'
2
- declare function resolveConfig(config: Config): Config
1
+ import type { Config, ResolvableTo } from './types/config'
2
+
3
+ type UnwrapResolvables<T> = {
4
+ [K in keyof T]: T[K] extends ResolvableTo<infer R> ? R : T[K]
5
+ }
6
+
7
+ type ResolvedConfig<T extends Config> = Omit<T, 'theme'> & {
8
+ theme: UnwrapResolvables<T['theme']>
9
+ }
10
+
11
+ declare function resolveConfig<T extends Config>(config: T): ResolvedConfig<T>
3
12
  export = resolveConfig
@@ -0,0 +1,40 @@
1
+ let fs = require('fs')
2
+ let path = require('path')
3
+
4
+ let engines = {
5
+ stable: {
6
+ files: [
7
+ path.resolve(__dirname, '..', 'package.stable.json'),
8
+ path.resolve(__dirname, '..', 'package-lock.stable.json'),
9
+ ],
10
+ },
11
+ oxide: {
12
+ files: [
13
+ path.resolve(__dirname, '..', 'package.oxide.json'),
14
+ path.resolve(__dirname, '..', 'package-lock.oxide.json'),
15
+ ],
16
+ },
17
+ }
18
+
19
+ // Find out what the current engine is that we are using:
20
+ let [otherEngine, info] = Object.entries(engines).find(([, info]) =>
21
+ info.files.every((file) => fs.existsSync(file))
22
+ )
23
+ let currentEngine = otherEngine === 'oxide' ? 'stable' : 'oxide'
24
+
25
+ console.log(`Current engine: \`${currentEngine}\`, swapping to \`${otherEngine}\``)
26
+
27
+ // Swap the engines
28
+ for (let file of info.files) {
29
+ fs.renameSync(
30
+ file.replace(`.${otherEngine}`, ''),
31
+ file.replace(`.${otherEngine}`, `.${currentEngine}`)
32
+ )
33
+ }
34
+ for (let file of engines[otherEngine].files) {
35
+ fs.renameSync(file, file.replace(`.${otherEngine}`, ''))
36
+ }
37
+
38
+ console.log(
39
+ 'Engines have been swapped. Make sure to run `npm install` to update your dependencies.'
40
+ )
@@ -34,8 +34,12 @@ export async function build(args, configs) {
34
34
  let processor = await createProcessor(args, configPath)
35
35
 
36
36
  if (shouldWatch) {
37
- /* Abort the watcher if stdin is closed to avoid zombie processes */
38
- process.stdin.on('end', () => process.exit(0))
37
+ // Abort the watcher if stdin is closed to avoid zombie processes
38
+ // You can disable this behavior with --watch=always
39
+ if (args['--watch'] !== 'always') {
40
+ process.stdin.on('end', () => process.exit(0))
41
+ }
42
+
39
43
  process.stdin.resume()
40
44
 
41
45
  await processor.watch()
@@ -10,7 +10,7 @@ import loadOptions from 'postcss-load-config/src/options' // Little bit scary, l
10
10
  import tailwind from '../../processTailwindFeatures'
11
11
  import { loadAutoprefixer, loadCssNano, loadPostcss, loadPostcssImport } from './deps'
12
12
  import { formatNodes, drainStdin, outputFile } from './utils'
13
- import { env } from '../shared'
13
+ import { env } from '../../lib/sharedState'
14
14
  import resolveConfig from '../../../resolveConfig.js'
15
15
  import getModuleDependencies from '../../lib/getModuleDependencies.js'
16
16
  import { parseCandidateFiles } from '../../lib/content.js'
@@ -184,10 +184,17 @@ let state = {
184
184
  let files = fastGlob.sync(this.contentPatterns.all)
185
185
 
186
186
  for (let file of files) {
187
- content.push({
188
- content: fs.readFileSync(path.resolve(file), 'utf8'),
189
- extension: path.extname(file).slice(1),
190
- })
187
+ if (env.OXIDE) {
188
+ content.push({
189
+ file,
190
+ extension: path.extname(file).slice(1),
191
+ })
192
+ } else {
193
+ content.push({
194
+ content: fs.readFileSync(path.resolve(file), 'utf8'),
195
+ extension: path.extname(file).slice(1),
196
+ })
197
+ }
191
198
  }
192
199
 
193
200
  // Resolve raw content in the tailwind config
@@ -234,11 +241,9 @@ let state = {
234
241
  env.DEBUG && console.timeEnd('Watch new files')
235
242
  }
236
243
 
237
- env.DEBUG && console.time('Reading content files')
238
244
  for (let file of this.readContentPaths()) {
239
245
  this.context.changedContent.push(file)
240
246
  }
241
- env.DEBUG && console.timeEnd('Reading content files')
242
247
 
243
248
  return this.context
244
249
  },
@@ -355,8 +360,8 @@ export async function createProcessor(args, cliConfigPath) {
355
360
  }
356
361
 
357
362
  return Promise.all([
358
- outputFile(output, result.css),
359
- result.map && outputFile(output + '.map', result.map.toString()),
363
+ outputFile(result.opts.to, result.css),
364
+ result.map && outputFile(result.opts.to + '.map', result.map.toString()),
360
365
  ])
361
366
  })
362
367
  .then(() => {