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
package/lib/constants.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.defaultPostCssConfigStubFile = exports.simpleConfigStubFile = exports.defaultConfigStubFile = exports.supportedPostCssConfigFile = exports.supportedConfigFiles = exports.cjsPostCssConfigFile = exports.cjsConfigFile = exports.defaultPostCssConfigFile = exports.defaultConfigFile = exports.cli = void 0;
|
|
6
|
-
var _path = _interopRequireDefault(require("path"));
|
|
7
|
-
function _interopRequireDefault(obj) {
|
|
8
|
-
return obj && obj.__esModule ? obj : {
|
|
9
|
-
default: obj
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
const cli = 'tailwind';
|
|
13
|
-
exports.cli = cli;
|
|
14
|
-
const defaultConfigFile = './tailwind.config.js';
|
|
15
|
-
exports.defaultConfigFile = defaultConfigFile;
|
|
16
|
-
const defaultPostCssConfigFile = './postcss.config.js';
|
|
17
|
-
exports.defaultPostCssConfigFile = defaultPostCssConfigFile;
|
|
18
|
-
const cjsConfigFile = './tailwind.config.cjs';
|
|
19
|
-
exports.cjsConfigFile = cjsConfigFile;
|
|
20
|
-
const cjsPostCssConfigFile = './postcss.config.cjs';
|
|
21
|
-
exports.cjsPostCssConfigFile = cjsPostCssConfigFile;
|
|
22
|
-
const supportedConfigFiles = [
|
|
23
|
-
cjsConfigFile,
|
|
24
|
-
defaultConfigFile
|
|
25
|
-
];
|
|
26
|
-
exports.supportedConfigFiles = supportedConfigFiles;
|
|
27
|
-
const supportedPostCssConfigFile = [
|
|
28
|
-
cjsPostCssConfigFile,
|
|
29
|
-
defaultPostCssConfigFile
|
|
30
|
-
];
|
|
31
|
-
exports.supportedPostCssConfigFile = supportedPostCssConfigFile;
|
|
32
|
-
const defaultConfigStubFile = _path.default.resolve(__dirname, '../stubs/defaultConfig.stub.js');
|
|
33
|
-
exports.defaultConfigStubFile = defaultConfigStubFile;
|
|
34
|
-
const simpleConfigStubFile = _path.default.resolve(__dirname, '../stubs/simpleConfig.stub.js');
|
|
35
|
-
exports.simpleConfigStubFile = simpleConfigStubFile;
|
|
36
|
-
const defaultPostCssConfigStubFile = _path.default.resolve(__dirname, '../stubs/defaultPostCssConfig.stub.js');
|
|
37
|
-
exports.defaultPostCssConfigStubFile = defaultPostCssConfigStubFile;
|
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = setupWatchingContext;
|
|
6
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
var _tmp = _interopRequireDefault(require("tmp"));
|
|
9
|
-
var _chokidar = _interopRequireDefault(require("chokidar"));
|
|
10
|
-
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
11
|
-
var _quickLru = _interopRequireDefault(require("quick-lru"));
|
|
12
|
-
var _normalizePath = _interopRequireDefault(require("normalize-path"));
|
|
13
|
-
var _hashConfig = _interopRequireDefault(require("../util/hashConfig"));
|
|
14
|
-
var _log = _interopRequireDefault(require("../util/log"));
|
|
15
|
-
var _getModuleDependencies = _interopRequireDefault(require("../lib/getModuleDependencies"));
|
|
16
|
-
var _resolveConfig = _interopRequireDefault(require("../public/resolve-config"));
|
|
17
|
-
var _resolveConfigPath = _interopRequireDefault(require("../util/resolveConfigPath"));
|
|
18
|
-
var _setupContextUtils = require("./setupContextUtils");
|
|
19
|
-
function _interopRequireDefault(obj) {
|
|
20
|
-
return obj && obj.__esModule ? obj : {
|
|
21
|
-
default: obj
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
// This is used to trigger rebuilds. Just updating the timestamp
|
|
25
|
-
// is significantly faster than actually writing to the file (10x).
|
|
26
|
-
function touch(filename) {
|
|
27
|
-
let time = new Date();
|
|
28
|
-
try {
|
|
29
|
-
_fs.default.utimesSync(filename, time, time);
|
|
30
|
-
} catch (err) {
|
|
31
|
-
_fs.default.closeSync(_fs.default.openSync(filename, 'w'));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
let watchers = new WeakMap();
|
|
35
|
-
function getWatcher(context) {
|
|
36
|
-
if (watchers.has(context)) {
|
|
37
|
-
return watchers.get(context);
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
function setWatcher(context, watcher) {
|
|
42
|
-
return watchers.set(context, watcher);
|
|
43
|
-
}
|
|
44
|
-
let touchFiles = new WeakMap();
|
|
45
|
-
function getTouchFile(context) {
|
|
46
|
-
if (touchFiles.has(context)) {
|
|
47
|
-
return touchFiles.get(context);
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
function setTouchFile(context, touchFile) {
|
|
52
|
-
return touchFiles.set(context, touchFile);
|
|
53
|
-
}
|
|
54
|
-
let configPaths = new WeakMap();
|
|
55
|
-
function getConfigPath(context, configOrPath) {
|
|
56
|
-
if (!configPaths.has(context)) {
|
|
57
|
-
configPaths.set(context, (0, _resolveConfigPath).default(configOrPath));
|
|
58
|
-
}
|
|
59
|
-
return configPaths.get(context);
|
|
60
|
-
}
|
|
61
|
-
function rebootWatcher(context, configPath, configDependencies, candidateFiles) {
|
|
62
|
-
let touchFile = getTouchFile(context);
|
|
63
|
-
if (touchFile === null) {
|
|
64
|
-
touchFile = _tmp.default.fileSync().name;
|
|
65
|
-
setTouchFile(context, touchFile);
|
|
66
|
-
touch(touchFile);
|
|
67
|
-
}
|
|
68
|
-
let watcher = getWatcher(context);
|
|
69
|
-
Promise.resolve(watcher ? watcher.close() : null).then(()=>{
|
|
70
|
-
_log.default.info([
|
|
71
|
-
'Tailwind CSS is watching for changes...',
|
|
72
|
-
'https://tailwindcss.com/docs/just-in-time-mode#watch-mode-and-one-off-builds',
|
|
73
|
-
]);
|
|
74
|
-
watcher = _chokidar.default.watch([
|
|
75
|
-
...candidateFiles,
|
|
76
|
-
...configDependencies
|
|
77
|
-
], {
|
|
78
|
-
ignoreInitial: true,
|
|
79
|
-
awaitWriteFinish: process.platform === 'win32' ? {
|
|
80
|
-
stabilityThreshold: 50,
|
|
81
|
-
pollInterval: 10
|
|
82
|
-
} : false
|
|
83
|
-
});
|
|
84
|
-
setWatcher(context, watcher);
|
|
85
|
-
watcher.on('add', (file)=>{
|
|
86
|
-
let changedFile = _path.default.resolve('.', file);
|
|
87
|
-
let content = _fs.default.readFileSync(changedFile, 'utf8');
|
|
88
|
-
let extension = _path.default.extname(changedFile).slice(1);
|
|
89
|
-
context.changedContent.push({
|
|
90
|
-
content,
|
|
91
|
-
extension
|
|
92
|
-
});
|
|
93
|
-
touch(touchFile);
|
|
94
|
-
});
|
|
95
|
-
watcher.on('change', (file)=>{
|
|
96
|
-
// If it was a config dependency, touch the config file to trigger a new context.
|
|
97
|
-
// This is not really that clean of a solution but it's the fastest, because we
|
|
98
|
-
// can do a very quick check on each build to see if the config has changed instead
|
|
99
|
-
// of having to get all of the module dependencies and check every timestamp each
|
|
100
|
-
// time.
|
|
101
|
-
if (configDependencies.has(file)) {
|
|
102
|
-
for (let dependency of configDependencies){
|
|
103
|
-
delete require.cache[require.resolve(dependency)];
|
|
104
|
-
}
|
|
105
|
-
touch(configPath);
|
|
106
|
-
} else {
|
|
107
|
-
let changedFile = _path.default.resolve('.', file);
|
|
108
|
-
let content = _fs.default.readFileSync(changedFile, 'utf8');
|
|
109
|
-
let extension = _path.default.extname(changedFile).slice(1);
|
|
110
|
-
context.changedContent.push({
|
|
111
|
-
content,
|
|
112
|
-
extension
|
|
113
|
-
});
|
|
114
|
-
touch(touchFile);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
watcher.on('unlink', (file)=>{
|
|
118
|
-
// Touch the config file if any of the dependencies are deleted.
|
|
119
|
-
if (configDependencies.has(file)) {
|
|
120
|
-
for (let dependency of configDependencies){
|
|
121
|
-
delete require.cache[require.resolve(dependency)];
|
|
122
|
-
}
|
|
123
|
-
touch(configPath);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
let configPathCache = new _quickLru.default({
|
|
129
|
-
maxSize: 100
|
|
130
|
-
});
|
|
131
|
-
let configDependenciesCache = new WeakMap();
|
|
132
|
-
function getConfigDependencies(context) {
|
|
133
|
-
if (!configDependenciesCache.has(context)) {
|
|
134
|
-
configDependenciesCache.set(context, new Set());
|
|
135
|
-
}
|
|
136
|
-
return configDependenciesCache.get(context);
|
|
137
|
-
}
|
|
138
|
-
let candidateFilesCache = new WeakMap();
|
|
139
|
-
function getCandidateFiles(context, tailwindConfig) {
|
|
140
|
-
if (candidateFilesCache.has(context)) {
|
|
141
|
-
return candidateFilesCache.get(context);
|
|
142
|
-
}
|
|
143
|
-
let candidateFiles = tailwindConfig.content.files.filter((item)=>typeof item === 'string'
|
|
144
|
-
).map((contentPath)=>(0, _normalizePath).default(contentPath)
|
|
145
|
-
);
|
|
146
|
-
return candidateFilesCache.set(context, candidateFiles).get(context);
|
|
147
|
-
}
|
|
148
|
-
// Get the config object based on a path
|
|
149
|
-
function getTailwindConfig(configOrPath) {
|
|
150
|
-
let userConfigPath = (0, _resolveConfigPath).default(configOrPath);
|
|
151
|
-
if (userConfigPath !== null) {
|
|
152
|
-
let [prevConfig, prevModified = -Infinity, prevConfigHash] = configPathCache.get(userConfigPath) || [];
|
|
153
|
-
let modified = _fs.default.statSync(userConfigPath).mtimeMs;
|
|
154
|
-
// It hasn't changed (based on timestamp)
|
|
155
|
-
if (modified <= prevModified) {
|
|
156
|
-
return [
|
|
157
|
-
prevConfig,
|
|
158
|
-
userConfigPath,
|
|
159
|
-
prevConfigHash,
|
|
160
|
-
[
|
|
161
|
-
userConfigPath
|
|
162
|
-
]
|
|
163
|
-
];
|
|
164
|
-
}
|
|
165
|
-
// It has changed (based on timestamp), or first run
|
|
166
|
-
delete require.cache[userConfigPath];
|
|
167
|
-
let newConfig = (0, _resolveConfig).default(require(userConfigPath));
|
|
168
|
-
let newHash = (0, _hashConfig).default(newConfig);
|
|
169
|
-
configPathCache.set(userConfigPath, [
|
|
170
|
-
newConfig,
|
|
171
|
-
modified,
|
|
172
|
-
newHash
|
|
173
|
-
]);
|
|
174
|
-
return [
|
|
175
|
-
newConfig,
|
|
176
|
-
userConfigPath,
|
|
177
|
-
newHash,
|
|
178
|
-
[
|
|
179
|
-
userConfigPath
|
|
180
|
-
]
|
|
181
|
-
];
|
|
182
|
-
}
|
|
183
|
-
// It's a plain object, not a path
|
|
184
|
-
let newConfig = (0, _resolveConfig).default(configOrPath.config === undefined ? configOrPath : configOrPath.config);
|
|
185
|
-
return [
|
|
186
|
-
newConfig,
|
|
187
|
-
null,
|
|
188
|
-
(0, _hashConfig).default(newConfig),
|
|
189
|
-
[]
|
|
190
|
-
];
|
|
191
|
-
}
|
|
192
|
-
function resolvedChangedContent(context, candidateFiles) {
|
|
193
|
-
let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === 'string'
|
|
194
|
-
).map(({ raw , extension ='html' })=>({
|
|
195
|
-
content: raw,
|
|
196
|
-
extension
|
|
197
|
-
})
|
|
198
|
-
);
|
|
199
|
-
for (let changedFile of resolveChangedFiles(context, candidateFiles)){
|
|
200
|
-
let content = _fs.default.readFileSync(changedFile, 'utf8');
|
|
201
|
-
let extension = _path.default.extname(changedFile).slice(1);
|
|
202
|
-
changedContent.push({
|
|
203
|
-
content,
|
|
204
|
-
extension
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
return changedContent;
|
|
208
|
-
}
|
|
209
|
-
let scannedContentCache = new WeakMap();
|
|
210
|
-
function resolveChangedFiles(context, candidateFiles) {
|
|
211
|
-
let changedFiles = new Set();
|
|
212
|
-
// If we're not set up and watching files ourselves, we need to do
|
|
213
|
-
// the work of grabbing all of the template files for candidate
|
|
214
|
-
// detection.
|
|
215
|
-
if (!scannedContentCache.has(context)) {
|
|
216
|
-
let files = _fastGlob.default.sync(candidateFiles);
|
|
217
|
-
for (let file of files){
|
|
218
|
-
changedFiles.add(file);
|
|
219
|
-
}
|
|
220
|
-
scannedContentCache.set(context, true);
|
|
221
|
-
}
|
|
222
|
-
return changedFiles;
|
|
223
|
-
}
|
|
224
|
-
function setupWatchingContext(configOrPath) {
|
|
225
|
-
return ({ tailwindDirectives , registerDependency })=>{
|
|
226
|
-
return (root, result)=>{
|
|
227
|
-
let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
|
|
228
|
-
let contextDependencies = new Set(configDependencies);
|
|
229
|
-
// If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
|
|
230
|
-
// to be dependencies of the context. Can reuse the context even if they change.
|
|
231
|
-
// We may want to think about `@layer` being part of this trigger too, but it's tough
|
|
232
|
-
// because it's impossible for a layer in one file to end up in the actual @tailwind rule
|
|
233
|
-
// in another file since independent sources are effectively isolated.
|
|
234
|
-
if (tailwindDirectives.size > 0) {
|
|
235
|
-
// Add current css file as a context dependencies.
|
|
236
|
-
contextDependencies.add(result.opts.from);
|
|
237
|
-
// Add all css @import dependencies as context dependencies.
|
|
238
|
-
for (let message of result.messages){
|
|
239
|
-
if (message.type === 'dependency') {
|
|
240
|
-
contextDependencies.add(message.file);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
let [context, isNewContext] = (0, _setupContextUtils).getContext(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
|
|
245
|
-
let candidateFiles = getCandidateFiles(context, tailwindConfig);
|
|
246
|
-
let contextConfigDependencies = getConfigDependencies(context);
|
|
247
|
-
for (let file of configDependencies){
|
|
248
|
-
registerDependency({
|
|
249
|
-
type: 'dependency',
|
|
250
|
-
file
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
context.disposables.push((oldContext)=>{
|
|
254
|
-
let watcher = getWatcher(oldContext);
|
|
255
|
-
if (watcher !== null) {
|
|
256
|
-
watcher.close();
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
let configPath = getConfigPath(context, configOrPath);
|
|
260
|
-
if (configPath !== null) {
|
|
261
|
-
for (let dependency of (0, _getModuleDependencies).default(configPath)){
|
|
262
|
-
if (dependency.file === configPath) {
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
contextConfigDependencies.add(dependency.file);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
if (isNewContext) {
|
|
269
|
-
rebootWatcher(context, configPath, contextConfigDependencies, candidateFiles);
|
|
270
|
-
}
|
|
271
|
-
// Register our temp file as a dependency — we write to this file
|
|
272
|
-
// to trigger rebuilds.
|
|
273
|
-
let touchFile = getTouchFile(context);
|
|
274
|
-
if (touchFile) {
|
|
275
|
-
registerDependency({
|
|
276
|
-
type: 'dependency',
|
|
277
|
-
file: touchFile
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
if (tailwindDirectives.size > 0) {
|
|
281
|
-
for (let changedContent of resolvedChangedContent(context, candidateFiles)){
|
|
282
|
-
context.changedContent.push(changedContent);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return context;
|
|
286
|
-
};
|
|
287
|
-
};
|
|
288
|
-
}
|
package/nesting/plugin.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
let postcss = require('postcss')
|
|
2
|
-
let postcssNested = require('postcss-nested')
|
|
3
|
-
|
|
4
|
-
module.exports = function nesting(opts = postcssNested) {
|
|
5
|
-
return (root, result) => {
|
|
6
|
-
root.walkAtRules('screen', (rule) => {
|
|
7
|
-
rule.name = 'media'
|
|
8
|
-
rule.params = `screen(${rule.params})`
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
root.walkAtRules('apply', (rule) => {
|
|
12
|
-
rule.before(postcss.decl({ prop: '__apply', value: rule.params, source: rule.source }))
|
|
13
|
-
rule.remove()
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
let plugin = (() => {
|
|
17
|
-
if (typeof opts === 'function') {
|
|
18
|
-
return opts
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (typeof opts === 'string') {
|
|
22
|
-
return require(opts)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (Object.keys(opts).length <= 0) {
|
|
26
|
-
return postcssNested
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
throw new Error('tailwindcss/nesting should be loaded with a nesting plugin.')
|
|
30
|
-
})()
|
|
31
|
-
|
|
32
|
-
postcss([plugin]).process(root, result.opts).sync()
|
|
33
|
-
|
|
34
|
-
root.walkDecls('__apply', (decl) => {
|
|
35
|
-
decl.before(postcss.atRule({ name: 'apply', params: decl.value, source: decl.source }))
|
|
36
|
-
decl.remove()
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
return root
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
let fs = require('fs/promises')
|
|
2
|
-
let { spawn } = require('child_process')
|
|
3
|
-
let path = require('path')
|
|
4
|
-
let root = process.cwd()
|
|
5
|
-
|
|
6
|
-
function npmInstall(cwd) {
|
|
7
|
-
return new Promise((resolve) => {
|
|
8
|
-
let childProcess = spawn('npm', ['install'], { cwd })
|
|
9
|
-
childProcess.on('exit', resolve)
|
|
10
|
-
})
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
async function install() {
|
|
14
|
-
let base = path.resolve(root, 'integrations')
|
|
15
|
-
let ignoreFolders = ['node_modules']
|
|
16
|
-
let integrations = (await fs.readdir(base, { withFileTypes: true }))
|
|
17
|
-
.filter((integration) => integration.isDirectory())
|
|
18
|
-
.filter((integration) => !ignoreFolders.includes(integration.name))
|
|
19
|
-
.map((folder) => path.resolve(base, folder.name))
|
|
20
|
-
.concat([base])
|
|
21
|
-
.map((integration) => npmInstall(integration))
|
|
22
|
-
|
|
23
|
-
await Promise.all(integrations)
|
|
24
|
-
console.log('Done!')
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
install()
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import postcss from 'postcss'
|
|
3
|
-
import tailwind from '..'
|
|
4
|
-
|
|
5
|
-
function build({ from, to, config }) {
|
|
6
|
-
return new Promise((resolve, reject) => {
|
|
7
|
-
console.log(`Processing ./${from}...`)
|
|
8
|
-
|
|
9
|
-
fs.readFile(`./${from}`, (err, css) => {
|
|
10
|
-
if (err) throw err
|
|
11
|
-
|
|
12
|
-
return postcss([tailwind(config)])
|
|
13
|
-
.process(css, {
|
|
14
|
-
from: undefined,
|
|
15
|
-
})
|
|
16
|
-
.then((result) => {
|
|
17
|
-
fs.writeFileSync(`./${to}`, result.css)
|
|
18
|
-
return result
|
|
19
|
-
})
|
|
20
|
-
.then(resolve)
|
|
21
|
-
.catch((error) => {
|
|
22
|
-
console.log(error)
|
|
23
|
-
reject()
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
console.info('\nRebuilding fixtures...\n')
|
|
30
|
-
|
|
31
|
-
Promise.all([
|
|
32
|
-
build({
|
|
33
|
-
from: 'tests/fixtures/tailwind-input.css',
|
|
34
|
-
to: 'tests/fixtures/tailwind-output.css',
|
|
35
|
-
config: {},
|
|
36
|
-
}),
|
|
37
|
-
build({
|
|
38
|
-
from: 'tests/fixtures/tailwind-input.css',
|
|
39
|
-
to: 'tests/fixtures/tailwind-output-important.css',
|
|
40
|
-
config: { important: true },
|
|
41
|
-
}),
|
|
42
|
-
build({
|
|
43
|
-
from: 'tests/fixtures/tailwind-input.css',
|
|
44
|
-
to: 'tests/fixtures/tailwind-output-no-color-opacity.css',
|
|
45
|
-
config: {
|
|
46
|
-
corePlugins: {
|
|
47
|
-
textOpacity: false,
|
|
48
|
-
backgroundOpacity: false,
|
|
49
|
-
borderOpacity: false,
|
|
50
|
-
placeholderOpacity: false,
|
|
51
|
-
divideOpacity: false,
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
}),
|
|
55
|
-
build({
|
|
56
|
-
from: 'tests/fixtures/tailwind-input.css',
|
|
57
|
-
to: 'tests/fixtures/tailwind-output-flagged.css',
|
|
58
|
-
config: {
|
|
59
|
-
future: 'all',
|
|
60
|
-
experimental: 'all',
|
|
61
|
-
},
|
|
62
|
-
}),
|
|
63
|
-
]).then(() => {
|
|
64
|
-
console.log('\nFinished rebuilding fixtures.')
|
|
65
|
-
console.log(
|
|
66
|
-
'\nPlease triple check that the fixture output matches what you expect before committing this change.'
|
|
67
|
-
)
|
|
68
|
-
})
|
package/src/constants.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
|
|
3
|
-
export const cli = 'tailwind'
|
|
4
|
-
export const defaultConfigFile = './tailwind.config.js'
|
|
5
|
-
export const defaultPostCssConfigFile = './postcss.config.js'
|
|
6
|
-
export const cjsConfigFile = './tailwind.config.cjs'
|
|
7
|
-
export const cjsPostCssConfigFile = './postcss.config.cjs'
|
|
8
|
-
|
|
9
|
-
export const supportedConfigFiles = [cjsConfigFile, defaultConfigFile]
|
|
10
|
-
export const supportedPostCssConfigFile = [cjsPostCssConfigFile, defaultPostCssConfigFile]
|
|
11
|
-
|
|
12
|
-
export const defaultConfigStubFile = path.resolve(__dirname, '../stubs/defaultConfig.stub.js')
|
|
13
|
-
export const simpleConfigStubFile = path.resolve(__dirname, '../stubs/simpleConfig.stub.js')
|
|
14
|
-
export const defaultPostCssConfigStubFile = path.resolve(
|
|
15
|
-
__dirname,
|
|
16
|
-
'../stubs/defaultPostCssConfig.stub.js'
|
|
17
|
-
)
|