tailwindcss 0.0.0-insiders.f4635e0 → 0.0.0-insiders.f6eeed3
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 +360 -1
- package/LICENSE +1 -2
- package/README.md +8 -4
- package/colors.d.ts +3 -0
- package/colors.js +2 -304
- package/defaultConfig.d.ts +3 -0
- package/defaultConfig.js +2 -4
- package/defaultTheme.d.ts +3 -0
- package/defaultTheme.js +2 -4
- package/lib/cli-peer-dependencies.js +5 -10
- package/lib/cli.js +702 -706
- package/lib/constants.js +23 -23
- package/lib/corePluginList.js +175 -4
- package/lib/corePlugins.js +3601 -2950
- package/lib/css/preflight.css +18 -5
- package/lib/featureFlags.js +44 -45
- package/lib/index.js +35 -25
- package/lib/lib/cacheInvalidation.js +69 -0
- package/lib/lib/collapseAdjacentRules.js +47 -36
- package/lib/lib/collapseDuplicateDeclarations.js +80 -0
- package/lib/lib/defaultExtractor.js +44 -0
- package/lib/lib/detectNesting.js +29 -16
- package/lib/lib/evaluateTailwindFunctions.js +134 -155
- package/lib/lib/expandApplyAtRules.js +391 -203
- package/lib/lib/expandTailwindAtRules.js +238 -236
- package/lib/lib/generateRules.js +594 -310
- package/lib/lib/getModuleDependencies.js +38 -43
- package/lib/lib/normalizeTailwindDirectives.js +74 -58
- package/lib/lib/partitionApplyAtRules.js +53 -0
- package/lib/lib/resolveDefaultsAtRules.js +129 -91
- package/lib/lib/setupContextUtils.js +806 -666
- package/lib/lib/setupTrackingContext.js +145 -164
- package/lib/lib/sharedState.js +40 -17
- package/lib/lib/substituteScreenAtRules.js +22 -26
- package/{nesting → lib/postcss-plugins/nesting}/README.md +0 -0
- package/lib/postcss-plugins/nesting/index.js +17 -0
- package/lib/postcss-plugins/nesting/plugin.js +85 -0
- package/lib/processTailwindFeatures.js +45 -46
- package/lib/public/colors.js +329 -0
- package/lib/public/create-plugin.js +13 -0
- package/lib/public/default-config.js +14 -0
- package/lib/public/default-theme.js +14 -0
- package/lib/public/resolve-config.js +19 -0
- package/lib/util/bigSign.js +3 -5
- package/lib/util/buildMediaQuery.js +15 -31
- package/lib/util/cloneDeep.js +14 -13
- package/lib/util/cloneNodes.js +21 -14
- package/lib/util/color.js +89 -63
- package/lib/util/configurePlugins.js +13 -14
- package/lib/util/createPlugin.js +20 -24
- package/lib/util/createUtilityPlugin.js +43 -45
- package/lib/util/dataTypes.js +235 -0
- package/lib/util/defaults.js +16 -14
- package/lib/util/escapeClassName.js +12 -14
- package/lib/util/escapeCommas.js +3 -5
- package/lib/util/flattenColorPalette.js +12 -10
- package/lib/util/formatVariantSelector.js +186 -0
- package/lib/util/getAllConfigs.js +23 -16
- package/lib/util/hashConfig.js +10 -10
- package/lib/util/isKeyframeRule.js +3 -5
- package/lib/util/isPlainObject.js +7 -10
- package/lib/util/isValidArbitraryValue.js +64 -0
- package/lib/util/log.js +45 -32
- package/lib/util/nameClass.js +22 -27
- package/lib/util/negateValue.js +14 -15
- package/lib/util/normalizeConfig.js +240 -0
- package/lib/util/normalizeScreens.js +59 -0
- package/lib/util/parseAnimationValue.js +83 -54
- package/lib/util/parseBoxShadowValue.js +117 -0
- package/lib/util/parseDependency.js +51 -62
- package/lib/util/parseObjectStyles.js +23 -20
- package/lib/util/pluginUtils.js +146 -285
- package/lib/util/prefixSelector.js +15 -18
- package/lib/util/resolveConfig.js +218 -252
- package/lib/util/resolveConfigPath.js +39 -47
- package/lib/util/responsive.js +12 -11
- package/lib/util/tap.js +4 -6
- package/lib/util/toColorValue.js +3 -5
- package/lib/util/toPath.js +9 -6
- package/lib/util/transformThemeValue.js +53 -26
- package/lib/util/withAlphaVariable.js +59 -57
- package/nesting/index.js +2 -12
- package/package.json +48 -60
- package/peers/index.js +72849 -84292
- package/plugin.d.ts +6 -0
- package/plugin.js +1 -2
- package/resolveConfig.js +2 -7
- package/scripts/create-plugin-list.js +2 -2
- package/scripts/generate-types.js +52 -0
- package/src/cli.js +115 -36
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +2147 -1968
- package/src/css/preflight.css +18 -5
- package/src/featureFlags.js +14 -8
- package/src/index.js +14 -6
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +16 -1
- package/src/lib/collapseDuplicateDeclarations.js +93 -0
- package/src/lib/defaultExtractor.js +50 -0
- package/src/lib/detectNesting.js +22 -3
- package/src/lib/evaluateTailwindFunctions.js +6 -3
- package/src/lib/expandApplyAtRules.js +285 -56
- package/src/lib/expandTailwindAtRules.js +87 -57
- package/src/lib/generateRules.js +364 -41
- package/src/lib/normalizeTailwindDirectives.js +10 -3
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/resolveDefaultsAtRules.js +81 -40
- package/src/lib/setupContextUtils.js +374 -201
- package/src/lib/setupTrackingContext.js +17 -16
- package/src/lib/sharedState.js +42 -7
- package/src/lib/substituteScreenAtRules.js +6 -3
- 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 +18 -3
- package/src/public/colors.js +300 -0
- package/src/public/create-plugin.js +2 -0
- package/src/public/default-config.js +4 -0
- package/src/public/default-theme.js +4 -0
- package/src/public/resolve-config.js +7 -0
- package/src/util/buildMediaQuery.js +14 -18
- package/src/util/cloneNodes.js +14 -1
- package/src/util/color.js +25 -10
- package/src/util/createUtilityPlugin.js +2 -11
- package/src/util/dataTypes.js +250 -0
- package/src/util/defaults.js +6 -0
- package/src/util/formatVariantSelector.js +196 -0
- package/src/util/isValidArbitraryValue.js +61 -0
- package/src/util/log.js +23 -22
- package/src/util/nameClass.js +2 -2
- package/src/util/negateValue.js +4 -2
- package/src/util/normalizeConfig.js +270 -0
- package/src/util/normalizeScreens.js +45 -0
- package/src/util/parseAnimationValue.js +7 -1
- package/src/util/parseBoxShadowValue.js +119 -0
- package/src/util/parseDependency.js +4 -0
- package/src/util/pluginUtils.js +101 -204
- package/src/util/prefixSelector.js +7 -8
- package/src/util/resolveConfig.js +53 -66
- package/src/util/toPath.js +23 -1
- package/src/util/transformThemeValue.js +22 -7
- package/src/util/withAlphaVariable.js +13 -8
- package/stubs/defaultConfig.stub.js +168 -99
- package/stubs/simpleConfig.stub.js +0 -1
- package/types/config.d.ts +323 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +276 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types.d.ts +1 -0
- package/lib/lib/setupWatchingContext.js +0 -331
- package/nesting/plugin.js +0 -41
- package/src/lib/setupWatchingContext.js +0 -307
package/lib/cli.js
CHANGED
|
@@ -1,765 +1,761 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
4
|
-
var _index = require("../peers/index.js");
|
|
5
|
-
|
|
3
|
+
var _indexJs = require("../peers/index.js");
|
|
6
4
|
var _chokidar = _interopRequireDefault(require("chokidar"));
|
|
7
|
-
|
|
8
5
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
6
|
var _arg = _interopRequireDefault(require("arg"));
|
|
11
|
-
|
|
12
7
|
var _fs = _interopRequireDefault(require("fs"));
|
|
13
|
-
|
|
14
8
|
var _postcssLoadConfig = _interopRequireDefault(require("postcss-load-config"));
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _plugins = _interopRequireDefault(require("postcss-load-config/src/plugins"));
|
|
19
|
-
|
|
9
|
+
var _lilconfig = require("lilconfig");
|
|
10
|
+
var _plugins // Little bit scary, looking at private/internal API
|
|
11
|
+
= _interopRequireDefault(require("postcss-load-config/src/plugins"));
|
|
20
12
|
var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
|
|
21
|
-
|
|
22
13
|
var _resolveConfig = _interopRequireDefault(require("../resolveConfig"));
|
|
23
|
-
|
|
24
14
|
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
25
|
-
|
|
26
15
|
var _getModuleDependencies = _interopRequireDefault(require("./lib/getModuleDependencies"));
|
|
27
|
-
|
|
28
16
|
var _log = _interopRequireDefault(require("./util/log"));
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
var _packageJson = _interopRequireDefault(require("../package.json"));
|
|
18
|
+
var _normalizePath = _interopRequireDefault(require("normalize-path"));
|
|
19
|
+
function _interopRequireDefault(obj) {
|
|
20
|
+
return obj && obj.__esModule ? obj : {
|
|
21
|
+
default: obj
|
|
22
|
+
};
|
|
23
|
+
}
|
|
35
24
|
let env = {
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
|
|
25
|
+
DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== "0"
|
|
26
|
+
};
|
|
27
|
+
// ---
|
|
39
28
|
function indentRecursive(node, indent = 0) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
29
|
+
node.each && node.each((child, i)=>{
|
|
30
|
+
if (!child.raws.before || !child.raws.before.trim() || child.raws.before.includes("\n")) {
|
|
31
|
+
child.raws.before = `\n${node.type !== "rule" && i > 0 ? "\n" : ""}${" ".repeat(indent)}`;
|
|
32
|
+
}
|
|
33
|
+
child.raws.after = `\n${" ".repeat(indent)}`;
|
|
34
|
+
indentRecursive(child, indent + 1);
|
|
35
|
+
});
|
|
48
36
|
}
|
|
49
|
-
|
|
50
37
|
function formatNodes(root) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
38
|
+
indentRecursive(root);
|
|
39
|
+
if (root.first) {
|
|
40
|
+
root.first.raws.before = "";
|
|
41
|
+
}
|
|
56
42
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
usage,
|
|
61
|
-
commands,
|
|
62
|
-
options
|
|
63
|
-
}) {
|
|
64
|
-
let indent = 2; // Render header
|
|
65
|
-
|
|
66
|
-
console.log();
|
|
67
|
-
console.log(`${_package.default.name} v${_package.default.version}`); // Render message
|
|
68
|
-
|
|
69
|
-
if (message) {
|
|
70
|
-
console.log();
|
|
71
|
-
|
|
72
|
-
for (let msg of message.split('\n')) {
|
|
73
|
-
console.log(msg);
|
|
43
|
+
async function outputFile(file, contents) {
|
|
44
|
+
if (_fs.default.existsSync(file) && await _fs.default.promises.readFile(file, "utf8") === contents) {
|
|
45
|
+
return; // Skip writing the file
|
|
74
46
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
47
|
+
// Write the file
|
|
48
|
+
await _fs.default.promises.writeFile(file, contents, "utf8");
|
|
49
|
+
}
|
|
50
|
+
function drainStdin() {
|
|
51
|
+
return new Promise((resolve, reject)=>{
|
|
52
|
+
let result = "";
|
|
53
|
+
process.stdin.on("data", (chunk)=>{
|
|
54
|
+
result += chunk;
|
|
55
|
+
});
|
|
56
|
+
process.stdin.on("end", ()=>resolve(result)
|
|
57
|
+
);
|
|
58
|
+
process.stdin.on("error", (err)=>reject(err)
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function help({ message , usage , commands: commands1 , options }) {
|
|
63
|
+
let indent = 2;
|
|
64
|
+
// Render header
|
|
79
65
|
console.log();
|
|
80
|
-
console.log(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
66
|
+
console.log(`${_packageJson.default.name} v${_packageJson.default.version}`);
|
|
67
|
+
// Render message
|
|
68
|
+
if (message) {
|
|
69
|
+
console.log();
|
|
70
|
+
for (let msg of message.split("\n")){
|
|
71
|
+
console.log(msg);
|
|
72
|
+
}
|
|
84
73
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
for (let command of commands) {
|
|
93
|
-
console.log(' '.repeat(indent), command);
|
|
74
|
+
// Render usage
|
|
75
|
+
if (usage && usage.length > 0) {
|
|
76
|
+
console.log();
|
|
77
|
+
console.log("Usage:");
|
|
78
|
+
for (let example of usage){
|
|
79
|
+
console.log(" ".repeat(indent), example);
|
|
80
|
+
}
|
|
94
81
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (typeof value === 'object') {
|
|
103
|
-
groupedOptions[key] = { ...value,
|
|
104
|
-
flags: [key]
|
|
105
|
-
};
|
|
106
|
-
} else {
|
|
107
|
-
groupedOptions[value].flags.push(key);
|
|
108
|
-
}
|
|
82
|
+
// Render commands
|
|
83
|
+
if (commands1 && commands1.length > 0) {
|
|
84
|
+
console.log();
|
|
85
|
+
console.log("Commands:");
|
|
86
|
+
for (let command1 of commands1){
|
|
87
|
+
console.log(" ".repeat(indent), command1);
|
|
88
|
+
}
|
|
109
89
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
console.log(
|
|
127
|
-
|
|
90
|
+
// Render options
|
|
91
|
+
if (options) {
|
|
92
|
+
let groupedOptions = {};
|
|
93
|
+
for (let [key, value] of Object.entries(options)){
|
|
94
|
+
if (typeof value === "object") {
|
|
95
|
+
groupedOptions[key] = {
|
|
96
|
+
...value,
|
|
97
|
+
flags: [
|
|
98
|
+
key
|
|
99
|
+
]
|
|
100
|
+
};
|
|
101
|
+
} else {
|
|
102
|
+
groupedOptions[value].flags.push(key);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
console.log();
|
|
106
|
+
console.log("Options:");
|
|
107
|
+
for (let { flags: flags1 , description , deprecated } of Object.values(groupedOptions)){
|
|
108
|
+
if (deprecated) continue;
|
|
109
|
+
if (flags1.length === 1) {
|
|
110
|
+
console.log(" ".repeat(indent + 4 /* 4 = "-i, ".length */ ), flags1.slice().reverse().join(", ").padEnd(20, " "), description);
|
|
111
|
+
} else {
|
|
112
|
+
console.log(" ".repeat(indent), flags1.slice().reverse().join(", ").padEnd(24, " "), description);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
128
115
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
console.log();
|
|
116
|
+
console.log();
|
|
132
117
|
}
|
|
133
|
-
|
|
134
118
|
function oneOf(...options) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
manualParsing: true
|
|
147
|
-
});
|
|
119
|
+
return Object.assign((value = true)=>{
|
|
120
|
+
for (let option of options){
|
|
121
|
+
let parsed = option(value);
|
|
122
|
+
if (parsed === value) {
|
|
123
|
+
return parsed;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
throw new Error("...");
|
|
127
|
+
}, {
|
|
128
|
+
manualParsing: true
|
|
129
|
+
});
|
|
148
130
|
}
|
|
149
|
-
|
|
150
131
|
let commands = {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
132
|
+
init: {
|
|
133
|
+
run: init,
|
|
134
|
+
args: {
|
|
135
|
+
"--full": {
|
|
136
|
+
type: Boolean,
|
|
137
|
+
description: "Initialize a full `tailwind.config.js` file"
|
|
138
|
+
},
|
|
139
|
+
"--postcss": {
|
|
140
|
+
type: Boolean,
|
|
141
|
+
description: "Initialize a `postcss.config.js` file"
|
|
142
|
+
},
|
|
143
|
+
"--types": {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
description: "Add TypeScript types for the `tailwind.config.js` file"
|
|
146
|
+
},
|
|
147
|
+
"-f": "--full",
|
|
148
|
+
"-p": "--postcss"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
build: {
|
|
152
|
+
run: build,
|
|
153
|
+
args: {
|
|
154
|
+
"--input": {
|
|
155
|
+
type: String,
|
|
156
|
+
description: "Input file"
|
|
157
|
+
},
|
|
158
|
+
"--output": {
|
|
159
|
+
type: String,
|
|
160
|
+
description: "Output file"
|
|
161
|
+
},
|
|
162
|
+
"--watch": {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
description: "Watch for changes and rebuild as needed"
|
|
165
|
+
},
|
|
166
|
+
"--poll": {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
description: "Use polling instead of filesystem events when watching"
|
|
169
|
+
},
|
|
170
|
+
"--content": {
|
|
171
|
+
type: String,
|
|
172
|
+
description: "Content paths to use for removing unused classes"
|
|
173
|
+
},
|
|
174
|
+
"--purge": {
|
|
175
|
+
type: String,
|
|
176
|
+
deprecated: true
|
|
177
|
+
},
|
|
178
|
+
"--postcss": {
|
|
179
|
+
type: oneOf(String, Boolean),
|
|
180
|
+
description: "Load custom PostCSS configuration"
|
|
181
|
+
},
|
|
182
|
+
"--minify": {
|
|
183
|
+
type: Boolean,
|
|
184
|
+
description: "Minify the output"
|
|
185
|
+
},
|
|
186
|
+
"--config": {
|
|
187
|
+
type: String,
|
|
188
|
+
description: "Path to a custom config file"
|
|
189
|
+
},
|
|
190
|
+
"--no-autoprefixer": {
|
|
191
|
+
type: Boolean,
|
|
192
|
+
description: "Disable autoprefixer"
|
|
193
|
+
},
|
|
194
|
+
"-c": "--config",
|
|
195
|
+
"-i": "--input",
|
|
196
|
+
"-o": "--output",
|
|
197
|
+
"-m": "--minify",
|
|
198
|
+
"-w": "--watch",
|
|
199
|
+
"-p": "--poll"
|
|
200
|
+
}
|
|
210
201
|
}
|
|
211
|
-
}
|
|
212
202
|
};
|
|
213
203
|
let sharedFlags = {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
204
|
+
"--help": {
|
|
205
|
+
type: Boolean,
|
|
206
|
+
description: "Display usage information"
|
|
207
|
+
},
|
|
208
|
+
"-h": "--help"
|
|
219
209
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
/* Detect redirecting output to a file */
|
|
223
|
-
&& (process.argv[2] === undefined || process.argv.slice(2).every(flag => sharedFlags[flag] !== undefined))) {
|
|
224
|
-
help({
|
|
225
|
-
usage: ['tailwindcss [--input input.css] [--output output.css] [--watch] [options...]', 'tailwindcss init [--full] [--postcss] [options...]'],
|
|
226
|
-
commands: Object.keys(commands).filter(command => command !== 'build').map(command => `${command} [options]`),
|
|
227
|
-
options: { ...commands.build.args,
|
|
228
|
-
...sharedFlags
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
process.exit(0);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
let command = ((arg = '') => arg.startsWith('-') ? undefined : arg)(process.argv[2]) || 'build';
|
|
235
|
-
|
|
236
|
-
if (commands[command] === undefined) {
|
|
237
|
-
if (_fs.default.existsSync(_path.default.resolve(command))) {
|
|
238
|
-
// TODO: Deprecate this in future versions
|
|
239
|
-
// Check if non-existing command, might be a file.
|
|
240
|
-
command = 'build';
|
|
241
|
-
} else {
|
|
210
|
+
if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined
|
|
211
|
+
))) {
|
|
242
212
|
help({
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
213
|
+
usage: [
|
|
214
|
+
"tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
|
|
215
|
+
"tailwindcss init [--full] [--postcss] [--types] [options...]",
|
|
216
|
+
],
|
|
217
|
+
commands: Object.keys(commands).filter((command2)=>command2 !== "build"
|
|
218
|
+
).map((command3)=>`${command3} [options]`
|
|
219
|
+
),
|
|
220
|
+
options: {
|
|
221
|
+
...commands.build.args,
|
|
222
|
+
...sharedFlags
|
|
223
|
+
}
|
|
247
224
|
});
|
|
248
|
-
process.exit(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
for (let i = result['_'].length - 1; i >= 0; --i) {
|
|
271
|
-
let flag = result['_'][i];
|
|
272
|
-
if (!flag.startsWith('-')) continue;
|
|
273
|
-
let flagName = flag;
|
|
274
|
-
let handler = flags[flag]; // Resolve flagName & handler
|
|
275
|
-
|
|
276
|
-
while (typeof handler === 'string') {
|
|
277
|
-
flagName = handler;
|
|
278
|
-
handler = flags[handler];
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (!handler) continue;
|
|
282
|
-
let args = [];
|
|
283
|
-
let offset = i + 1; // Parse args for current flag
|
|
284
|
-
|
|
285
|
-
while (result['_'][offset] && !result['_'][offset].startsWith('-')) {
|
|
286
|
-
args.push(result['_'][offset++]);
|
|
287
|
-
} // Cleanup manually parsed flags + args
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
result['_'].splice(i, 1 + args.length); // Set the resolved value in the `result` object
|
|
291
|
-
|
|
292
|
-
result[flagName] = handler.type(args.length === 0 ? undefined : args.length === 1 ? args[0] : args, flagName);
|
|
293
|
-
} // Ensure that the `command` is always the first argument in the `args`.
|
|
294
|
-
// This is important so that we don't have to check if a default command
|
|
295
|
-
// (build) was used or not from within each plugin.
|
|
296
|
-
//
|
|
297
|
-
// E.g.: tailwindcss input.css -> _: ['build', 'input.css']
|
|
298
|
-
// E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (result['_'][0] !== command) {
|
|
302
|
-
result['_'].unshift(command);
|
|
225
|
+
process.exit(0);
|
|
226
|
+
}
|
|
227
|
+
let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg
|
|
228
|
+
)(process.argv[2]) || "build";
|
|
229
|
+
if (commands[command] === undefined) {
|
|
230
|
+
if (_fs.default.existsSync(_path.default.resolve(command))) {
|
|
231
|
+
// TODO: Deprecate this in future versions
|
|
232
|
+
// Check if non-existing command, might be a file.
|
|
233
|
+
command = "build";
|
|
234
|
+
} else {
|
|
235
|
+
help({
|
|
236
|
+
message: `Invalid command: ${command}`,
|
|
237
|
+
usage: [
|
|
238
|
+
"tailwindcss <command> [options]"
|
|
239
|
+
],
|
|
240
|
+
commands: Object.keys(commands).filter((command4)=>command4 !== "build"
|
|
241
|
+
).map((command5)=>`${command5} [options]`
|
|
242
|
+
),
|
|
243
|
+
options: sharedFlags
|
|
244
|
+
});
|
|
245
|
+
process.exit(1);
|
|
303
246
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
247
|
+
}
|
|
248
|
+
// Execute command
|
|
249
|
+
let { args: flags , run } = commands[command];
|
|
250
|
+
let args = (()=>{
|
|
251
|
+
try {
|
|
252
|
+
let result = (0, _arg).default(Object.fromEntries(Object.entries({
|
|
253
|
+
...flags,
|
|
254
|
+
...sharedFlags
|
|
255
|
+
}).filter(([_key, value])=>{
|
|
256
|
+
var ref;
|
|
257
|
+
return !(value === null || value === void 0 ? void 0 : (ref = value.type) === null || ref === void 0 ? void 0 : ref.manualParsing);
|
|
258
|
+
}).map(([key, value])=>[
|
|
259
|
+
key,
|
|
260
|
+
typeof value === "object" ? value.type : value
|
|
261
|
+
]
|
|
262
|
+
)), {
|
|
263
|
+
permissive: true
|
|
264
|
+
});
|
|
265
|
+
// Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
|
|
266
|
+
for(let i = result["_"].length - 1; i >= 0; --i){
|
|
267
|
+
let flag = result["_"][i];
|
|
268
|
+
if (!flag.startsWith("-")) continue;
|
|
269
|
+
let flagName = flag;
|
|
270
|
+
let handler = flags[flag];
|
|
271
|
+
// Resolve flagName & handler
|
|
272
|
+
while(typeof handler === "string"){
|
|
273
|
+
flagName = handler;
|
|
274
|
+
handler = flags[handler];
|
|
275
|
+
}
|
|
276
|
+
if (!handler) continue;
|
|
277
|
+
let args1 = [];
|
|
278
|
+
let offset = i + 1;
|
|
279
|
+
// Parse args for current flag
|
|
280
|
+
while(result["_"][offset] && !result["_"][offset].startsWith("-")){
|
|
281
|
+
args1.push(result["_"][offset++]);
|
|
282
|
+
}
|
|
283
|
+
// Cleanup manually parsed flags + args
|
|
284
|
+
result["_"].splice(i, 1 + args1.length);
|
|
285
|
+
// Set the resolved value in the `result` object
|
|
286
|
+
result[flagName] = handler.type(args1.length === 0 ? undefined : args1.length === 1 ? args1[0] : args1, flagName);
|
|
287
|
+
}
|
|
288
|
+
// Ensure that the `command` is always the first argument in the `args`.
|
|
289
|
+
// This is important so that we don't have to check if a default command
|
|
290
|
+
// (build) was used or not from within each plugin.
|
|
291
|
+
//
|
|
292
|
+
// E.g.: tailwindcss input.css -> _: ['build', 'input.css']
|
|
293
|
+
// E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
|
|
294
|
+
if (result["_"][0] !== command) {
|
|
295
|
+
result["_"].unshift(command);
|
|
296
|
+
}
|
|
297
|
+
return result;
|
|
298
|
+
} catch (err) {
|
|
299
|
+
if (err.code === "ARG_UNKNOWN_OPTION") {
|
|
300
|
+
help({
|
|
301
|
+
message: err.message,
|
|
302
|
+
usage: [
|
|
303
|
+
"tailwindcss <command> [options]"
|
|
304
|
+
],
|
|
305
|
+
options: sharedFlags
|
|
306
|
+
});
|
|
307
|
+
process.exit(1);
|
|
308
|
+
}
|
|
309
|
+
throw err;
|
|
314
310
|
}
|
|
315
|
-
|
|
316
|
-
throw err;
|
|
317
|
-
}
|
|
318
311
|
})();
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
312
|
+
if (args["--help"]) {
|
|
313
|
+
help({
|
|
314
|
+
options: {
|
|
315
|
+
...flags,
|
|
316
|
+
...sharedFlags
|
|
317
|
+
},
|
|
318
|
+
usage: [
|
|
319
|
+
`tailwindcss ${command} [options]`
|
|
320
|
+
]
|
|
321
|
+
});
|
|
322
|
+
process.exit(0);
|
|
328
323
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
324
|
+
run();
|
|
325
|
+
// ---
|
|
332
326
|
function init() {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
if (_fs.default.existsSync(tailwindConfigLocation)) {
|
|
340
|
-
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
|
|
341
|
-
} else {
|
|
342
|
-
let stubFile = _fs.default.readFileSync(args['--full'] ? _path.default.resolve(__dirname, '../stubs/defaultConfig.stub.js') : _path.default.resolve(__dirname, '../stubs/simpleConfig.stub.js'), 'utf8'); // Change colors import
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
stubFile = stubFile.replace('../colors', 'tailwindcss/colors');
|
|
346
|
-
|
|
347
|
-
_fs.default.writeFileSync(tailwindConfigLocation, stubFile, 'utf8');
|
|
348
|
-
|
|
349
|
-
messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
if (args['--postcss']) {
|
|
353
|
-
let postcssConfigLocation = _path.default.resolve('./postcss.config.js');
|
|
354
|
-
|
|
355
|
-
if (_fs.default.existsSync(postcssConfigLocation)) {
|
|
356
|
-
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
|
|
327
|
+
let messages = [];
|
|
328
|
+
var ref;
|
|
329
|
+
let tailwindConfigLocation = _path.default.resolve((ref = args["_"][1]) !== null && ref !== void 0 ? ref : "./tailwind.config.js");
|
|
330
|
+
if (_fs.default.existsSync(tailwindConfigLocation)) {
|
|
331
|
+
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
|
|
357
332
|
} else {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
333
|
+
let stubFile = _fs.default.readFileSync(args["--full"] ? _path.default.resolve(__dirname, "../stubs/defaultConfig.stub.js") : _path.default.resolve(__dirname, "../stubs/simpleConfig.stub.js"), "utf8");
|
|
334
|
+
if (args["--types"]) {
|
|
335
|
+
let typesHeading = "/** @type {import('tailwindcss/types').Config} */";
|
|
336
|
+
stubFile = stubFile.replace(`module.exports = `, `${typesHeading}\nconst config = `) + "\nmodule.exports = config";
|
|
337
|
+
}
|
|
338
|
+
// Change colors import
|
|
339
|
+
stubFile = stubFile.replace("../colors", "tailwindcss/colors");
|
|
340
|
+
_fs.default.writeFileSync(tailwindConfigLocation, stubFile, "utf8");
|
|
341
|
+
messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
|
|
363
342
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
343
|
+
if (args["--postcss"]) {
|
|
344
|
+
let postcssConfigLocation = _path.default.resolve("./postcss.config.js");
|
|
345
|
+
if (_fs.default.existsSync(postcssConfigLocation)) {
|
|
346
|
+
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
|
|
347
|
+
} else {
|
|
348
|
+
let stubFile = _fs.default.readFileSync(_path.default.resolve(__dirname, "../stubs/defaultPostCssConfig.stub.js"), "utf8");
|
|
349
|
+
_fs.default.writeFileSync(postcssConfigLocation, stubFile, "utf8");
|
|
350
|
+
messages.push(`Created PostCSS config file: ${_path.default.basename(postcssConfigLocation)}`);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (messages.length > 0) {
|
|
354
|
+
console.log();
|
|
355
|
+
for (let message of messages){
|
|
356
|
+
console.log(message);
|
|
357
|
+
}
|
|
371
358
|
}
|
|
372
|
-
}
|
|
373
359
|
}
|
|
374
|
-
|
|
375
360
|
async function build() {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
if (args['--config'] && !_fs.default.existsSync(args['--config'] = _path.default.resolve(args['--config']))) {
|
|
392
|
-
console.error(`Specified config file ${args['--config']} does not exist.`);
|
|
393
|
-
process.exit(9);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
let configPath = args['--config'] ? args['--config'] : (defaultPath => _fs.default.existsSync(defaultPath) ? defaultPath : null)(_path.default.resolve('./tailwind.config.js'));
|
|
397
|
-
|
|
398
|
-
async function loadPostCssPlugins() {
|
|
399
|
-
let customPostCssPath = typeof args['--postcss'] === 'string' ? args['--postcss'] : undefined;
|
|
400
|
-
let {
|
|
401
|
-
plugins: configPlugins
|
|
402
|
-
} = customPostCssPath ? await (async () => {
|
|
403
|
-
let file = _path.default.resolve(customPostCssPath); // Implementation, see: https://unpkg.com/browse/postcss-load-config@3.0.1/src/index.js
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
let {
|
|
407
|
-
config = {}
|
|
408
|
-
} = await (0, _cosmiconfig.cosmiconfig)('postcss').load(file);
|
|
409
|
-
|
|
410
|
-
if (typeof config === 'function') {
|
|
411
|
-
config = config();
|
|
412
|
-
} else {
|
|
413
|
-
config = Object.assign({}, config);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
if (!config.plugins) {
|
|
417
|
-
config.plugins = [];
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
return {
|
|
421
|
-
plugins: (0, _plugins.default)(config, file)
|
|
422
|
-
};
|
|
423
|
-
})() : await (0, _postcssLoadConfig.default)();
|
|
424
|
-
let configPluginTailwindIdx = configPlugins.findIndex(plugin => {
|
|
425
|
-
if (typeof plugin === 'function' && plugin.name === 'tailwindcss') {
|
|
426
|
-
return true;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
if (typeof plugin === 'object' && plugin !== null && plugin.postcssPlugin === 'tailwindcss') {
|
|
430
|
-
return true;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
return false;
|
|
434
|
-
});
|
|
435
|
-
let beforePlugins = configPluginTailwindIdx === -1 ? [] : configPlugins.slice(0, configPluginTailwindIdx);
|
|
436
|
-
let afterPlugins = configPluginTailwindIdx === -1 ? configPlugins : configPlugins.slice(configPluginTailwindIdx + 1);
|
|
437
|
-
return [beforePlugins, afterPlugins];
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
function resolveConfig() {
|
|
441
|
-
let config = configPath ? require(configPath) : {};
|
|
442
|
-
let resolvedConfig = (0, _resolveConfig.default)(config);
|
|
443
|
-
|
|
444
|
-
if (args['--purge']) {
|
|
445
|
-
_log.default.warn(['The `--purge` flag has been deprecated.', 'Please use `--content` instead.']);
|
|
446
|
-
|
|
447
|
-
if (!args['--content']) {
|
|
448
|
-
args['--content'] = ['--purge'];
|
|
449
|
-
}
|
|
361
|
+
let input = args["--input"];
|
|
362
|
+
let output = args["--output"];
|
|
363
|
+
let shouldWatch = args["--watch"];
|
|
364
|
+
let shouldPoll = args["--poll"];
|
|
365
|
+
let shouldCoalesceWriteEvents = shouldPoll || process.platform === "win32";
|
|
366
|
+
let includePostCss = args["--postcss"];
|
|
367
|
+
// Polling interval in milliseconds
|
|
368
|
+
// Used only when polling or coalescing add/change events on Windows
|
|
369
|
+
let pollInterval = 10;
|
|
370
|
+
// TODO: Deprecate this in future versions
|
|
371
|
+
if (!input && args["_"][1]) {
|
|
372
|
+
console.error("[deprecation] Running tailwindcss without -i, please provide an input file.");
|
|
373
|
+
input = args["--input"] = args["_"][1];
|
|
450
374
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
375
|
+
if (input && input !== "-" && !_fs.default.existsSync(input = _path.default.resolve(input))) {
|
|
376
|
+
console.error(`Specified input file ${args["--input"]} does not exist.`);
|
|
377
|
+
process.exit(9);
|
|
454
378
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
function extractContent(config) {
|
|
460
|
-
return config.content.content.concat(config.content.safelist);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
function extractFileGlobs(config) {
|
|
464
|
-
return extractContent(config).filter(file => {
|
|
465
|
-
// Strings in this case are files / globs. If it is something else,
|
|
466
|
-
// like an object it's probably a raw content object. But this object
|
|
467
|
-
// is not watchable, so let's remove it.
|
|
468
|
-
return typeof file === 'string';
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
function extractRawContent(config) {
|
|
473
|
-
return extractContent(config).filter(file => {
|
|
474
|
-
return typeof file === 'object' && file !== null;
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
function getChangedContent(config) {
|
|
479
|
-
let changedContent = []; // Resolve globs from the content config
|
|
480
|
-
|
|
481
|
-
let globs = extractFileGlobs(config);
|
|
482
|
-
|
|
483
|
-
let files = _fastGlob.default.sync(globs);
|
|
484
|
-
|
|
485
|
-
for (let file of files) {
|
|
486
|
-
changedContent.push({
|
|
487
|
-
content: _fs.default.readFileSync(_path.default.resolve(file), 'utf8'),
|
|
488
|
-
extension: _path.default.extname(file)
|
|
489
|
-
});
|
|
490
|
-
} // Resolve raw content in the tailwind config
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
for (let {
|
|
494
|
-
raw: content,
|
|
495
|
-
extension = 'html'
|
|
496
|
-
} of extractRawContent(config)) {
|
|
497
|
-
changedContent.push({
|
|
498
|
-
content,
|
|
499
|
-
extension
|
|
500
|
-
});
|
|
379
|
+
if (args["--config"] && !_fs.default.existsSync(args["--config"] = _path.default.resolve(args["--config"]))) {
|
|
380
|
+
console.error(`Specified config file ${args["--config"]} does not exist.`);
|
|
381
|
+
process.exit(9);
|
|
501
382
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
return () => {
|
|
521
|
-
return createContext(config, changedContent);
|
|
383
|
+
let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null
|
|
384
|
+
)(_path.default.resolve("./tailwind.config.js"));
|
|
385
|
+
async function loadPostCssPlugins() {
|
|
386
|
+
let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
|
|
387
|
+
let { plugins: configPlugins } = customPostCssPath ? await (async ()=>{
|
|
388
|
+
let file = _path.default.resolve(customPostCssPath);
|
|
389
|
+
// Implementation, see: https://unpkg.com/browse/postcss-load-config@3.1.0/src/index.js
|
|
390
|
+
let { config ={} } = await (0, _lilconfig).lilconfig("postcss").load(file);
|
|
391
|
+
if (typeof config === "function") {
|
|
392
|
+
config = config();
|
|
393
|
+
} else {
|
|
394
|
+
config = Object.assign({}, config);
|
|
395
|
+
}
|
|
396
|
+
if (!config.plugins) {
|
|
397
|
+
config.plugins = [];
|
|
398
|
+
}
|
|
399
|
+
return {
|
|
400
|
+
plugins: (0, _plugins).default(config, file)
|
|
522
401
|
};
|
|
523
|
-
|
|
402
|
+
})() : await (0, _postcssLoadConfig).default();
|
|
403
|
+
let configPluginTailwindIdx = configPlugins.findIndex((plugin)=>{
|
|
404
|
+
if (typeof plugin === "function" && plugin.name === "tailwindcss") {
|
|
405
|
+
return true;
|
|
406
|
+
}
|
|
407
|
+
if (typeof plugin === "object" && plugin !== null && plugin.postcssPlugin === "tailwindcss") {
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
return false;
|
|
411
|
+
});
|
|
412
|
+
let beforePlugins = configPluginTailwindIdx === -1 ? [] : configPlugins.slice(0, configPluginTailwindIdx);
|
|
413
|
+
let afterPlugins = configPluginTailwindIdx === -1 ? configPlugins : configPlugins.slice(configPluginTailwindIdx + 1);
|
|
414
|
+
return [
|
|
415
|
+
beforePlugins,
|
|
416
|
+
afterPlugins
|
|
417
|
+
];
|
|
418
|
+
}
|
|
419
|
+
function resolveConfig() {
|
|
420
|
+
let config = configPath ? require(configPath) : {};
|
|
421
|
+
if (args["--purge"]) {
|
|
422
|
+
_log.default.warn("purge-flag-deprecated", [
|
|
423
|
+
"The `--purge` flag has been deprecated.",
|
|
424
|
+
"Please use `--content` instead.",
|
|
425
|
+
]);
|
|
426
|
+
if (!args["--content"]) {
|
|
427
|
+
args["--content"] = args["--purge"];
|
|
428
|
+
}
|
|
524
429
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
return require('autoprefixer');
|
|
535
|
-
} catch {}
|
|
536
|
-
|
|
537
|
-
return (0, _index.lazyAutoprefixer)();
|
|
538
|
-
})(), args['--minify'] && (() => {
|
|
539
|
-
let options = {
|
|
540
|
-
preset: ['default', {
|
|
541
|
-
cssDeclarationSorter: false
|
|
542
|
-
}]
|
|
543
|
-
}; // Try to load a local `cssnano` version first
|
|
544
|
-
|
|
545
|
-
try {
|
|
546
|
-
return require('cssnano');
|
|
547
|
-
} catch {}
|
|
548
|
-
|
|
549
|
-
return (0, _index.lazyCssnano)()(options);
|
|
550
|
-
})()].filter(Boolean);
|
|
551
|
-
let processor = (0, _index.postcss)(plugins);
|
|
552
|
-
|
|
553
|
-
function processCSS(css) {
|
|
554
|
-
let start = process.hrtime.bigint();
|
|
555
|
-
return Promise.resolve().then(() => output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
|
|
556
|
-
recursive: true
|
|
557
|
-
}) : null).then(() => processor.process(css, {
|
|
558
|
-
from: input,
|
|
559
|
-
to: output
|
|
560
|
-
})).then(result => {
|
|
561
|
-
if (!output) {
|
|
562
|
-
return process.stdout.write(result.css);
|
|
430
|
+
if (args["--content"]) {
|
|
431
|
+
let files = args["--content"].split(/(?<!{[^}]+),/);
|
|
432
|
+
let resolvedConfig = (0, _resolveConfig).default(config, {
|
|
433
|
+
content: {
|
|
434
|
+
files
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
resolvedConfig.content.files = files;
|
|
438
|
+
return resolvedConfig;
|
|
563
439
|
}
|
|
564
|
-
|
|
565
|
-
return Promise.all([_fs.default.promises.writeFile(output, result.css, () => true), result.map && _fs.default.writeFile(output + '.map', result.map.toString(), () => true)].filter(Boolean));
|
|
566
|
-
}).then(() => {
|
|
567
|
-
let end = process.hrtime.bigint();
|
|
568
|
-
console.error();
|
|
569
|
-
console.error('Done in', (end - start) / BigInt(1e6) + 'ms.');
|
|
570
|
-
});
|
|
440
|
+
return (0, _resolveConfig).default(config);
|
|
571
441
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
442
|
+
function extractFileGlobs(config) {
|
|
443
|
+
return config.content.files.filter((file)=>{
|
|
444
|
+
// Strings in this case are files / globs. If it is something else,
|
|
445
|
+
// like an object it's probably a raw content object. But this object
|
|
446
|
+
// is not watchable, so let's remove it.
|
|
447
|
+
return typeof file === "string";
|
|
448
|
+
}).map((glob)=>(0, _normalizePath).default(glob)
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
function extractRawContent(config) {
|
|
452
|
+
return config.content.files.filter((file)=>{
|
|
453
|
+
return typeof file === "object" && file !== null;
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
function getChangedContent(config) {
|
|
457
|
+
let changedContent = [];
|
|
458
|
+
// Resolve globs from the content config
|
|
459
|
+
let globs = extractFileGlobs(config);
|
|
460
|
+
let files = _fastGlob.default.sync(globs);
|
|
461
|
+
for (let file of files){
|
|
462
|
+
changedContent.push({
|
|
463
|
+
content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
|
|
464
|
+
extension: _path.default.extname(file).slice(1)
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
// Resolve raw content in the tailwind config
|
|
468
|
+
for (let { raw: content , extension ="html" } of extractRawContent(config)){
|
|
469
|
+
changedContent.push({
|
|
470
|
+
content,
|
|
471
|
+
extension
|
|
472
|
+
});
|
|
599
473
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
env.DEBUG && console.timeEnd('Module dependencies');
|
|
603
|
-
return resolveConfig();
|
|
474
|
+
return changedContent;
|
|
604
475
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
cssDeclarationSorter: false
|
|
618
|
-
}]
|
|
619
|
-
}; // Try to load a local `cssnano` version first
|
|
620
|
-
|
|
621
|
-
try {
|
|
622
|
-
return require('cssnano');
|
|
623
|
-
} catch {}
|
|
624
|
-
|
|
625
|
-
return (0, _index.lazyCssnano)()(options);
|
|
626
|
-
})()].filter(Boolean);
|
|
627
|
-
|
|
628
|
-
async function rebuild(config) {
|
|
629
|
-
env.DEBUG && console.time('Finished in');
|
|
630
|
-
|
|
631
|
-
let tailwindPlugin = () => {
|
|
632
|
-
return {
|
|
633
|
-
postcssPlugin: 'tailwindcss',
|
|
634
|
-
|
|
635
|
-
Once(root, {
|
|
636
|
-
result
|
|
637
|
-
}) {
|
|
638
|
-
env.DEBUG && console.time('Compiling CSS');
|
|
639
|
-
(0, _processTailwindFeatures.default)(({
|
|
640
|
-
createContext
|
|
641
|
-
}) => {
|
|
642
|
-
console.error();
|
|
643
|
-
console.error('Rebuilding...');
|
|
644
|
-
return () => {
|
|
645
|
-
if (context !== null) {
|
|
646
|
-
context.changedContent = changedContent.splice(0);
|
|
647
|
-
return context;
|
|
476
|
+
async function buildOnce() {
|
|
477
|
+
let config = resolveConfig();
|
|
478
|
+
let changedContent = getChangedContent(config);
|
|
479
|
+
let tailwindPlugin = ()=>{
|
|
480
|
+
return {
|
|
481
|
+
postcssPlugin: "tailwindcss",
|
|
482
|
+
Once (root, { result }) {
|
|
483
|
+
(0, _processTailwindFeatures).default(({ createContext })=>{
|
|
484
|
+
return ()=>{
|
|
485
|
+
return createContext(config, changedContent);
|
|
486
|
+
};
|
|
487
|
+
})(root, result);
|
|
648
488
|
}
|
|
649
|
-
|
|
650
|
-
env.DEBUG && console.time('Creating context');
|
|
651
|
-
context = createContext(config, changedContent.splice(0));
|
|
652
|
-
env.DEBUG && console.timeEnd('Creating context');
|
|
653
|
-
return context;
|
|
654
|
-
};
|
|
655
|
-
})(root, result);
|
|
656
|
-
env.DEBUG && console.timeEnd('Compiling CSS');
|
|
657
|
-
}
|
|
658
|
-
|
|
489
|
+
};
|
|
659
490
|
};
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
491
|
+
tailwindPlugin.postcss = true;
|
|
492
|
+
let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() : [
|
|
493
|
+
[],
|
|
494
|
+
[]
|
|
495
|
+
];
|
|
496
|
+
let plugins = [
|
|
497
|
+
...beforePlugins,
|
|
498
|
+
tailwindPlugin,
|
|
499
|
+
!args["--minify"] && formatNodes,
|
|
500
|
+
...afterPlugins,
|
|
501
|
+
!args["--no-autoprefixer"] && (()=>{
|
|
502
|
+
// Try to load a local `autoprefixer` version first
|
|
503
|
+
try {
|
|
504
|
+
return require("autoprefixer");
|
|
505
|
+
} catch {}
|
|
506
|
+
return (0, _indexJs).lazyAutoprefixer();
|
|
507
|
+
})(),
|
|
508
|
+
args["--minify"] && (()=>{
|
|
509
|
+
let options = {
|
|
510
|
+
preset: [
|
|
511
|
+
"default",
|
|
512
|
+
{
|
|
513
|
+
cssDeclarationSorter: false
|
|
514
|
+
}
|
|
515
|
+
]
|
|
516
|
+
};
|
|
517
|
+
// Try to load a local `cssnano` version first
|
|
518
|
+
try {
|
|
519
|
+
return require("cssnano");
|
|
520
|
+
} catch {}
|
|
521
|
+
return (0, _indexJs).lazyCssnano()(options);
|
|
522
|
+
})(),
|
|
523
|
+
].filter(Boolean);
|
|
524
|
+
let processor = (0, _indexJs).postcss(plugins);
|
|
525
|
+
function processCSS(css) {
|
|
526
|
+
let start = process.hrtime.bigint();
|
|
527
|
+
return Promise.resolve().then(()=>output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
|
|
528
|
+
recursive: true
|
|
529
|
+
}) : null
|
|
530
|
+
).then(()=>processor.process(css, {
|
|
531
|
+
from: input,
|
|
532
|
+
to: output
|
|
533
|
+
})
|
|
534
|
+
).then((result)=>{
|
|
535
|
+
if (!output) {
|
|
536
|
+
return process.stdout.write(result.css);
|
|
537
|
+
}
|
|
538
|
+
return Promise.all([
|
|
539
|
+
outputFile(output, result.css),
|
|
540
|
+
result.map && outputFile(output + ".map", result.map.toString()),
|
|
541
|
+
].filter(Boolean));
|
|
542
|
+
}).then(()=>{
|
|
543
|
+
let end = process.hrtime.bigint();
|
|
544
|
+
console.error();
|
|
545
|
+
console.error("Done in", (end - start) / BigInt(1000000) + "ms.");
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
let css1 = await (()=>{
|
|
549
|
+
// Piping in data, let's drain the stdin
|
|
550
|
+
if (input === "-") {
|
|
551
|
+
return drainStdin();
|
|
679
552
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
return
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
await Promise.all([_fs.default.promises.writeFile(output, result.css, () => true), result.map && _fs.default.writeFile(output + '.map', result.map.toString(), () => true)].filter(Boolean));
|
|
689
|
-
}).then(() => {
|
|
690
|
-
let end = process.hrtime.bigint();
|
|
691
|
-
console.error('Done in', (end - start) / BigInt(1e6) + 'ms.');
|
|
692
|
-
}).catch(err => {
|
|
693
|
-
if (err.name === 'CssSyntaxError') {
|
|
694
|
-
console.error(err.toString());
|
|
695
|
-
} else {
|
|
696
|
-
console.error(err);
|
|
697
|
-
}
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
let css = input ? _fs.default.readFileSync(_path.default.resolve(input), 'utf8') : '@tailwind base; @tailwind components; @tailwind utilities';
|
|
702
|
-
let result = await processCSS(css);
|
|
703
|
-
env.DEBUG && console.timeEnd('Finished in');
|
|
704
|
-
return result;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
let config = refreshConfig(configPath);
|
|
708
|
-
|
|
709
|
-
if (input) {
|
|
710
|
-
contextDependencies.add(_path.default.resolve(input));
|
|
553
|
+
// Input file has been provided
|
|
554
|
+
if (input) {
|
|
555
|
+
return _fs.default.readFileSync(_path.default.resolve(input), "utf8");
|
|
556
|
+
}
|
|
557
|
+
// No input file provided, fallback to default atrules
|
|
558
|
+
return "@tailwind base; @tailwind components; @tailwind utilities";
|
|
559
|
+
})();
|
|
560
|
+
return processCSS(css1);
|
|
711
561
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
562
|
+
let context = null;
|
|
563
|
+
async function startWatcher() {
|
|
564
|
+
let changedContent = [];
|
|
565
|
+
let configDependencies = [];
|
|
566
|
+
let contextDependencies = new Set();
|
|
567
|
+
let watcher = null;
|
|
568
|
+
function refreshConfig() {
|
|
569
|
+
env.DEBUG && console.time("Module dependencies");
|
|
570
|
+
for (let file1 of configDependencies){
|
|
571
|
+
delete require.cache[require.resolve(file1)];
|
|
572
|
+
}
|
|
573
|
+
if (configPath) {
|
|
574
|
+
configDependencies = (0, _getModuleDependencies).default(configPath).map(({ file })=>file
|
|
575
|
+
);
|
|
576
|
+
for (let dependency of configDependencies){
|
|
577
|
+
contextDependencies.add(dependency);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
env.DEBUG && console.timeEnd("Module dependencies");
|
|
581
|
+
return resolveConfig();
|
|
582
|
+
}
|
|
583
|
+
let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() : [
|
|
584
|
+
[],
|
|
585
|
+
[]
|
|
586
|
+
];
|
|
587
|
+
let plugins = [
|
|
588
|
+
...beforePlugins,
|
|
589
|
+
"__TAILWIND_PLUGIN_POSITION__",
|
|
590
|
+
!args["--minify"] && formatNodes,
|
|
591
|
+
...afterPlugins,
|
|
592
|
+
!args["--no-autoprefixer"] && (()=>{
|
|
593
|
+
// Try to load a local `autoprefixer` version first
|
|
594
|
+
try {
|
|
595
|
+
return require("autoprefixer");
|
|
596
|
+
} catch {}
|
|
597
|
+
return (0, _indexJs).lazyAutoprefixer();
|
|
598
|
+
})(),
|
|
599
|
+
args["--minify"] && (()=>{
|
|
600
|
+
let options = {
|
|
601
|
+
preset: [
|
|
602
|
+
"default",
|
|
603
|
+
{
|
|
604
|
+
cssDeclarationSorter: false
|
|
605
|
+
}
|
|
606
|
+
]
|
|
607
|
+
};
|
|
608
|
+
// Try to load a local `cssnano` version first
|
|
609
|
+
try {
|
|
610
|
+
return require("cssnano");
|
|
611
|
+
} catch {}
|
|
612
|
+
return (0, _indexJs).lazyCssnano()(options);
|
|
613
|
+
})(),
|
|
614
|
+
].filter(Boolean);
|
|
615
|
+
async function rebuild(config) {
|
|
616
|
+
env.DEBUG && console.time("Finished in");
|
|
617
|
+
let tailwindPlugin = ()=>{
|
|
618
|
+
return {
|
|
619
|
+
postcssPlugin: "tailwindcss",
|
|
620
|
+
Once (root, { result }) {
|
|
621
|
+
env.DEBUG && console.time("Compiling CSS");
|
|
622
|
+
(0, _processTailwindFeatures).default(({ createContext })=>{
|
|
623
|
+
console.error();
|
|
624
|
+
console.error("Rebuilding...");
|
|
625
|
+
return ()=>{
|
|
626
|
+
if (context !== null) {
|
|
627
|
+
context.changedContent = changedContent.splice(0);
|
|
628
|
+
return context;
|
|
629
|
+
}
|
|
630
|
+
env.DEBUG && console.time("Creating context");
|
|
631
|
+
context = createContext(config, changedContent.splice(0));
|
|
632
|
+
env.DEBUG && console.timeEnd("Creating context");
|
|
633
|
+
return context;
|
|
634
|
+
};
|
|
635
|
+
})(root, result);
|
|
636
|
+
env.DEBUG && console.timeEnd("Compiling CSS");
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
tailwindPlugin.postcss = true;
|
|
641
|
+
let tailwindPluginIdx = plugins.indexOf("__TAILWIND_PLUGIN_POSITION__");
|
|
642
|
+
let copy = plugins.slice();
|
|
643
|
+
copy.splice(tailwindPluginIdx, 1, tailwindPlugin);
|
|
644
|
+
let processor = (0, _indexJs).postcss(copy);
|
|
645
|
+
function processCSS(css) {
|
|
646
|
+
let start = process.hrtime.bigint();
|
|
647
|
+
return Promise.resolve().then(()=>output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
|
|
648
|
+
recursive: true
|
|
649
|
+
}) : null
|
|
650
|
+
).then(()=>processor.process(css, {
|
|
651
|
+
from: input,
|
|
652
|
+
to: output
|
|
653
|
+
})
|
|
654
|
+
).then(async (result)=>{
|
|
655
|
+
for (let message of result.messages){
|
|
656
|
+
if (message.type === "dependency") {
|
|
657
|
+
contextDependencies.add(message.file);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
watcher.add([
|
|
661
|
+
...contextDependencies
|
|
662
|
+
]);
|
|
663
|
+
if (!output) {
|
|
664
|
+
return process.stdout.write(result.css);
|
|
665
|
+
}
|
|
666
|
+
return Promise.all([
|
|
667
|
+
outputFile(output, result.css),
|
|
668
|
+
result.map && outputFile(output + ".map", result.map.toString()),
|
|
669
|
+
].filter(Boolean));
|
|
670
|
+
}).then(()=>{
|
|
671
|
+
let end = process.hrtime.bigint();
|
|
672
|
+
console.error("Done in", (end - start) / BigInt(1000000) + "ms.");
|
|
673
|
+
}).catch((err)=>{
|
|
674
|
+
if (err.name === "CssSyntaxError") {
|
|
675
|
+
console.error(err.toString());
|
|
676
|
+
} else {
|
|
677
|
+
console.error(err);
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
let css2 = await (()=>{
|
|
682
|
+
// Piping in data, let's drain the stdin
|
|
683
|
+
if (input === "-") {
|
|
684
|
+
return drainStdin();
|
|
685
|
+
}
|
|
686
|
+
// Input file has been provided
|
|
687
|
+
if (input) {
|
|
688
|
+
return _fs.default.readFileSync(_path.default.resolve(input), "utf8");
|
|
689
|
+
}
|
|
690
|
+
// No input file provided, fallback to default atrules
|
|
691
|
+
return "@tailwind base; @tailwind components; @tailwind utilities";
|
|
692
|
+
})();
|
|
693
|
+
let result1 = await processCSS(css2);
|
|
694
|
+
env.DEBUG && console.timeEnd("Finished in");
|
|
695
|
+
return result1;
|
|
696
|
+
}
|
|
697
|
+
let config1 = refreshConfig(configPath);
|
|
698
|
+
if (input) {
|
|
699
|
+
contextDependencies.add(_path.default.resolve(input));
|
|
700
|
+
}
|
|
701
|
+
watcher = _chokidar.default.watch([
|
|
702
|
+
...contextDependencies,
|
|
703
|
+
...extractFileGlobs(config1)
|
|
704
|
+
], {
|
|
705
|
+
usePolling: shouldPoll,
|
|
706
|
+
interval: shouldPoll ? pollInterval : undefined,
|
|
707
|
+
ignoreInitial: true,
|
|
708
|
+
awaitWriteFinish: shouldCoalesceWriteEvents ? {
|
|
709
|
+
stabilityThreshold: 50,
|
|
710
|
+
pollInterval: pollInterval
|
|
711
|
+
} : false
|
|
731
712
|
});
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
713
|
+
let chain = Promise.resolve();
|
|
714
|
+
watcher.on("change", async (file)=>{
|
|
715
|
+
if (contextDependencies.has(file)) {
|
|
716
|
+
env.DEBUG && console.time("Resolve config");
|
|
717
|
+
context = null;
|
|
718
|
+
config1 = refreshConfig(configPath);
|
|
719
|
+
env.DEBUG && console.timeEnd("Resolve config");
|
|
720
|
+
env.DEBUG && console.time("Watch new files");
|
|
721
|
+
let globs = extractFileGlobs(config1);
|
|
722
|
+
watcher.add(configDependencies);
|
|
723
|
+
watcher.add(globs);
|
|
724
|
+
env.DEBUG && console.timeEnd("Watch new files");
|
|
725
|
+
chain = chain.then(async ()=>{
|
|
726
|
+
changedContent.push(...getChangedContent(config1));
|
|
727
|
+
await rebuild(config1);
|
|
728
|
+
});
|
|
729
|
+
} else {
|
|
730
|
+
chain = chain.then(async ()=>{
|
|
731
|
+
changedContent.push({
|
|
732
|
+
content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
|
|
733
|
+
extension: _path.default.extname(file).slice(1)
|
|
734
|
+
});
|
|
735
|
+
await rebuild(config1);
|
|
736
|
+
});
|
|
737
|
+
}
|
|
739
738
|
});
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
739
|
+
watcher.on("add", async (file)=>{
|
|
740
|
+
chain = chain.then(async ()=>{
|
|
741
|
+
changedContent.push({
|
|
742
|
+
content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
|
|
743
|
+
extension: _path.default.extname(file).slice(1)
|
|
744
|
+
});
|
|
745
|
+
await rebuild(config1);
|
|
746
|
+
});
|
|
747
747
|
});
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
} else {
|
|
763
|
-
buildOnce();
|
|
764
|
-
}
|
|
765
|
-
}
|
|
748
|
+
chain = chain.then(()=>{
|
|
749
|
+
changedContent.push(...getChangedContent(config1));
|
|
750
|
+
return rebuild(config1);
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
if (shouldWatch) {
|
|
754
|
+
/* Abort the watcher if stdin is closed to avoid zombie processes */ process.stdin.on("end", ()=>process.exit(0)
|
|
755
|
+
);
|
|
756
|
+
process.stdin.resume();
|
|
757
|
+
startWatcher();
|
|
758
|
+
} else {
|
|
759
|
+
buildOnce();
|
|
760
|
+
}
|
|
761
|
+
}
|