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