tsup
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -29,6 +29,6 @@ #!/usr/bin/env node | ||
var path__default = _interopDefault(path); | ||
var _commonjsHelpers = require('./_commonjsHelpers-de28b396.js'); | ||
var index = require('./index-5f61b947.js'); | ||
var events = _interopDefault(require('events')); | ||
var dist = _commonjsHelpers.createCommonjsModule(function (module, exports) { | ||
var dist = index.createCommonjsModule(function (module, exports) { | ||
@@ -768,87 +768,12 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
_commonjsHelpers.unwrapExports(dist); | ||
index.unwrapExports(dist); | ||
var dist_1 = dist.cac; | ||
let enabled = | ||
!("NO_COLOR" in process.env) && | ||
process.env.FORCE_COLOR !== "0" && | ||
(process.platform === "win32" || | ||
(process.stdout != null && | ||
process.stdout.isTTY && | ||
process.env.TERM && | ||
process.env.TERM !== "dumb")); | ||
const rawInit = (open, close, searchRegex, replaceValue) => s => | ||
enabled | ||
? open + | ||
(~(s += "").indexOf(close, 4) // skip opening \x1b[ | ||
? s.replace(searchRegex, replaceValue) | ||
: s) + | ||
close | ||
: s; | ||
const init = (open, close) => { | ||
return rawInit( | ||
`\x1b[${open}m`, | ||
`\x1b[${close}m`, | ||
new RegExp(`\\x1b\\[${close}m`, "g"), | ||
`\x1b[${open}m` | ||
) | ||
}; | ||
var colorette = { | ||
options: Object.defineProperty({}, "enabled", { | ||
get: () => enabled, | ||
set: value => (enabled = value) | ||
}), | ||
reset: init(0, 0), | ||
bold: rawInit("\x1b[1m", "\x1b[22m", /\x1b\[22m/g, "\x1b[22m\x1b[1m"), | ||
dim: rawInit("\x1b[2m", "\x1b[22m", /\x1b\[22m/g, "\x1b[22m\x1b[2m"), | ||
italic: init(3, 23), | ||
underline: init(4, 24), | ||
inverse: init(7, 27), | ||
hidden: init(8, 28), | ||
strikethrough: init(9, 29), | ||
black: init(30, 39), | ||
red: init(31, 39), | ||
green: init(32, 39), | ||
yellow: init(33, 39), | ||
blue: init(34, 39), | ||
magenta: init(35, 39), | ||
cyan: init(36, 39), | ||
white: init(37, 39), | ||
gray: init(90, 39), | ||
bgBlack: init(40, 49), | ||
bgRed: init(41, 49), | ||
bgGreen: init(42, 49), | ||
bgYellow: init(43, 49), | ||
bgBlue: init(44, 49), | ||
bgMagenta: init(45, 49), | ||
bgCyan: init(46, 49), | ||
bgWhite: init(47, 49), | ||
blackBright: init(90, 39), | ||
redBright: init(91, 39), | ||
greenBright: init(92, 39), | ||
yellowBright: init(93, 39), | ||
blueBright: init(94, 39), | ||
magentaBright: init(95, 39), | ||
cyanBright: init(96, 39), | ||
whiteBright: init(97, 39), | ||
bgBlackBright: init(100, 49), | ||
bgRedBright: init(101, 49), | ||
bgGreenBright: init(102, 49), | ||
bgYellowBright: init(103, 49), | ||
bgBlueBright: init(104, 49), | ||
bgMagentaBright: init(105, 49), | ||
bgCyanBright: init(106, 49), | ||
bgWhiteBright: init(107, 49) | ||
}; | ||
function handlError(error) { | ||
if (error.frame) { | ||
console.error(colorette.red(`Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`)); | ||
console.error(colorette.red(error.message)); | ||
console.error(colorette.dim(error.frame)); | ||
console.error(index.colorette.red(`Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`)); | ||
console.error(index.colorette.red(error.message)); | ||
console.error(index.colorette.dim(error.frame)); | ||
} else { | ||
console.error(colorette.red(error.stack)); | ||
console.error(index.colorette.red(error.stack)); | ||
} | ||
@@ -860,3 +785,3 @@ process.exitCode = 1; | ||
const cli = dist_1("tsup"); | ||
cli.command("<...files>", "Bundle files").option("-d, --out-dir", "Output directory", { | ||
cli.command("<...files>", "Bundle files").option("-d, --out-dir <dir>", "Output directory", { | ||
default: "dist" | ||
@@ -873,3 +798,3 @@ }).option("--format <format>", 'Bundle format, "cjs", "iife", "umd", "esm"', { | ||
const {rollup, watch} = await Promise.resolve().then(function () { return _interopNamespace(require('rollup')); }); | ||
const {createRollupConfigs} = await Promise.resolve().then(function () { return require('./index.js'); }); | ||
const {createRollupConfigs, printSizes} = await Promise.resolve().then(function () { return require('./index.js'); }); | ||
const rollupConfigs = await createRollupConfigs(files, { | ||
@@ -902,2 +827,3 @@ watch: options.watch, | ||
})); | ||
printSizes(); | ||
const endTime = Date.now(); | ||
@@ -916,3 +842,3 @@ console.log(`Done in ${endTime - startTime}ms`); | ||
const {createRollupConfigs} = await Promise.resolve().then(function () { return require('./index.js'); }); | ||
const {runCode} = await Promise.resolve().then(function () { return require('./run-464599b3.js'); }); | ||
const {runCode} = await Promise.resolve().then(function () { return require('./run-942fbd38.js'); }); | ||
const [rollupConfig] = await createRollupConfigs([file], { | ||
@@ -919,0 +845,0 @@ define: options.define, |
{ | ||
"name": "tsup", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"main": "dist/index.js", | ||
@@ -35,2 +35,3 @@ "bin": "dist/cli.js", | ||
"prettier": "^2.0.5", | ||
"pretty-bytes": "^5.3.0", | ||
"resolve": "^1.17.0", | ||
@@ -37,0 +38,0 @@ "rollup-plugin-dts": "^1.4.2", |
@@ -21,2 +21,4 @@ # tsup | ||
### Bundle files | ||
```bash | ||
@@ -26,2 +28,28 @@ tsup [...files] | ||
Files are written into `./dist`. | ||
### Generate declaration file | ||
```bash | ||
tsup index.ts --dts | ||
``` | ||
This will emit `./dist/index.js` and `./dist/index.d.ts`. | ||
### Bundle files and node modules | ||
```bash | ||
tsup [...files] --bundle | ||
``` | ||
When you're bundling a lot files, this can be 10x~200x slower than ESBuild. | ||
### Run a program | ||
```bash | ||
tsup run main.ts | ||
``` | ||
--- | ||
For more details: | ||
@@ -28,0 +56,0 @@ |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
388816
11399
61
7
1
20