tailwindcss 0.0.0-insiders.ea139f2 → 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/LICENSE +1 -2
- package/README.md +15 -7
- package/colors.d.ts +3 -0
- package/colors.js +2 -1
- package/defaultConfig.d.ts +3 -0
- package/defaultConfig.js +2 -1
- package/defaultTheme.d.ts +4 -0
- package/defaultTheme.js +2 -1
- package/lib/cli/build/deps.js +62 -0
- package/lib/cli/build/index.js +54 -0
- package/lib/cli/build/plugin.js +378 -0
- package/lib/cli/build/utils.js +88 -0
- package/lib/cli/build/watching.js +182 -0
- package/lib/cli/help/index.js +73 -0
- package/lib/cli/index.js +230 -0
- package/lib/cli/init/index.js +63 -0
- package/lib/cli-peer-dependencies.js +28 -7
- package/lib/cli.js +4 -703
- package/lib/corePluginList.js +12 -3
- package/lib/corePlugins.js +2373 -1863
- package/lib/css/preflight.css +10 -8
- package/lib/featureFlags.js +49 -26
- package/lib/index.js +1 -31
- package/lib/lib/cacheInvalidation.js +92 -0
- package/lib/lib/collapseAdjacentRules.js +30 -10
- package/lib/lib/collapseDuplicateDeclarations.js +60 -4
- package/lib/lib/content.js +181 -0
- package/lib/lib/defaultExtractor.js +243 -0
- package/lib/lib/detectNesting.js +21 -10
- package/lib/lib/evaluateTailwindFunctions.js +115 -50
- package/lib/lib/expandApplyAtRules.js +467 -161
- package/lib/lib/expandTailwindAtRules.js +160 -133
- package/lib/lib/findAtConfigPath.js +46 -0
- package/lib/lib/generateRules.js +553 -200
- package/lib/lib/getModuleDependencies.js +88 -37
- package/lib/lib/load-config.js +42 -0
- package/lib/lib/normalizeTailwindDirectives.js +46 -33
- package/lib/lib/offsets.js +306 -0
- package/lib/lib/partitionApplyAtRules.js +58 -0
- package/lib/lib/regex.js +74 -0
- package/lib/lib/remap-bitfield.js +89 -0
- package/lib/lib/resolveDefaultsAtRules.js +98 -58
- package/lib/lib/setupContextUtils.js +773 -321
- package/lib/lib/setupTrackingContext.js +70 -75
- package/lib/lib/sharedState.js +78 -10
- package/lib/lib/substituteScreenAtRules.js +14 -10
- 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/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +21 -0
- package/lib/postcss-plugins/nesting/plugin.js +89 -0
- package/lib/processTailwindFeatures.js +39 -26
- package/lib/public/colors.js +272 -246
- package/lib/public/create-plugin.js +9 -5
- package/lib/public/default-config.js +10 -6
- package/lib/public/default-theme.js +10 -6
- package/lib/public/load-config.js +12 -0
- package/lib/public/resolve-config.js +11 -6
- package/lib/util/applyImportantSelector.js +36 -0
- package/lib/util/bigSign.js +6 -1
- package/lib/util/buildMediaQuery.js +13 -6
- package/lib/util/cloneDeep.js +9 -6
- package/lib/util/cloneNodes.js +23 -3
- package/lib/util/color.js +70 -38
- package/lib/util/colorNames.js +752 -0
- package/lib/util/configurePlugins.js +7 -2
- package/lib/util/createPlugin.js +8 -6
- package/lib/util/createUtilityPlugin.js +16 -16
- package/lib/util/dataTypes.js +173 -108
- package/lib/util/defaults.js +14 -3
- package/lib/util/escapeClassName.js +13 -8
- package/lib/util/escapeCommas.js +7 -2
- package/lib/util/flattenColorPalette.js +11 -12
- package/lib/util/formatVariantSelector.js +228 -151
- package/lib/util/getAllConfigs.js +33 -12
- package/lib/util/hashConfig.js +9 -4
- package/lib/util/isKeyframeRule.js +7 -2
- package/lib/util/isPlainObject.js +7 -2
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +25 -15
- package/lib/util/log.js +27 -13
- package/lib/util/nameClass.js +27 -10
- package/lib/util/negateValue.js +25 -8
- package/lib/util/normalizeConfig.js +139 -65
- package/lib/util/normalizeScreens.js +131 -11
- package/lib/util/parseAnimationValue.js +44 -40
- package/lib/util/parseBoxShadowValue.js +34 -23
- package/lib/util/parseDependency.js +39 -55
- package/lib/util/parseGlob.js +36 -0
- package/lib/util/parseObjectStyles.js +15 -10
- package/lib/util/pluginUtils.js +159 -69
- package/lib/util/prefixSelector.js +30 -12
- package/lib/util/pseudoElements.js +229 -0
- package/lib/util/removeAlphaVariables.js +31 -0
- package/lib/util/resolveConfig.js +97 -75
- package/lib/util/resolveConfigPath.js +30 -12
- package/lib/util/responsive.js +11 -6
- package/lib/util/splitAtTopLevelOnly.js +51 -0
- package/lib/util/tap.js +6 -1
- package/lib/util/toColorValue.js +7 -3
- package/lib/util/toPath.js +26 -3
- package/lib/util/transformThemeValue.js +40 -30
- package/lib/util/validateConfig.js +37 -0
- package/lib/util/validateFormalSyntax.js +26 -0
- package/lib/util/withAlphaVariable.js +27 -15
- package/loadConfig.d.ts +4 -0
- package/loadConfig.js +2 -0
- package/nesting/index.js +2 -12
- package/package.json +66 -57
- package/peers/index.js +75964 -55560
- package/plugin.d.ts +11 -0
- package/plugin.js +2 -1
- package/resolveConfig.d.ts +12 -0
- package/resolveConfig.js +2 -1
- package/scripts/generate-types.js +105 -0
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/scripts/swap-engines.js +40 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +49 -0
- package/src/cli/build/plugin.js +444 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +229 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +216 -0
- package/src/cli/init/index.js +79 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +4 -765
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +786 -306
- package/src/css/preflight.css +10 -8
- package/src/featureFlags.js +21 -5
- package/src/index.js +1 -34
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/collapseDuplicateDeclarations.js +66 -1
- package/src/lib/content.js +208 -0
- package/src/lib/defaultExtractor.js +217 -0
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/evaluateTailwindFunctions.js +79 -8
- package/src/lib/expandApplyAtRules.js +515 -153
- package/src/lib/expandTailwindAtRules.js +115 -86
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +545 -147
- package/src/lib/getModuleDependencies.js +70 -30
- package/src/lib/load-config.ts +31 -0
- package/src/lib/normalizeTailwindDirectives.js +7 -1
- package/src/lib/offsets.js +373 -0
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/resolveDefaultsAtRules.js +59 -17
- package/src/lib/setupContextUtils.js +701 -175
- package/src/lib/setupTrackingContext.js +51 -62
- package/src/lib/sharedState.js +58 -7
- 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/postcss-plugins/nesting/README.md +42 -0
- package/src/postcss-plugins/nesting/index.js +13 -0
- package/src/postcss-plugins/nesting/plugin.js +80 -0
- package/src/processTailwindFeatures.js +12 -2
- 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/buildMediaQuery.js +5 -3
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +44 -12
- package/src/util/colorNames.js +150 -0
- package/src/util/dataTypes.js +51 -16
- package/src/util/defaults.js +6 -0
- package/src/util/formatVariantSelector.js +264 -144
- package/src/util/getAllConfigs.js +21 -2
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/log.js +11 -7
- package/src/util/nameClass.js +4 -0
- package/src/util/negateValue.js +11 -3
- package/src/util/normalizeConfig.js +57 -5
- package/src/util/normalizeScreens.js +105 -7
- package/src/util/parseBoxShadowValue.js +4 -3
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +123 -24
- package/src/util/prefixSelector.js +30 -10
- package/src/util/pseudoElements.js +170 -0
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +74 -26
- package/src/util/resolveConfigPath.js +12 -1
- package/src/util/splitAtTopLevelOnly.js +52 -0
- package/src/util/toPath.js +23 -1
- package/src/util/transformThemeValue.js +13 -3
- package/src/util/validateConfig.js +26 -0
- package/src/util/validateFormalSyntax.js +34 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/.gitignore +1 -0
- package/stubs/.prettierrc.json +6 -0
- package/stubs/{defaultConfig.stub.js → config.full.js} +206 -166
- 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 +368 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +298 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/generated/default-theme.d.ts +371 -0
- package/types/index.d.ts +7 -0
- package/CHANGELOG.md +0 -1843
- package/lib/constants.js +0 -37
- package/lib/lib/setupWatchingContext.js +0 -288
- package/nesting/plugin.js +0 -41
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/constants.js +0 -17
- package/src/lib/setupWatchingContext.js +0 -311
- /package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -0
- /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
|
@@ -1,26 +1,35 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
"use strict";
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
4
|
value: true
|
|
4
5
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
Object.defineProperty(exports, // DISABLE_TOUCH = TRUE
|
|
7
|
+
// Retrieve an existing context from cache if possible (since contexts are unique per
|
|
8
|
+
// source path), or set up a new one (including setting up watchers and registering
|
|
9
|
+
// plugins) then return it
|
|
10
|
+
"default", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return setupTrackingContext;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
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"));
|
|
21
|
+
const _setupContextUtils = require("./setupContextUtils");
|
|
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) {
|
|
19
28
|
return obj && obj.__esModule ? obj : {
|
|
20
29
|
default: obj
|
|
21
30
|
};
|
|
22
31
|
}
|
|
23
|
-
let configPathCache = new
|
|
32
|
+
let configPathCache = new _quicklru.default({
|
|
24
33
|
maxSize: 100
|
|
25
34
|
});
|
|
26
35
|
let candidateFilesCache = new WeakMap();
|
|
@@ -28,18 +37,15 @@ function getCandidateFiles(context, tailwindConfig) {
|
|
|
28
37
|
if (candidateFilesCache.has(context)) {
|
|
29
38
|
return candidateFilesCache.get(context);
|
|
30
39
|
}
|
|
31
|
-
let candidateFiles =
|
|
32
|
-
).map((contentPath)=>(0, _normalizePath).default(contentPath)
|
|
33
|
-
);
|
|
40
|
+
let candidateFiles = (0, _content.parseCandidateFiles)(context, tailwindConfig);
|
|
34
41
|
return candidateFilesCache.set(context, candidateFiles).get(context);
|
|
35
42
|
}
|
|
36
43
|
// Get the config object based on a path
|
|
37
44
|
function getTailwindConfig(configOrPath) {
|
|
38
|
-
let userConfigPath = (0, _resolveConfigPath
|
|
45
|
+
let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
|
|
39
46
|
if (userConfigPath !== null) {
|
|
40
47
|
let [prevConfig, prevConfigHash, prevDeps, prevModified] = configPathCache.get(userConfigPath) || [];
|
|
41
|
-
let newDeps = (0, _getModuleDependencies
|
|
42
|
-
);
|
|
48
|
+
let newDeps = (0, _getModuleDependencies.default)(userConfigPath);
|
|
43
49
|
let modified = false;
|
|
44
50
|
let newModified = new Map();
|
|
45
51
|
for (let file of newDeps){
|
|
@@ -59,11 +65,11 @@ function getTailwindConfig(configOrPath) {
|
|
|
59
65
|
];
|
|
60
66
|
}
|
|
61
67
|
// It has changed (based on timestamps), or first run
|
|
62
|
-
for (let
|
|
63
|
-
delete require.cache[
|
|
68
|
+
for (let file of newDeps){
|
|
69
|
+
delete require.cache[file];
|
|
64
70
|
}
|
|
65
|
-
let newConfig = (0,
|
|
66
|
-
let newHash = (0, _hashConfig
|
|
71
|
+
let newConfig = (0, _validateConfig.validateConfig)((0, _resolveconfig.default)((0, _loadconfig.loadConfig)(userConfigPath)));
|
|
72
|
+
let newHash = (0, _hashConfig.default)(newConfig);
|
|
67
73
|
configPathCache.set(userConfigPath, [
|
|
68
74
|
newConfig,
|
|
69
75
|
newHash,
|
|
@@ -78,92 +84,81 @@ function getTailwindConfig(configOrPath) {
|
|
|
78
84
|
];
|
|
79
85
|
}
|
|
80
86
|
// It's a plain object, not a path
|
|
81
|
-
let newConfig = (0,
|
|
87
|
+
let newConfig = (0, _resolveconfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
|
|
88
|
+
newConfig = (0, _validateConfig.validateConfig)(newConfig);
|
|
82
89
|
return [
|
|
83
90
|
newConfig,
|
|
84
91
|
null,
|
|
85
|
-
(0, _hashConfig
|
|
92
|
+
(0, _hashConfig.default)(newConfig),
|
|
86
93
|
[]
|
|
87
94
|
];
|
|
88
95
|
}
|
|
89
|
-
function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
90
|
-
let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === 'string'
|
|
91
|
-
).map(({ raw , extension ='html' })=>({
|
|
92
|
-
content: raw,
|
|
93
|
-
extension
|
|
94
|
-
})
|
|
95
|
-
);
|
|
96
|
-
for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)){
|
|
97
|
-
let content = _fs.default.readFileSync(changedFile, 'utf8');
|
|
98
|
-
let extension = _path.default.extname(changedFile).slice(1);
|
|
99
|
-
changedContent.push({
|
|
100
|
-
content,
|
|
101
|
-
extension
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
return changedContent;
|
|
105
|
-
}
|
|
106
|
-
function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
|
107
|
-
let changedFiles = new Set();
|
|
108
|
-
_sharedState.env.DEBUG && console.time('Finding changed files');
|
|
109
|
-
let files = _fastGlob.default.sync(candidateFiles);
|
|
110
|
-
for (let file of files){
|
|
111
|
-
let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
|
|
112
|
-
let modified = _fs.default.statSync(file).mtimeMs;
|
|
113
|
-
if (modified > prevModified) {
|
|
114
|
-
changedFiles.add(file);
|
|
115
|
-
fileModifiedMap.set(file, modified);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
_sharedState.env.DEBUG && console.timeEnd('Finding changed files');
|
|
119
|
-
return changedFiles;
|
|
120
|
-
}
|
|
121
96
|
function setupTrackingContext(configOrPath) {
|
|
122
97
|
return ({ tailwindDirectives , registerDependency })=>{
|
|
123
98
|
return (root, result)=>{
|
|
124
99
|
let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
|
|
125
100
|
let contextDependencies = new Set(configDependencies);
|
|
126
|
-
// If there are no @tailwind rules, we don't consider this CSS
|
|
127
|
-
// to be dependencies of the context. Can reuse
|
|
128
|
-
// We may want to think about `@layer`
|
|
129
|
-
//
|
|
130
|
-
// in
|
|
101
|
+
// If there are no @tailwind or @apply rules, we don't consider this CSS
|
|
102
|
+
// file or its dependencies to be dependencies of the context. Can reuse
|
|
103
|
+
// the context even if they change. We may want to think about `@layer`
|
|
104
|
+
// being part of this trigger too, but it's tough because it's impossible
|
|
105
|
+
// for a layer in one file to end up in the actual @tailwind rule in
|
|
106
|
+
// another file since independent sources are effectively isolated.
|
|
131
107
|
if (tailwindDirectives.size > 0) {
|
|
132
108
|
// Add current css file as a context dependencies.
|
|
133
109
|
contextDependencies.add(result.opts.from);
|
|
134
110
|
// Add all css @import dependencies as context dependencies.
|
|
135
111
|
for (let message of result.messages){
|
|
136
|
-
if (message.type ===
|
|
112
|
+
if (message.type === "dependency") {
|
|
137
113
|
contextDependencies.add(message.file);
|
|
138
114
|
}
|
|
139
115
|
}
|
|
140
116
|
}
|
|
141
|
-
let [context] = (0, _setupContextUtils
|
|
117
|
+
let [context, , mTimesToCommit] = (0, _setupContextUtils.getContext)(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
|
|
118
|
+
let fileModifiedMap = (0, _setupContextUtils.getFileModifiedMap)(context);
|
|
142
119
|
let candidateFiles = getCandidateFiles(context, tailwindConfig);
|
|
143
|
-
// If there are no @tailwind rules, we don't consider this CSS file or it's
|
|
144
|
-
// to be dependencies of the context. Can reuse the context even if they change.
|
|
120
|
+
// If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
|
|
121
|
+
// dependencies to be dependencies of the context. Can reuse the context even if they change.
|
|
145
122
|
// We may want to think about `@layer` being part of this trigger too, but it's tough
|
|
146
123
|
// because it's impossible for a layer in one file to end up in the actual @tailwind rule
|
|
147
124
|
// in another file since independent sources are effectively isolated.
|
|
148
125
|
if (tailwindDirectives.size > 0) {
|
|
149
|
-
let fileModifiedMap = (0, _setupContextUtils).getFileModifiedMap(context);
|
|
150
126
|
// Add template paths as postcss dependencies.
|
|
151
|
-
for (let
|
|
152
|
-
let dependency
|
|
153
|
-
if (dependency) {
|
|
127
|
+
for (let contentPath of candidateFiles){
|
|
128
|
+
for (let dependency of (0, _parseDependency.default)(contentPath)){
|
|
154
129
|
registerDependency(dependency);
|
|
155
130
|
}
|
|
156
131
|
}
|
|
157
|
-
|
|
158
|
-
|
|
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);
|
|
159
148
|
}
|
|
160
149
|
}
|
|
161
150
|
for (let file of configDependencies){
|
|
162
151
|
registerDependency({
|
|
163
|
-
type:
|
|
152
|
+
type: "dependency",
|
|
164
153
|
file
|
|
165
154
|
});
|
|
166
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
|
+
}
|
|
167
162
|
return context;
|
|
168
163
|
};
|
|
169
164
|
};
|
package/lib/lib/sharedState.js
CHANGED
|
@@ -2,18 +2,86 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
+
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
|
+
}
|
|
36
|
+
});
|
|
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" ? {
|
|
8
44
|
NODE_ENV: process.env.NODE_ENV,
|
|
9
|
-
DEBUG: process.env.DEBUG
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
12
51
|
};
|
|
13
|
-
exports.env = env;
|
|
14
52
|
const contextMap = new Map();
|
|
15
|
-
exports.contextMap = contextMap;
|
|
16
53
|
const configContextMap = new Map();
|
|
17
|
-
exports.configContextMap = configContextMap;
|
|
18
54
|
const contextSourcesMap = new Map();
|
|
19
|
-
|
|
55
|
+
const sourceHashMap = new Map();
|
|
56
|
+
const NOT_ON_DEMAND = new String("*");
|
|
57
|
+
const NONE = Symbol("__NONE__");
|
|
58
|
+
function resolveDebug(debug) {
|
|
59
|
+
if (debug === undefined) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
// Environment variables are strings, so convert to boolean
|
|
63
|
+
if (debug === "true" || debug === "1") {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
if (debug === "false" || debug === "0") {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
// Keep the debug convention into account:
|
|
70
|
+
// DEBUG=* -> This enables all debug modes
|
|
71
|
+
// DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC
|
|
72
|
+
// DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types)
|
|
73
|
+
// DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB
|
|
74
|
+
if (debug === "*") {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
let debuggers = debug.split(",").map((d)=>d.split(":")[0]);
|
|
78
|
+
// Ignoring tailwindcss
|
|
79
|
+
if (debuggers.includes("-tailwindcss")) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
// Including tailwindcss
|
|
83
|
+
if (debuggers.includes("tailwindcss")) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
@@ -2,26 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _normalizeScreens = require("../util/normalizeScreens");
|
|
12
|
+
const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
9
14
|
return obj && obj.__esModule ? obj : {
|
|
10
15
|
default: obj
|
|
11
16
|
};
|
|
12
17
|
}
|
|
13
18
|
function _default({ tailwindConfig: { theme } }) {
|
|
14
19
|
return function(css) {
|
|
15
|
-
css.walkAtRules(
|
|
20
|
+
css.walkAtRules("screen", (atRule)=>{
|
|
16
21
|
let screen = atRule.params;
|
|
17
|
-
let screens = (0, _normalizeScreens
|
|
18
|
-
let screenDefinition = screens.find(({ name })=>name === screen
|
|
19
|
-
);
|
|
22
|
+
let screens = (0, _normalizeScreens.normalizeScreens)(theme.screens);
|
|
23
|
+
let screenDefinition = screens.find(({ name })=>name === screen);
|
|
20
24
|
if (!screenDefinition) {
|
|
21
25
|
throw atRule.error(`No \`${screen}\` screen found.`);
|
|
22
26
|
}
|
|
23
|
-
atRule.name =
|
|
24
|
-
atRule.params = (0, _buildMediaQuery
|
|
27
|
+
atRule.name = "media";
|
|
28
|
+
atRule.params = (0, _buildMediaQuery.default)(screenDefinition);
|
|
25
29
|
});
|
|
26
30
|
};
|
|
27
31
|
}
|
|
@@ -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
|
+
}
|