tailwindcss 3.4.0 → 3.4.2
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/CHANGELOG.md +40 -1
- package/README.md +2 -3
- package/lib/cli/build/plugin.js +4 -11
- package/lib/cli.js +1 -5
- package/lib/corePluginList.js +1 -0
- package/lib/corePlugins.js +92 -25
- package/lib/css/preflight.css +4 -3
- package/lib/featureFlags.js +2 -6
- package/lib/lib/content.js +36 -3
- package/lib/lib/defaultExtractor.js +2 -2
- package/lib/lib/expandApplyAtRules.js +13 -0
- package/lib/lib/expandTailwindAtRules.js +20 -32
- package/lib/lib/generateRules.js +13 -2
- package/lib/lib/load-config.js +4 -0
- package/lib/lib/offsets.js +51 -2
- package/lib/lib/resolveDefaultsAtRules.js +3 -1
- package/lib/lib/setupContextUtils.js +23 -3
- package/lib/lib/sharedState.js +2 -10
- package/lib/plugin.js +0 -50
- package/lib/processTailwindFeatures.js +0 -2
- package/lib/util/dataTypes.js +12 -2
- package/lib/util/pseudoElements.js +3 -0
- package/package.json +5 -8
- package/peers/index.js +61 -61
- package/src/cli/build/plugin.js +4 -11
- package/src/cli.js +1 -5
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +88 -27
- package/src/css/preflight.css +4 -3
- package/src/featureFlags.js +2 -6
- package/src/lib/content.js +42 -1
- package/src/lib/defaultExtractor.js +2 -2
- package/src/lib/expandApplyAtRules.js +17 -0
- package/src/lib/expandTailwindAtRules.js +23 -41
- package/src/lib/generateRules.js +12 -2
- package/src/lib/load-config.ts +5 -0
- package/src/lib/offsets.js +61 -2
- package/src/lib/resolveDefaultsAtRules.js +5 -1
- package/src/lib/setupContextUtils.js +28 -2
- package/src/lib/sharedState.js +0 -4
- package/src/plugin.js +0 -60
- package/src/processTailwindFeatures.js +0 -3
- package/src/util/dataTypes.js +13 -1
- package/src/util/pseudoElements.js +4 -0
- package/types/config.d.ts +7 -0
- package/types/generated/corePluginList.d.ts +1 -1
- package/lib/lib/detectNesting.js +0 -45
- package/lib/oxide/cli/build/deps.js +0 -89
- package/lib/oxide/cli/build/index.js +0 -53
- package/lib/oxide/cli/build/plugin.js +0 -375
- package/lib/oxide/cli/build/utils.js +0 -87
- package/lib/oxide/cli/build/watching.js +0 -179
- package/lib/oxide/cli/help/index.js +0 -72
- package/lib/oxide/cli/index.js +0 -214
- package/lib/oxide/cli/init/index.js +0 -52
- package/lib/oxide/cli.js +0 -5
- package/lib/oxide/postcss-plugin.js +0 -2
- package/scripts/swap-engines.js +0 -40
- package/src/lib/detectNesting.js +0 -47
- package/src/oxide/cli/build/deps.ts +0 -91
- package/src/oxide/cli/build/index.ts +0 -47
- package/src/oxide/cli/build/plugin.ts +0 -442
- package/src/oxide/cli/build/utils.ts +0 -74
- package/src/oxide/cli/build/watching.ts +0 -225
- package/src/oxide/cli/help/index.ts +0 -69
- package/src/oxide/cli/index.ts +0 -204
- package/src/oxide/cli/init/index.ts +0 -59
- package/src/oxide/cli.ts +0 -1
- package/src/oxide/postcss-plugin.ts +0 -1
package/src/plugin.js
CHANGED
|
@@ -34,66 +34,6 @@ module.exports = function tailwindcss(configOrPath) {
|
|
|
34
34
|
|
|
35
35
|
await processTailwindFeatures(context)(root, result)
|
|
36
36
|
},
|
|
37
|
-
__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
|
-
},
|
|
97
37
|
env.DEBUG &&
|
|
98
38
|
function (root) {
|
|
99
39
|
console.timeEnd('JIT TOTAL')
|
|
@@ -7,7 +7,6 @@ import resolveDefaultsAtRules from './lib/resolveDefaultsAtRules'
|
|
|
7
7
|
import collapseAdjacentRules from './lib/collapseAdjacentRules'
|
|
8
8
|
import collapseDuplicateDeclarations from './lib/collapseDuplicateDeclarations'
|
|
9
9
|
import partitionApplyAtRules from './lib/partitionApplyAtRules'
|
|
10
|
-
import detectNesting from './lib/detectNesting'
|
|
11
10
|
import { createContext } from './lib/setupContextUtils'
|
|
12
11
|
import { issueFlagNotices } from './featureFlags'
|
|
13
12
|
|
|
@@ -15,8 +14,6 @@ export default function processTailwindFeatures(setupContext) {
|
|
|
15
14
|
return async function (root, result) {
|
|
16
15
|
let { tailwindDirectives, applyDirectives } = normalizeTailwindDirectives(root)
|
|
17
16
|
|
|
18
|
-
detectNesting()(root, result)
|
|
19
|
-
|
|
20
17
|
// Partition apply rules that are found in the css
|
|
21
18
|
// itself.
|
|
22
19
|
partitionApplyAtRules()(root, result)
|
package/src/util/dataTypes.js
CHANGED
|
@@ -106,6 +106,13 @@ function normalizeMathOperatorSpacing(value) {
|
|
|
106
106
|
'keyboard-inset-left',
|
|
107
107
|
'keyboard-inset-width',
|
|
108
108
|
'keyboard-inset-height',
|
|
109
|
+
|
|
110
|
+
'radial-gradient',
|
|
111
|
+
'linear-gradient',
|
|
112
|
+
'conic-gradient',
|
|
113
|
+
'repeating-radial-gradient',
|
|
114
|
+
'repeating-linear-gradient',
|
|
115
|
+
'repeating-conic-gradient',
|
|
109
116
|
]
|
|
110
117
|
|
|
111
118
|
return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match) => {
|
|
@@ -161,6 +168,11 @@ function normalizeMathOperatorSpacing(value) {
|
|
|
161
168
|
result += consumeUntil([')'])
|
|
162
169
|
}
|
|
163
170
|
|
|
171
|
+
// Don't break CSS grid track names
|
|
172
|
+
else if (peek('[')) {
|
|
173
|
+
result += consumeUntil([']'])
|
|
174
|
+
}
|
|
175
|
+
|
|
164
176
|
// Handle operators
|
|
165
177
|
else if (
|
|
166
178
|
['+', '-', '*', '/'].includes(char) &&
|
|
@@ -381,7 +393,7 @@ let absoluteSizes = new Set([
|
|
|
381
393
|
'medium',
|
|
382
394
|
'large',
|
|
383
395
|
'x-large',
|
|
384
|
-
'
|
|
396
|
+
'xx-large',
|
|
385
397
|
'xxx-large',
|
|
386
398
|
])
|
|
387
399
|
export function absoluteSize(value) {
|
|
@@ -60,6 +60,10 @@ let elementProperties = {
|
|
|
60
60
|
':first-letter': ['terminal', 'jumpable'],
|
|
61
61
|
':first-line': ['terminal', 'jumpable'],
|
|
62
62
|
|
|
63
|
+
':where': [],
|
|
64
|
+
':is': [],
|
|
65
|
+
':has': [],
|
|
66
|
+
|
|
63
67
|
// The default value is used when the pseudo-element is not recognized
|
|
64
68
|
// Because it's not recognized, we don't know if it's terminal or not
|
|
65
69
|
// So we assume it can be moved AND can have user-action pseudo classes attached to it
|
package/types/config.d.ts
CHANGED
|
@@ -74,6 +74,13 @@ type DarkModeConfig =
|
|
|
74
74
|
| 'class'
|
|
75
75
|
// Use the `class` strategy with a custom class instead of `.dark`.
|
|
76
76
|
| ['class', string]
|
|
77
|
+
// Use the `selector` strategy — same as `class` but uses `:where()` for more predicable behavior
|
|
78
|
+
| 'selector'
|
|
79
|
+
// Use the `selector` strategy with a custom selector instead of `.dark`.
|
|
80
|
+
| ['selector', string]
|
|
81
|
+
// Use the `variant` strategy, which allows you to completely customize the selector
|
|
82
|
+
// It takes a string or an array of strings, which are passed directly to `addVariant()`
|
|
83
|
+
| ['variant', string | string[]]
|
|
77
84
|
|
|
78
85
|
type Screen = { raw: string } | { min: string } | { max: string } | { min: string; max: string }
|
|
79
86
|
type ScreensConfig = string[] | KeyValuePair<string, string | Screen | Screen[]>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type CorePluginList = 'preflight' | 'container' | 'accessibility' | 'pointerEvents' | 'visibility' | 'position' | 'inset' | 'isolation' | 'zIndex' | 'order' | 'gridColumn' | 'gridColumnStart' | 'gridColumnEnd' | 'gridRow' | 'gridRowStart' | 'gridRowEnd' | 'float' | 'clear' | 'margin' | 'boxSizing' | 'lineClamp' | 'display' | 'aspectRatio' | 'size' | 'height' | 'maxHeight' | 'minHeight' | 'width' | 'minWidth' | 'maxWidth' | 'flex' | 'flexShrink' | 'flexGrow' | 'flexBasis' | 'tableLayout' | 'captionSide' | 'borderCollapse' | 'borderSpacing' | 'transformOrigin' | 'translate' | 'rotate' | 'skew' | 'scale' | 'transform' | 'animation' | 'cursor' | 'touchAction' | 'userSelect' | 'resize' | 'scrollSnapType' | 'scrollSnapAlign' | 'scrollSnapStop' | 'scrollMargin' | 'scrollPadding' | 'listStylePosition' | 'listStyleType' | 'listStyleImage' | 'appearance' | 'columns' | 'breakBefore' | 'breakInside' | 'breakAfter' | 'gridAutoColumns' | 'gridAutoFlow' | 'gridAutoRows' | 'gridTemplateColumns' | 'gridTemplateRows' | 'flexDirection' | 'flexWrap' | 'placeContent' | 'placeItems' | 'alignContent' | 'alignItems' | 'justifyContent' | 'justifyItems' | 'gap' | 'space' | 'divideWidth' | 'divideStyle' | 'divideColor' | 'divideOpacity' | 'placeSelf' | 'alignSelf' | 'justifySelf' | 'overflow' | 'overscrollBehavior' | 'scrollBehavior' | 'textOverflow' | 'hyphens' | 'whitespace' | 'textWrap' | 'wordBreak' | 'borderRadius' | 'borderWidth' | 'borderStyle' | 'borderColor' | 'borderOpacity' | 'backgroundColor' | 'backgroundOpacity' | 'backgroundImage' | 'gradientColorStops' | 'boxDecorationBreak' | 'backgroundSize' | 'backgroundAttachment' | 'backgroundClip' | 'backgroundPosition' | 'backgroundRepeat' | 'backgroundOrigin' | 'fill' | 'stroke' | 'strokeWidth' | 'objectFit' | 'objectPosition' | 'padding' | 'textAlign' | 'textIndent' | 'verticalAlign' | 'fontFamily' | 'fontSize' | 'fontWeight' | 'textTransform' | 'fontStyle' | 'fontVariantNumeric' | 'lineHeight' | 'letterSpacing' | 'textColor' | 'textOpacity' | 'textDecoration' | 'textDecorationColor' | 'textDecorationStyle' | 'textDecorationThickness' | 'textUnderlineOffset' | 'fontSmoothing' | 'placeholderColor' | 'placeholderOpacity' | 'caretColor' | 'accentColor' | 'opacity' | 'backgroundBlendMode' | 'mixBlendMode' | 'boxShadow' | 'boxShadowColor' | 'outlineStyle' | 'outlineWidth' | 'outlineOffset' | 'outlineColor' | 'ringWidth' | 'ringColor' | 'ringOpacity' | 'ringOffsetWidth' | 'ringOffsetColor' | 'blur' | 'brightness' | 'contrast' | 'dropShadow' | 'grayscale' | 'hueRotate' | 'invert' | 'saturate' | 'sepia' | 'filter' | 'backdropBlur' | 'backdropBrightness' | 'backdropContrast' | 'backdropGrayscale' | 'backdropHueRotate' | 'backdropInvert' | 'backdropOpacity' | 'backdropSaturate' | 'backdropSepia' | 'backdropFilter' | 'transitionProperty' | 'transitionDelay' | 'transitionDuration' | 'transitionTimingFunction' | 'willChange' | 'content' | 'forcedColorAdjust'
|
|
1
|
+
export type CorePluginList = 'preflight' | 'container' | 'accessibility' | 'pointerEvents' | 'visibility' | 'position' | 'inset' | 'isolation' | 'zIndex' | 'order' | 'gridColumn' | 'gridColumnStart' | 'gridColumnEnd' | 'gridRow' | 'gridRowStart' | 'gridRowEnd' | 'float' | 'clear' | 'margin' | 'boxSizing' | 'lineClamp' | 'display' | 'aspectRatio' | 'size' | 'height' | 'maxHeight' | 'minHeight' | 'width' | 'minWidth' | 'maxWidth' | 'flex' | 'flexShrink' | 'flexGrow' | 'flexBasis' | 'tableLayout' | 'captionSide' | 'borderCollapse' | 'borderSpacing' | 'transformOrigin' | 'translate' | 'rotate' | 'skew' | 'scale' | 'transform' | 'animation' | 'cursor' | 'touchAction' | 'userSelect' | 'resize' | 'scrollSnapType' | 'scrollSnapAlign' | 'scrollSnapStop' | 'scrollMargin' | 'scrollPadding' | 'listStylePosition' | 'listStyleType' | 'listStyleImage' | 'appearance' | 'columns' | 'breakBefore' | 'breakInside' | 'breakAfter' | 'gridAutoColumns' | 'gridAutoFlow' | 'gridAutoRows' | 'gridTemplateColumns' | 'gridTemplateRows' | 'flexDirection' | 'flexWrap' | 'placeContent' | 'placeItems' | 'alignContent' | 'alignItems' | 'justifyContent' | 'justifyItems' | 'gap' | 'space' | 'divideWidth' | 'divideStyle' | 'divideColor' | 'divideOpacity' | 'placeSelf' | 'alignSelf' | 'justifySelf' | 'overflow' | 'overscrollBehavior' | 'scrollBehavior' | 'textOverflow' | 'hyphens' | 'whitespace' | 'textWrap' | 'wordBreak' | 'borderRadius' | 'borderWidth' | 'borderStyle' | 'borderColor' | 'borderOpacity' | 'backgroundColor' | 'backgroundOpacity' | 'backgroundImage' | 'gradientColorStops' | 'boxDecorationBreak' | 'backgroundSize' | 'backgroundAttachment' | 'backgroundClip' | 'backgroundPosition' | 'backgroundRepeat' | 'backgroundOrigin' | 'fill' | 'stroke' | 'strokeWidth' | 'objectFit' | 'objectPosition' | 'padding' | 'textAlign' | 'textIndent' | 'verticalAlign' | 'fontFamily' | 'fontSize' | 'fontWeight' | 'textTransform' | 'fontStyle' | 'fontVariantNumeric' | 'lineHeight' | 'letterSpacing' | 'textColor' | 'textOpacity' | 'textDecoration' | 'textDecorationColor' | 'textDecorationStyle' | 'textDecorationThickness' | 'textUnderlineOffset' | 'fontSmoothing' | 'placeholderColor' | 'placeholderOpacity' | 'caretColor' | 'accentColor' | 'opacity' | 'backgroundBlendMode' | 'mixBlendMode' | 'boxShadow' | 'boxShadowColor' | 'outlineStyle' | 'outlineWidth' | 'outlineOffset' | 'outlineColor' | 'ringWidth' | 'ringColor' | 'ringOpacity' | 'ringOffsetWidth' | 'ringOffsetColor' | 'blur' | 'brightness' | 'contrast' | 'dropShadow' | 'grayscale' | 'hueRotate' | 'invert' | 'saturate' | 'sepia' | 'filter' | 'backdropBlur' | 'backdropBrightness' | 'backdropContrast' | 'backdropGrayscale' | 'backdropHueRotate' | 'backdropInvert' | 'backdropOpacity' | 'backdropSaturate' | 'backdropSepia' | 'backdropFilter' | 'transitionProperty' | 'transitionDelay' | 'transitionDuration' | 'transitionTimingFunction' | 'willChange' | 'contain' | 'content' | 'forcedColorAdjust'
|
package/lib/lib/detectNesting.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
function isRoot(node) {
|
|
12
|
-
return node.type === "root";
|
|
13
|
-
}
|
|
14
|
-
function isAtLayer(node) {
|
|
15
|
-
return node.type === "atrule" && node.name === "layer";
|
|
16
|
-
}
|
|
17
|
-
function _default(_context) {
|
|
18
|
-
return (root, result)=>{
|
|
19
|
-
let found = false;
|
|
20
|
-
root.walkAtRules("tailwind", (node)=>{
|
|
21
|
-
if (found) return false;
|
|
22
|
-
if (node.parent && !(isRoot(node.parent) || isAtLayer(node.parent))) {
|
|
23
|
-
found = true;
|
|
24
|
-
node.warn(result, [
|
|
25
|
-
"Nested @tailwind rules were detected, but are not supported.",
|
|
26
|
-
"Consider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix",
|
|
27
|
-
"Alternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy"
|
|
28
|
-
].join("\n"));
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
root.walkRules((rule)=>{
|
|
33
|
-
if (found) return false;
|
|
34
|
-
rule.walkRules((nestedRule)=>{
|
|
35
|
-
found = true;
|
|
36
|
-
nestedRule.warn(result, [
|
|
37
|
-
"Nested CSS was detected, but CSS nesting has not been configured correctly.",
|
|
38
|
-
"Please enable a CSS nesting plugin *before* Tailwind in your configuration.",
|
|
39
|
-
"See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting"
|
|
40
|
-
].join("\n"));
|
|
41
|
-
return false;
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
lazyLightningCss: function() {
|
|
13
|
-
return lazyLightningCss;
|
|
14
|
-
},
|
|
15
|
-
lightningcss: function() {
|
|
16
|
-
return lightningcss;
|
|
17
|
-
},
|
|
18
|
-
loadPostcss: function() {
|
|
19
|
-
return loadPostcss;
|
|
20
|
-
},
|
|
21
|
-
loadPostcssImport: function() {
|
|
22
|
-
return loadPostcssImport;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../../../package.json"));
|
|
26
|
-
const _browserslist = /*#__PURE__*/ _interop_require_default(require("browserslist"));
|
|
27
|
-
const _index = require("../../../../peers/index");
|
|
28
|
-
function _interop_require_default(obj) {
|
|
29
|
-
return obj && obj.__esModule ? obj : {
|
|
30
|
-
default: obj
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function lazyLightningCss() {
|
|
34
|
-
// TODO: Make this lazy/bundled
|
|
35
|
-
return require("lightningcss");
|
|
36
|
-
}
|
|
37
|
-
let lightningCss;
|
|
38
|
-
function loadLightningCss() {
|
|
39
|
-
if (lightningCss) {
|
|
40
|
-
return lightningCss;
|
|
41
|
-
}
|
|
42
|
-
// Try to load a local version first
|
|
43
|
-
try {
|
|
44
|
-
return lightningCss = require("lightningcss");
|
|
45
|
-
} catch {}
|
|
46
|
-
return lightningCss = lazyLightningCss();
|
|
47
|
-
}
|
|
48
|
-
async function lightningcss(shouldMinify, result) {
|
|
49
|
-
let css = loadLightningCss();
|
|
50
|
-
try {
|
|
51
|
-
let transformed = css.transform({
|
|
52
|
-
filename: result.opts.from || "input.css",
|
|
53
|
-
code: Buffer.from(result.css, "utf-8"),
|
|
54
|
-
minify: shouldMinify,
|
|
55
|
-
sourceMap: !!result.map,
|
|
56
|
-
inputSourceMap: result.map ? result.map.toString() : undefined,
|
|
57
|
-
targets: css.browserslistToTargets((0, _browserslist.default)(_packagejson.default.browserslist)),
|
|
58
|
-
drafts: {
|
|
59
|
-
nesting: true
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
return Object.assign(result, {
|
|
63
|
-
css: transformed.code.toString("utf8"),
|
|
64
|
-
map: result.map ? Object.assign(result.map, {
|
|
65
|
-
toString () {
|
|
66
|
-
return transformed.map.toString();
|
|
67
|
-
}
|
|
68
|
-
}) : result.map
|
|
69
|
-
});
|
|
70
|
-
} catch (err) {
|
|
71
|
-
console.error("Unable to use Lightning CSS. Using raw version instead.");
|
|
72
|
-
console.error(err);
|
|
73
|
-
return result;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function loadPostcss() {
|
|
77
|
-
// Try to load a local `postcss` version first
|
|
78
|
-
try {
|
|
79
|
-
return require("postcss");
|
|
80
|
-
} catch {}
|
|
81
|
-
return (0, _index.lazyPostcss)();
|
|
82
|
-
}
|
|
83
|
-
function loadPostcssImport() {
|
|
84
|
-
// Try to load a local `postcss-import` version first
|
|
85
|
-
try {
|
|
86
|
-
return require("postcss-import");
|
|
87
|
-
} catch {}
|
|
88
|
-
return (0, _index.lazyPostcssImport)();
|
|
89
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "build", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return build;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
-
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
-
const _resolveConfigPath = require("../../../util/resolveConfigPath");
|
|
14
|
-
const _plugin = require("./plugin");
|
|
15
|
-
function _interop_require_default(obj) {
|
|
16
|
-
return obj && obj.__esModule ? obj : {
|
|
17
|
-
default: obj
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
async function build(args) {
|
|
21
|
-
let input = args["--input"];
|
|
22
|
-
let shouldWatch = args["--watch"];
|
|
23
|
-
// TODO: Deprecate this in future versions
|
|
24
|
-
if (!input && args["_"][1]) {
|
|
25
|
-
console.error("[deprecation] Running tailwindcss without -i, please provide an input file.");
|
|
26
|
-
input = args["--input"] = args["_"][1];
|
|
27
|
-
}
|
|
28
|
-
if (input && input !== "-" && !_fs.default.existsSync(input = _path.default.resolve(input))) {
|
|
29
|
-
console.error(`Specified input file ${args["--input"]} does not exist.`);
|
|
30
|
-
process.exit(9);
|
|
31
|
-
}
|
|
32
|
-
if (args["--config"] && !_fs.default.existsSync(args["--config"] = _path.default.resolve(args["--config"]))) {
|
|
33
|
-
console.error(`Specified config file ${args["--config"]} does not exist.`);
|
|
34
|
-
process.exit(9);
|
|
35
|
-
}
|
|
36
|
-
// TODO: Reference the @config path here if exists
|
|
37
|
-
let configPath = args["--config"] ? args["--config"] : (0, _resolveConfigPath.resolveDefaultConfigPath)();
|
|
38
|
-
let processor = await (0, _plugin.createProcessor)(args, configPath);
|
|
39
|
-
if (shouldWatch) {
|
|
40
|
-
// Abort the watcher if stdin is closed to avoid zombie processes
|
|
41
|
-
// You can disable this behavior with --watch=always
|
|
42
|
-
if (args["--watch"] !== "always") {
|
|
43
|
-
process.stdin.on("end", ()=>process.exit(0));
|
|
44
|
-
}
|
|
45
|
-
process.stdin.resume();
|
|
46
|
-
await processor.watch();
|
|
47
|
-
} else {
|
|
48
|
-
await processor.build().catch((e)=>{
|
|
49
|
-
console.error(e);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|