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.
- package/README.md +1 -1
- package/lib/cli/build/deps.js +17 -9
- package/lib/cli/build/index.js +20 -10
- package/lib/cli/build/plugin.js +86 -70
- package/lib/cli/build/utils.js +18 -8
- package/lib/cli/build/watching.js +16 -12
- package/lib/cli/help/index.js +6 -4
- package/lib/cli/index.js +222 -10
- package/lib/cli/init/index.js +29 -12
- package/lib/cli-peer-dependencies.js +12 -4
- package/lib/cli.js +4 -226
- package/lib/corePluginList.js +7 -1
- package/lib/corePlugins.js +348 -75
- package/lib/css/preflight.css +2 -0
- package/lib/featureFlags.js +27 -15
- package/lib/index.js +1 -47
- package/lib/lib/cacheInvalidation.js +7 -5
- package/lib/lib/collapseAdjacentRules.js +5 -3
- package/lib/lib/collapseDuplicateDeclarations.js +12 -10
- package/lib/lib/content.js +34 -30
- package/lib/lib/defaultExtractor.js +15 -8
- package/lib/lib/detectNesting.js +10 -2
- package/lib/lib/evaluateTailwindFunctions.js +22 -20
- package/lib/lib/expandApplyAtRules.js +43 -35
- package/lib/lib/expandTailwindAtRules.js +46 -19
- package/lib/lib/findAtConfigPath.js +9 -7
- package/lib/lib/generateRules.js +157 -92
- package/lib/lib/getModuleDependencies.js +85 -37
- package/lib/lib/load-config.js +42 -0
- package/lib/lib/normalizeTailwindDirectives.js +5 -3
- package/lib/lib/offsets.js +93 -4
- package/lib/lib/partitionApplyAtRules.js +3 -1
- package/lib/lib/regex.js +21 -7
- package/lib/lib/remap-bitfield.js +89 -0
- package/lib/lib/resolveDefaultsAtRules.js +28 -24
- package/lib/lib/setupContextUtils.js +190 -131
- package/lib/lib/setupTrackingContext.js +49 -26
- package/lib/lib/sharedState.js +37 -10
- package/lib/lib/substituteScreenAtRules.js +5 -3
- package/lib/oxide/cli/build/deps.js +89 -0
- package/lib/oxide/cli/build/index.js +53 -0
- package/lib/oxide/cli/build/plugin.js +375 -0
- package/lib/oxide/cli/build/utils.js +87 -0
- package/lib/oxide/cli/build/watching.js +179 -0
- package/lib/oxide/cli/help/index.js +72 -0
- package/lib/oxide/cli/index.js +214 -0
- package/lib/oxide/cli/init/index.js +52 -0
- package/lib/oxide/cli.js +5 -0
- package/lib/oxide/postcss-plugin.js +2 -0
- package/lib/plugin.js +98 -0
- package/lib/postcss-plugins/nesting/index.js +3 -1
- package/lib/postcss-plugins/nesting/plugin.js +10 -8
- package/lib/processTailwindFeatures.js +14 -12
- package/lib/public/colors.js +49 -25
- package/lib/public/create-plugin.js +5 -3
- package/lib/public/default-config.js +6 -4
- package/lib/public/default-theme.js +6 -4
- package/lib/public/load-config.js +12 -0
- package/lib/public/resolve-config.js +6 -4
- package/lib/util/applyImportantSelector.js +36 -0
- package/lib/util/bigSign.js +3 -1
- package/lib/util/buildMediaQuery.js +3 -1
- package/lib/util/cloneDeep.js +3 -1
- package/lib/util/cloneNodes.js +5 -3
- package/lib/util/color.js +30 -12
- package/lib/util/colorNames.js +752 -0
- package/lib/util/configurePlugins.js +3 -1
- package/lib/util/createPlugin.js +3 -1
- package/lib/util/createUtilityPlugin.js +7 -5
- package/lib/util/dataTypes.js +74 -17
- package/lib/util/defaults.js +9 -7
- package/lib/util/escapeClassName.js +10 -8
- package/lib/util/escapeCommas.js +3 -1
- package/lib/util/flattenColorPalette.js +3 -1
- package/lib/util/formatVariantSelector.js +138 -160
- package/lib/util/getAllConfigs.js +8 -6
- package/lib/util/hashConfig.js +6 -4
- package/lib/util/isKeyframeRule.js +3 -1
- package/lib/util/isPlainObject.js +3 -1
- package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
- package/lib/util/log.js +8 -4
- package/lib/util/nameClass.js +12 -6
- package/lib/util/negateValue.js +4 -2
- package/lib/util/normalizeConfig.js +28 -27
- package/lib/util/normalizeScreens.js +12 -4
- package/lib/util/parseAnimationValue.js +3 -1
- package/lib/util/parseBoxShadowValue.js +6 -2
- package/lib/util/parseDependency.js +3 -1
- package/lib/util/parseGlob.js +6 -4
- package/lib/util/parseObjectStyles.js +9 -7
- package/lib/util/pluginUtils.js +54 -54
- package/lib/util/prefixSelector.js +27 -11
- package/lib/util/pseudoElements.js +229 -0
- package/lib/util/removeAlphaVariables.js +3 -1
- package/lib/util/resolveConfig.js +17 -15
- package/lib/util/resolveConfigPath.js +26 -10
- package/lib/util/responsive.js +6 -4
- package/lib/util/splitAtTopLevelOnly.js +10 -2
- package/lib/util/tap.js +3 -1
- package/lib/util/toColorValue.js +3 -1
- package/lib/util/toPath.js +3 -1
- package/lib/util/transformThemeValue.js +6 -4
- package/lib/util/validateConfig.js +16 -3
- package/lib/util/validateFormalSyntax.js +3 -1
- package/lib/util/withAlphaVariable.js +6 -2
- package/loadConfig.d.ts +4 -0
- package/loadConfig.js +2 -0
- package/package.json +45 -37
- package/peers/index.js +63324 -46417
- package/resolveConfig.d.ts +11 -2
- package/scripts/swap-engines.js +40 -0
- package/src/cli/build/index.js +13 -9
- package/src/cli/build/plugin.js +42 -32
- package/src/cli/build/watching.js +4 -2
- package/src/cli/index.js +216 -3
- package/src/cli/init/index.js +37 -8
- package/src/cli.js +4 -220
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +207 -32
- package/src/css/preflight.css +2 -0
- package/src/featureFlags.js +6 -0
- package/src/index.js +1 -47
- package/src/lib/content.js +12 -17
- package/src/lib/defaultExtractor.js +9 -3
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/expandApplyAtRules.js +8 -1
- package/src/lib/expandTailwindAtRules.js +36 -7
- package/src/lib/generateRules.js +124 -42
- package/src/lib/getModuleDependencies.js +70 -30
- package/src/lib/load-config.ts +31 -0
- package/src/lib/offsets.js +104 -1
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/setupContextUtils.js +103 -54
- package/src/lib/setupTrackingContext.js +36 -11
- package/src/lib/sharedState.js +15 -4
- package/src/oxide/cli/build/deps.ts +91 -0
- package/src/oxide/cli/build/index.ts +47 -0
- package/src/oxide/cli/build/plugin.ts +442 -0
- package/src/oxide/cli/build/utils.ts +74 -0
- package/src/oxide/cli/build/watching.ts +225 -0
- package/src/oxide/cli/help/index.ts +69 -0
- package/src/oxide/cli/index.ts +204 -0
- package/src/oxide/cli/init/index.ts +59 -0
- package/src/oxide/cli.ts +1 -0
- package/src/oxide/postcss-plugin.ts +1 -0
- package/src/plugin.js +107 -0
- package/src/public/colors.js +22 -0
- package/src/public/default-config.js +1 -1
- package/src/public/default-theme.js +2 -2
- package/src/public/load-config.js +2 -0
- package/src/util/applyImportantSelector.js +27 -0
- package/src/util/color.js +18 -3
- package/src/util/colorNames.js +150 -0
- package/src/util/dataTypes.js +33 -4
- package/src/util/formatVariantSelector.js +160 -163
- package/src/util/getAllConfigs.js +2 -2
- package/src/util/negateValue.js +1 -1
- package/src/util/normalizeConfig.js +2 -1
- package/src/util/pluginUtils.js +16 -31
- package/src/util/prefixSelector.js +28 -10
- package/src/util/pseudoElements.js +170 -0
- package/src/util/resolveConfigPath.js +12 -1
- package/src/util/splitAtTopLevelOnly.js +8 -1
- package/src/util/validateConfig.js +13 -0
- package/stubs/.gitignore +1 -0
- package/stubs/.prettierrc.json +6 -0
- package/stubs/{defaultConfig.stub.js → config.full.js} +183 -146
- package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -1
- package/stubs/postcss.config.js +6 -0
- package/stubs/tailwind.config.cjs +2 -0
- package/stubs/tailwind.config.js +2 -0
- package/stubs/tailwind.config.ts +3 -0
- package/types/config.d.ts +15 -9
- package/types/generated/colors.d.ts +22 -0
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +108 -79
- package/CHANGELOG.md +0 -2336
- package/lib/cli/shared.js +0 -12
- package/lib/constants.js +0 -44
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli/shared.js +0 -5
- package/src/constants.js +0 -17
- /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
"use strict";
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
4
|
value: true
|
|
@@ -8,24 +9,27 @@ Object.defineProperty(exports, // DISABLE_TOUCH = TRUE
|
|
|
8
9
|
// plugins) then return it
|
|
9
10
|
"default", {
|
|
10
11
|
enumerable: true,
|
|
11
|
-
get: ()
|
|
12
|
+
get: function() {
|
|
13
|
+
return setupTrackingContext;
|
|
14
|
+
}
|
|
12
15
|
});
|
|
13
|
-
const _fs = /*#__PURE__*/
|
|
14
|
-
const
|
|
15
|
-
const _hashConfig = /*#__PURE__*/
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const _resolveConfigPath = /*#__PURE__*/ _interopRequireDefault(require("../util/resolveConfigPath"));
|
|
16
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
17
|
+
const _quicklru = /*#__PURE__*/ _interop_require_default(require("@alloc/quick-lru"));
|
|
18
|
+
const _hashConfig = /*#__PURE__*/ _interop_require_default(require("../util/hashConfig"));
|
|
19
|
+
const _resolveconfig = /*#__PURE__*/ _interop_require_default(require("../public/resolve-config"));
|
|
20
|
+
const _resolveConfigPath = /*#__PURE__*/ _interop_require_default(require("../util/resolveConfigPath"));
|
|
19
21
|
const _setupContextUtils = require("./setupContextUtils");
|
|
20
|
-
const _parseDependency = /*#__PURE__*/
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const _parseDependency = /*#__PURE__*/ _interop_require_default(require("../util/parseDependency"));
|
|
23
|
+
const _validateConfig = require("../util/validateConfig.js");
|
|
24
|
+
const _content = require("./content.js");
|
|
25
|
+
const _loadconfig = require("../lib/load-config");
|
|
26
|
+
const _getModuleDependencies = /*#__PURE__*/ _interop_require_default(require("./getModuleDependencies"));
|
|
27
|
+
function _interop_require_default(obj) {
|
|
24
28
|
return obj && obj.__esModule ? obj : {
|
|
25
29
|
default: obj
|
|
26
30
|
};
|
|
27
31
|
}
|
|
28
|
-
let configPathCache = new
|
|
32
|
+
let configPathCache = new _quicklru.default({
|
|
29
33
|
maxSize: 100
|
|
30
34
|
});
|
|
31
35
|
let candidateFilesCache = new WeakMap();
|
|
@@ -33,7 +37,7 @@ function getCandidateFiles(context, tailwindConfig) {
|
|
|
33
37
|
if (candidateFilesCache.has(context)) {
|
|
34
38
|
return candidateFilesCache.get(context);
|
|
35
39
|
}
|
|
36
|
-
let candidateFiles = (0,
|
|
40
|
+
let candidateFiles = (0, _content.parseCandidateFiles)(context, tailwindConfig);
|
|
37
41
|
return candidateFilesCache.set(context, candidateFiles).get(context);
|
|
38
42
|
}
|
|
39
43
|
// Get the config object based on a path
|
|
@@ -41,7 +45,7 @@ function getTailwindConfig(configOrPath) {
|
|
|
41
45
|
let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
|
|
42
46
|
if (userConfigPath !== null) {
|
|
43
47
|
let [prevConfig, prevConfigHash, prevDeps, prevModified] = configPathCache.get(userConfigPath) || [];
|
|
44
|
-
let newDeps = (0, _getModuleDependencies.default)(userConfigPath)
|
|
48
|
+
let newDeps = (0, _getModuleDependencies.default)(userConfigPath);
|
|
45
49
|
let modified = false;
|
|
46
50
|
let newModified = new Map();
|
|
47
51
|
for (let file of newDeps){
|
|
@@ -61,11 +65,10 @@ function getTailwindConfig(configOrPath) {
|
|
|
61
65
|
];
|
|
62
66
|
}
|
|
63
67
|
// It has changed (based on timestamps), or first run
|
|
64
|
-
for (let
|
|
65
|
-
delete require.cache[
|
|
68
|
+
for (let file of newDeps){
|
|
69
|
+
delete require.cache[file];
|
|
66
70
|
}
|
|
67
|
-
let newConfig = (0,
|
|
68
|
-
newConfig = (0, _validateConfigJs.validateConfig)(newConfig);
|
|
71
|
+
let newConfig = (0, _validateConfig.validateConfig)((0, _resolveconfig.default)((0, _loadconfig.loadConfig)(userConfigPath)));
|
|
69
72
|
let newHash = (0, _hashConfig.default)(newConfig);
|
|
70
73
|
configPathCache.set(userConfigPath, [
|
|
71
74
|
newConfig,
|
|
@@ -81,12 +84,12 @@ function getTailwindConfig(configOrPath) {
|
|
|
81
84
|
];
|
|
82
85
|
}
|
|
83
86
|
// It's a plain object, not a path
|
|
84
|
-
let
|
|
85
|
-
|
|
87
|
+
let newConfig = (0, _resolveconfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
|
|
88
|
+
newConfig = (0, _validateConfig.validateConfig)(newConfig);
|
|
86
89
|
return [
|
|
87
|
-
|
|
90
|
+
newConfig,
|
|
88
91
|
null,
|
|
89
|
-
(0, _hashConfig.default)(
|
|
92
|
+
(0, _hashConfig.default)(newConfig),
|
|
90
93
|
[]
|
|
91
94
|
];
|
|
92
95
|
}
|
|
@@ -111,7 +114,8 @@ function setupTrackingContext(configOrPath) {
|
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
|
-
let [context] = (0, _setupContextUtils.getContext)(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
|
|
117
|
+
let [context, , mTimesToCommit] = (0, _setupContextUtils.getContext)(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
|
|
118
|
+
let fileModifiedMap = (0, _setupContextUtils.getFileModifiedMap)(context);
|
|
115
119
|
let candidateFiles = getCandidateFiles(context, tailwindConfig);
|
|
116
120
|
// If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
|
|
117
121
|
// dependencies to be dependencies of the context. Can reuse the context even if they change.
|
|
@@ -119,15 +123,28 @@ function setupTrackingContext(configOrPath) {
|
|
|
119
123
|
// because it's impossible for a layer in one file to end up in the actual @tailwind rule
|
|
120
124
|
// in another file since independent sources are effectively isolated.
|
|
121
125
|
if (tailwindDirectives.size > 0) {
|
|
122
|
-
let fileModifiedMap = (0, _setupContextUtils.getFileModifiedMap)(context);
|
|
123
126
|
// Add template paths as postcss dependencies.
|
|
124
127
|
for (let contentPath of candidateFiles){
|
|
125
128
|
for (let dependency of (0, _parseDependency.default)(contentPath)){
|
|
126
129
|
registerDependency(dependency);
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
|
-
|
|
130
|
-
|
|
132
|
+
let [changedContent, contentMTimesToCommit] = (0, _content.resolvedChangedContent)(context, candidateFiles, fileModifiedMap);
|
|
133
|
+
for (let content of changedContent){
|
|
134
|
+
context.changedContent.push(content);
|
|
135
|
+
}
|
|
136
|
+
// Add the mtimes of the content files to the commit list
|
|
137
|
+
// We can overwrite the existing values because unconditionally
|
|
138
|
+
// This is because:
|
|
139
|
+
// 1. Most of the files here won't be in the map yet
|
|
140
|
+
// 2. If they are that means it's a context dependency
|
|
141
|
+
// and we're reading this after the context. This means
|
|
142
|
+
// that the mtime we just read is strictly >= the context
|
|
143
|
+
// mtime. Unless the user / os is doing something weird
|
|
144
|
+
// in which the mtime would be going backwards. If that
|
|
145
|
+
// happens there's already going to be problems.
|
|
146
|
+
for (let [path, mtime] of contentMTimesToCommit.entries()){
|
|
147
|
+
mTimesToCommit.set(path, mtime);
|
|
131
148
|
}
|
|
132
149
|
}
|
|
133
150
|
for (let file of configDependencies){
|
|
@@ -136,6 +153,12 @@ function setupTrackingContext(configOrPath) {
|
|
|
136
153
|
file
|
|
137
154
|
});
|
|
138
155
|
}
|
|
156
|
+
// "commit" the new modified time for all context deps
|
|
157
|
+
// We do this here because we want content tracking to
|
|
158
|
+
// read the "old" mtime even when it's a context dependency.
|
|
159
|
+
for (let [path, mtime] of mTimesToCommit.entries()){
|
|
160
|
+
fileModifiedMap.set(path, mtime);
|
|
161
|
+
}
|
|
139
162
|
return context;
|
|
140
163
|
};
|
|
141
164
|
};
|
package/lib/lib/sharedState.js
CHANGED
|
@@ -9,18 +9,45 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
env: ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
env: function() {
|
|
13
|
+
return env;
|
|
14
|
+
},
|
|
15
|
+
contextMap: function() {
|
|
16
|
+
return contextMap;
|
|
17
|
+
},
|
|
18
|
+
configContextMap: function() {
|
|
19
|
+
return configContextMap;
|
|
20
|
+
},
|
|
21
|
+
contextSourcesMap: function() {
|
|
22
|
+
return contextSourcesMap;
|
|
23
|
+
},
|
|
24
|
+
sourceHashMap: function() {
|
|
25
|
+
return sourceHashMap;
|
|
26
|
+
},
|
|
27
|
+
NOT_ON_DEMAND: function() {
|
|
28
|
+
return NOT_ON_DEMAND;
|
|
29
|
+
},
|
|
30
|
+
NONE: function() {
|
|
31
|
+
return NONE;
|
|
32
|
+
},
|
|
33
|
+
resolveDebug: function() {
|
|
34
|
+
return resolveDebug;
|
|
35
|
+
}
|
|
20
36
|
});
|
|
21
|
-
const
|
|
37
|
+
const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../package.json"));
|
|
38
|
+
function _interop_require_default(obj) {
|
|
39
|
+
return obj && obj.__esModule ? obj : {
|
|
40
|
+
default: obj
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const env = typeof process !== "undefined" ? {
|
|
22
44
|
NODE_ENV: process.env.NODE_ENV,
|
|
23
|
-
DEBUG: resolveDebug(process.env.DEBUG)
|
|
45
|
+
DEBUG: resolveDebug(process.env.DEBUG),
|
|
46
|
+
ENGINE: _packagejson.default.tailwindcss.engine
|
|
47
|
+
} : {
|
|
48
|
+
NODE_ENV: "production",
|
|
49
|
+
DEBUG: false,
|
|
50
|
+
ENGINE: _packagejson.default.tailwindcss.engine
|
|
24
51
|
};
|
|
25
52
|
const contextMap = new Map();
|
|
26
53
|
const configContextMap = new Map();
|
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _normalizeScreens = require("../util/normalizeScreens");
|
|
10
|
-
const _buildMediaQuery = /*#__PURE__*/
|
|
11
|
-
function
|
|
12
|
+
const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
12
14
|
return obj && obj.__esModule ? obj : {
|
|
13
15
|
default: obj
|
|
14
16
|
};
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
}
|