Revert "Commit updated Javascript packages"

This reverts commit a88734348a.
This commit is contained in:
Gabe Kangas
2020-10-19 22:14:27 -07:00
parent a88734348a
commit 3f50ce9bfc
6368 changed files with 0 additions and 603959 deletions

View File

@@ -1,132 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.run = run;
exports.optionMap = exports.options = exports.description = exports.usage = void 0;
var _autoprefixer = _interopRequireDefault(require("autoprefixer"));
var _bytes = _interopRequireDefault(require("bytes"));
var _prettyHrtime = _interopRequireDefault(require("pretty-hrtime"));
var _ = _interopRequireDefault(require("../.."));
var _compile = _interopRequireDefault(require("../compile"));
var colors = _interopRequireWildcard(require("../colors"));
var emoji = _interopRequireWildcard(require("../emoji"));
var utils = _interopRequireWildcard(require("../utils"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const usage = 'build <file> [options]';
exports.usage = usage;
const description = 'Compiles Tailwind CSS file.';
exports.description = description;
const options = [{
usage: '-o, --output <file>',
description: 'Output file.'
}, {
usage: '-c, --config <file>',
description: 'Tailwind config file.'
}, {
usage: '--no-autoprefixer',
description: "Don't add vendor prefixes using autoprefixer."
}];
exports.options = options;
const optionMap = {
output: ['output', 'o'],
config: ['config', 'c'],
noAutoprefixer: ['no-autoprefixer']
};
/**
* Prints the error message and stops the process.
*
* @param {...string} [msgs]
*/
exports.optionMap = optionMap;
function stop(...msgs) {
utils.header();
utils.error(...msgs);
utils.die();
}
/**
* Compiles CSS file and writes it to stdout.
*
* @param {CompileOptions} compileOptions
* @return {Promise}
*/
function buildToStdout(compileOptions) {
return (0, _compile.default)(compileOptions).then(result => process.stdout.write(result.css));
}
/**
* Compiles CSS file and writes it to a file.
*
* @param {CompileOptions} compileOptions
* @param {int[]} startTime
* @return {Promise}
*/
function buildToFile(compileOptions, startTime) {
const inputFileSimplePath = utils.getSimplePath(compileOptions.inputFile);
const outputFileSimplePath = utils.getSimplePath(compileOptions.outputFile);
utils.header();
utils.log();
utils.log(emoji.go, ...(inputFileSimplePath ? ['Building:', colors.file(inputFileSimplePath)] : ['Building from default CSS...', colors.info('(No input file provided)')]));
return (0, _compile.default)(compileOptions).then(result => {
utils.writeFile(compileOptions.outputFile, result.css);
const prettyTime = (0, _prettyHrtime.default)(process.hrtime(startTime));
utils.log();
utils.log(emoji.yes, 'Finished in', colors.info(prettyTime));
utils.log(emoji.pack, 'Size:', colors.info((0, _bytes.default)(result.css.length)));
utils.log(emoji.disk, 'Saved to', colors.file(outputFileSimplePath));
utils.footer();
});
}
/**
* Runs the command.
*
* @param {string[]} cliParams
* @param {object} cliOptions
* @return {Promise}
*/
function run(cliParams, cliOptions) {
return new Promise((resolve, reject) => {
const startTime = process.hrtime();
const inputFile = cliParams[0];
const configFile = cliOptions.config && cliOptions.config[0];
const outputFile = cliOptions.output && cliOptions.output[0];
const autoprefix = !cliOptions.noAutoprefixer;
const inputFileSimplePath = utils.getSimplePath(inputFile);
const configFileSimplePath = utils.getSimplePath(configFile);
if (inputFile) {
!utils.exists(inputFile) && stop(colors.file(inputFileSimplePath), 'does not exist.');
}
configFile && !utils.exists(configFile) && stop(colors.file(configFileSimplePath), 'does not exist.');
const compileOptions = {
inputFile,
outputFile,
plugins: [(0, _.default)(configFile)].concat(autoprefix ? [_autoprefixer.default] : [])
};
const buildPromise = outputFile ? buildToFile(compileOptions, startTime) : buildToStdout(compileOptions);
buildPromise.then(resolve).catch(reject);
});
}

View File

@@ -1,103 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.forApp = forApp;
exports.forCommand = forCommand;
exports.invalidCommand = invalidCommand;
exports.run = run;
exports.description = exports.usage = void 0;
var _lodash = require("lodash");
var _ = _interopRequireDefault(require("."));
var constants = _interopRequireWildcard(require("../../constants"));
var colors = _interopRequireWildcard(require("../colors"));
var utils = _interopRequireWildcard(require("../utils"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const usage = 'help [command]';
exports.usage = usage;
const description = 'More information about the command.';
exports.description = description;
const PADDING_SIZE = 3;
/**
* Prints general help.
*/
function forApp() {
const pad = Math.max(...(0, _lodash.map)(_.default, 'usage.length')) + PADDING_SIZE;
utils.log();
utils.log('Usage:');
utils.log(' ', colors.bold(constants.cli + ' <command> [options]'));
utils.log();
utils.log('Commands:');
(0, _lodash.forEach)(_.default, command => {
utils.log(' ', colors.bold((0, _lodash.padEnd)(command.usage, pad)), command.description);
});
}
/**
* Prints help for a command.
*
* @param {object} command
*/
function forCommand(command) {
utils.log();
utils.log('Usage:');
utils.log(' ', colors.bold(constants.cli, command.usage));
utils.log();
utils.log('Description:');
utils.log(' ', colors.bold(command.description));
if (command.options) {
const pad = Math.max(...(0, _lodash.map)(command.options, 'usage.length')) + PADDING_SIZE;
utils.log();
utils.log('Options:');
(0, _lodash.forEach)(command.options, option => {
utils.log(' ', colors.bold((0, _lodash.padEnd)(option.usage, pad)), option.description);
});
}
}
/**
* Prints invalid command error and general help. Kills the process.
*
* @param {string} commandName
*/
function invalidCommand(commandName) {
utils.error('Invalid command:', colors.command(commandName));
forApp();
utils.die();
}
/**
* Runs the command.
*
* @param {string[]} cliParams
* @return {Promise}
*/
function run(cliParams) {
return new Promise(resolve => {
utils.header();
const commandName = cliParams[0];
const command = _.default[commandName];
!commandName && forApp();
commandName && command && forCommand(command);
commandName && !command && invalidCommand(commandName);
utils.footer();
resolve();
});
}

View File

@@ -1,23 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var help = _interopRequireWildcard(require("./help"));
var init = _interopRequireWildcard(require("./init"));
var build = _interopRequireWildcard(require("./build"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var _default = {
help,
init,
build
};
exports.default = _default;

View File

@@ -1,78 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.run = run;
exports.optionMap = exports.options = exports.description = exports.usage = void 0;
var constants = _interopRequireWildcard(require("../../constants"));
var colors = _interopRequireWildcard(require("../colors"));
var emoji = _interopRequireWildcard(require("../emoji"));
var utils = _interopRequireWildcard(require("../utils"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const usage = 'init [file]';
exports.usage = usage;
const description = 'Creates Tailwind config file. Default: ' + colors.file(utils.getSimplePath(constants.defaultConfigFile));
exports.description = description;
const options = [{
usage: '--full',
description: 'Generate complete configuration file.'
}, {
usage: '-p',
description: 'Generate postcss.config.js file.'
}];
exports.options = options;
const optionMap = {
full: ['full'],
postcss: ['p']
};
/**
* Runs the command.
*
* @param {string[]} cliParams
* @param {object} cliOptions
* @return {Promise}
*/
exports.optionMap = optionMap;
function run(cliParams, cliOptions) {
return new Promise(resolve => {
utils.header();
const file = cliParams[0] || constants.defaultConfigFile;
const simplePath = utils.getSimplePath(file);
utils.exists(file) && utils.die(colors.file(simplePath), 'already exists.');
const stubFile = cliOptions.full ? constants.defaultConfigStubFile : constants.simpleConfigStubFile;
const config = require(stubFile);
const {
future: flags
} = require('../../featureFlags').default;
flags.forEach(flag => {
config.future[`// ${flag}`] = true;
});
utils.writeFile(file, `module.exports = ${JSON.stringify(config, null, 2).replace(/"([^-_\d"]+)":/g, '$1:')}\n`);
utils.log();
utils.log(emoji.yes, 'Created Tailwind config file:', colors.file(simplePath));
if (cliOptions.postcss) {
const path = utils.getSimplePath(constants.defaultPostCssConfigFile);
utils.exists(constants.defaultPostCssConfigFile) && utils.die(colors.file(path), 'already exists.');
utils.copyFile(constants.defaultPostCssConfigStubFile, constants.defaultPostCssConfigFile);
utils.log(emoji.yes, 'Created PostCSS config file:', colors.file(path));
}
utils.footer();
resolve();
});
}