Revert "Commit updated Javascript packages"
This reverts commit a88734348a.
This commit is contained in:
63
build/javascript/node_modules/tailwindcss/lib/cli/colors.js
generated
vendored
63
build/javascript/node_modules/tailwindcss/lib/cli/colors.js
generated
vendored
@@ -1,63 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.bold = bold;
|
||||
exports.info = info;
|
||||
exports.error = error;
|
||||
exports.command = command;
|
||||
exports.file = file;
|
||||
|
||||
var _chalk = _interopRequireDefault(require("chalk"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Applies colors to emphasize
|
||||
*
|
||||
* @param {...string} msgs
|
||||
*/
|
||||
function bold(...msgs) {
|
||||
return _chalk.default.bold(...msgs);
|
||||
}
|
||||
/**
|
||||
* Applies colors to inform
|
||||
*
|
||||
* @param {...string} msgs
|
||||
*/
|
||||
|
||||
|
||||
function info(...msgs) {
|
||||
return _chalk.default.bold.cyan(...msgs);
|
||||
}
|
||||
/**
|
||||
* Applies colors to signify error
|
||||
*
|
||||
* @param {...string} msgs
|
||||
*/
|
||||
|
||||
|
||||
function error(...msgs) {
|
||||
return _chalk.default.bold.red(...msgs);
|
||||
}
|
||||
/**
|
||||
* Applies colors to represent a command
|
||||
*
|
||||
* @param {...string} msgs
|
||||
*/
|
||||
|
||||
|
||||
function command(...msgs) {
|
||||
return _chalk.default.bold.magenta(...msgs);
|
||||
}
|
||||
/**
|
||||
* Applies colors to represent a file
|
||||
*
|
||||
* @param {...string} msgs
|
||||
*/
|
||||
|
||||
|
||||
function file(...msgs) {
|
||||
return _chalk.default.bold.magenta(...msgs);
|
||||
}
|
||||
132
build/javascript/node_modules/tailwindcss/lib/cli/commands/build.js
generated
vendored
132
build/javascript/node_modules/tailwindcss/lib/cli/commands/build.js
generated
vendored
@@ -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);
|
||||
});
|
||||
}
|
||||
103
build/javascript/node_modules/tailwindcss/lib/cli/commands/help.js
generated
vendored
103
build/javascript/node_modules/tailwindcss/lib/cli/commands/help.js
generated
vendored
@@ -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();
|
||||
});
|
||||
}
|
||||
23
build/javascript/node_modules/tailwindcss/lib/cli/commands/index.js
generated
vendored
23
build/javascript/node_modules/tailwindcss/lib/cli/commands/index.js
generated
vendored
@@ -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;
|
||||
78
build/javascript/node_modules/tailwindcss/lib/cli/commands/init.js
generated
vendored
78
build/javascript/node_modules/tailwindcss/lib/cli/commands/init.js
generated
vendored
@@ -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();
|
||||
});
|
||||
}
|
||||
53
build/javascript/node_modules/tailwindcss/lib/cli/compile.js
generated
vendored
53
build/javascript/node_modules/tailwindcss/lib/cli/compile.js
generated
vendored
@@ -1,53 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = compile;
|
||||
|
||||
var _postcss = _interopRequireDefault(require("postcss"));
|
||||
|
||||
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 }; }
|
||||
|
||||
/**
|
||||
* Compiler options
|
||||
*
|
||||
* @typedef {Object} CompileOptions
|
||||
* @property {string} inputFile
|
||||
* @property {string} outputFile
|
||||
* @property {array} plugins
|
||||
*/
|
||||
const defaultOptions = {
|
||||
inputFile: null,
|
||||
outputFile: null,
|
||||
plugins: []
|
||||
};
|
||||
/**
|
||||
* Compiles CSS file.
|
||||
*
|
||||
* @param {CompileOptions} options
|
||||
* @return {Promise}
|
||||
*/
|
||||
|
||||
function compile(options = {}) {
|
||||
const config = { ...defaultOptions,
|
||||
...options
|
||||
};
|
||||
const css = config.inputFile ? utils.readFile(config.inputFile) : `
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
`;
|
||||
return new Promise((resolve, reject) => {
|
||||
(0, _postcss.default)(config.plugins).process(css, {
|
||||
from: config.inputFile,
|
||||
to: config.outputFile
|
||||
}).then(resolve).catch(reject);
|
||||
});
|
||||
}
|
||||
21
build/javascript/node_modules/tailwindcss/lib/cli/emoji.js
generated
vendored
21
build/javascript/node_modules/tailwindcss/lib/cli/emoji.js
generated
vendored
@@ -1,21 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.warning = exports.disk = exports.pack = exports.go = exports.no = exports.yes = void 0;
|
||||
|
||||
var _nodeEmoji = require("node-emoji");
|
||||
|
||||
const yes = (0, _nodeEmoji.get)('white_check_mark');
|
||||
exports.yes = yes;
|
||||
const no = (0, _nodeEmoji.get)('no_entry_sign');
|
||||
exports.no = no;
|
||||
const go = (0, _nodeEmoji.get)('rocket');
|
||||
exports.go = go;
|
||||
const pack = (0, _nodeEmoji.get)('package');
|
||||
exports.pack = pack;
|
||||
const disk = (0, _nodeEmoji.get)('floppy_disk');
|
||||
exports.disk = disk;
|
||||
const warning = (0, _nodeEmoji.get)('warning');
|
||||
exports.warning = warning;
|
||||
32
build/javascript/node_modules/tailwindcss/lib/cli/main.js
generated
vendored
32
build/javascript/node_modules/tailwindcss/lib/cli/main.js
generated
vendored
@@ -1,32 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = run;
|
||||
|
||||
var _commands = _interopRequireDefault(require("./commands"));
|
||||
|
||||
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 }; }
|
||||
|
||||
/**
|
||||
* CLI application entrypoint.
|
||||
*
|
||||
* @param {string[]} cliArgs
|
||||
* @return {Promise}
|
||||
*/
|
||||
function run(cliArgs) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const params = utils.parseCliParams(cliArgs);
|
||||
const command = _commands.default[params[0]];
|
||||
const options = command ? utils.parseCliOptions(cliArgs, command.optionMap) : {};
|
||||
const commandPromise = command ? command.run(params.slice(1), options) : _commands.default.help.run(params);
|
||||
commandPromise.then(resolve).catch(reject);
|
||||
});
|
||||
}
|
||||
179
build/javascript/node_modules/tailwindcss/lib/cli/utils.js
generated
vendored
179
build/javascript/node_modules/tailwindcss/lib/cli/utils.js
generated
vendored
@@ -1,179 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseCliParams = parseCliParams;
|
||||
exports.parseCliOptions = parseCliOptions;
|
||||
exports.log = log;
|
||||
exports.header = header;
|
||||
exports.footer = footer;
|
||||
exports.error = error;
|
||||
exports.die = die;
|
||||
exports.exists = exists;
|
||||
exports.copyFile = copyFile;
|
||||
exports.readFile = readFile;
|
||||
exports.writeFile = writeFile;
|
||||
exports.getSimplePath = getSimplePath;
|
||||
|
||||
var _fsExtra = require("fs-extra");
|
||||
|
||||
var _lodash = require("lodash");
|
||||
|
||||
var colors = _interopRequireWildcard(require("./colors"));
|
||||
|
||||
var emoji = _interopRequireWildcard(require("./emoji"));
|
||||
|
||||
var _package = _interopRequireDefault(require("../../package.json"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
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; }
|
||||
|
||||
/**
|
||||
* Gets CLI parameters.
|
||||
*
|
||||
* @param {string[]} cliArgs
|
||||
* @return {string[]}
|
||||
*/
|
||||
function parseCliParams(cliArgs) {
|
||||
const firstOptionIndex = cliArgs.findIndex(cliArg => cliArg.startsWith('-'));
|
||||
return firstOptionIndex > -1 ? cliArgs.slice(0, firstOptionIndex) : cliArgs;
|
||||
}
|
||||
/**
|
||||
* Gets mapped CLI options.
|
||||
*
|
||||
* @param {string[]} cliArgs
|
||||
* @param {object} [optionMap]
|
||||
* @return {object}
|
||||
*/
|
||||
|
||||
|
||||
function parseCliOptions(cliArgs, optionMap = {}) {
|
||||
let options = {};
|
||||
let currentOption = [];
|
||||
cliArgs.forEach(cliArg => {
|
||||
const option = cliArg.startsWith('-') && (0, _lodash.trimStart)(cliArg, '-').toLowerCase();
|
||||
const resolvedOption = (0, _lodash.findKey)(optionMap, aliases => aliases.includes(option));
|
||||
|
||||
if (resolvedOption) {
|
||||
currentOption = options[resolvedOption] || (options[resolvedOption] = []);
|
||||
} else if (option) {
|
||||
currentOption = [];
|
||||
} else {
|
||||
currentOption.push(cliArg);
|
||||
}
|
||||
});
|
||||
return { ...(0, _lodash.mapValues)(optionMap, () => undefined),
|
||||
...options
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Prints messages to console.
|
||||
*
|
||||
* @param {...string} [msgs]
|
||||
*/
|
||||
|
||||
|
||||
function log(...msgs) {
|
||||
console.log(' ', ...msgs);
|
||||
}
|
||||
/**
|
||||
* Prints application header to console.
|
||||
*/
|
||||
|
||||
|
||||
function header() {
|
||||
log();
|
||||
log(colors.bold(_package.default.name), colors.info(_package.default.version));
|
||||
}
|
||||
/**
|
||||
* Prints application footer to console.
|
||||
*/
|
||||
|
||||
|
||||
function footer() {
|
||||
log();
|
||||
}
|
||||
/**
|
||||
* Prints error messages to console.
|
||||
*
|
||||
* @param {...string} [msgs]
|
||||
*/
|
||||
|
||||
|
||||
function error(...msgs) {
|
||||
log();
|
||||
console.error(' ', emoji.no, colors.error(msgs.join(' ')));
|
||||
}
|
||||
/**
|
||||
* Kills the process. Optionally prints error messages to console.
|
||||
*
|
||||
* @param {...string} [msgs]
|
||||
*/
|
||||
|
||||
|
||||
function die(...msgs) {
|
||||
msgs.length && error(...msgs);
|
||||
footer();
|
||||
process.exit(1); // eslint-disable-line
|
||||
}
|
||||
/**
|
||||
* Checks if path exists.
|
||||
*
|
||||
* @param {string} path
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
|
||||
function exists(path) {
|
||||
return (0, _fsExtra.existsSync)(path);
|
||||
}
|
||||
/**
|
||||
* Copies file source to destination.
|
||||
*
|
||||
* @param {string} source
|
||||
* @param {string} destination
|
||||
*/
|
||||
|
||||
|
||||
function copyFile(source, destination) {
|
||||
(0, _fsExtra.copyFileSync)(source, destination);
|
||||
}
|
||||
/**
|
||||
* Gets file content.
|
||||
*
|
||||
* @param {string} path
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
|
||||
function readFile(path) {
|
||||
return (0, _fsExtra.readFileSync)(path, 'utf-8');
|
||||
}
|
||||
/**
|
||||
* Writes content to file.
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {string} content
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
|
||||
function writeFile(path, content) {
|
||||
(0, _fsExtra.ensureFileSync)(path);
|
||||
return (0, _fsExtra.outputFileSync)(path, content);
|
||||
}
|
||||
/**
|
||||
* Strips leading ./ from path
|
||||
*
|
||||
* @param {string} path
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
|
||||
function getSimplePath(path) {
|
||||
return (0, _lodash.startsWith)(path, './') ? path.slice(2) : path;
|
||||
}
|
||||
Reference in New Issue
Block a user