tailwindcss 0.0.0-oxide-insiders.f821c71 → 0.0.0-oxide-insiders.8e60a3c

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.
package/lib/plugin.js CHANGED
@@ -37,6 +37,56 @@ module.exports = function tailwindcss(configOrPath) {
37
37
  }
38
38
  (0, _processTailwindFeatures.default)(context)(root, result);
39
39
  },
40
+ _sharedState.env.OXIDE && 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
+ },
40
90
  _sharedState.env.DEBUG && function(root) {
41
91
  console.timeEnd("JIT TOTAL");
42
92
  console.log("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "0.0.0-oxide-insiders.f821c71",
3
+ "version": "0.0.0-oxide-insiders.8e60a3c",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -70,7 +70,7 @@
70
70
  "postcss": "^8.0.9"
71
71
  },
72
72
  "dependencies": {
73
- "@tailwindcss/oxide": "0.0.0-oxide-insiders.f821c71",
73
+ "@tailwindcss/oxide": "0.0.0-oxide-insiders.8e60a3c",
74
74
  "arg": "^5.0.2",
75
75
  "browserslist": "^4.21.4",
76
76
  "chokidar": "^3.5.3",
@@ -81,7 +81,7 @@
81
81
  "fast-glob": "^3.2.12",
82
82
  "glob-parent": "^6.0.2",
83
83
  "is-glob": "^4.0.3",
84
- "lightningcss": "^1.17.1",
84
+ "lightningcss": "^1.18.0",
85
85
  "lilconfig": "^2.0.6",
86
86
  "micromatch": "^4.0.5",
87
87
  "normalize-path": "^3.0.0",
package/src/plugin.js CHANGED
@@ -34,6 +34,66 @@ module.exports = function tailwindcss(configOrPath) {
34
34
 
35
35
  processTailwindFeatures(context)(root, result)
36
36
  },
37
+ env.OXIDE &&
38
+ function lightningCssPlugin(_root, result) {
39
+ let postcss = require('postcss')
40
+ let lightningcss = require('lightningcss')
41
+ let browserslist = require('browserslist')
42
+
43
+ try {
44
+ let transformed = lightningcss.transform({
45
+ filename: result.opts.from,
46
+ code: Buffer.from(result.root.toString()),
47
+ minify: false,
48
+ sourceMap: !!result.map,
49
+ inputSourceMap: result.map ? result.map.toString() : undefined,
50
+ targets:
51
+ typeof process !== 'undefined' && process.env.JEST_WORKER_ID
52
+ ? { chrome: 106 << 16 }
53
+ : lightningcss.browserslistToTargets(
54
+ browserslist(require('../package.json').browserslist)
55
+ ),
56
+
57
+ drafts: {
58
+ nesting: true,
59
+ customMedia: true,
60
+ },
61
+ })
62
+
63
+ result.map = Object.assign(result.map ?? {}, {
64
+ toJSON() {
65
+ return transformed.map.toJSON()
66
+ },
67
+ toString() {
68
+ return transformed.map.toString()
69
+ },
70
+ })
71
+
72
+ result.root = postcss.parse(transformed.code.toString('utf8'))
73
+ } catch (err) {
74
+ if (typeof process !== 'undefined' && process.env.JEST_WORKER_ID) {
75
+ let lines = err.source.split('\n')
76
+ err = new Error(
77
+ [
78
+ 'Error formatting using Lightning CSS:',
79
+ '',
80
+ ...[
81
+ '```css',
82
+ ...lines.slice(Math.max(err.loc.line - 3, 0), err.loc.line),
83
+ ' '.repeat(err.loc.column - 1) + '^-- ' + err.toString(),
84
+ ...lines.slice(err.loc.line, err.loc.line + 2),
85
+ '```',
86
+ ],
87
+ ].join('\n')
88
+ )
89
+ }
90
+
91
+ if (Error.captureStackTrace) {
92
+ Error.captureStackTrace(err, lightningCssPlugin)
93
+ }
94
+ throw err
95
+ }
96
+ },
37
97
  env.DEBUG &&
38
98
  function (root) {
39
99
  console.timeEnd('JIT TOTAL')