Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: egoist/tsup
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.5.0
Choose a base ref
...
head repository: egoist/tsup
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.6.0
Choose a head ref
  • 16 commits
  • 20 files changed
  • 12 contributors

Commits on Dec 26, 2022

  1. fix: clean d.ts files if "dts" option is false (#747)

    Co-authored-by: EGOIST <0x142857@gmail.com>
    gavinsharp and egoist authored Dec 26, 2022
    Copy the full SHA
    b107de0 View commit details
  2. Copy the full SHA
    78432e2 View commit details
  3. Copy the full SHA
    8094cef View commit details
  4. Copy the full SHA
    4cb1bc2 View commit details
  5. feat: Provide JSON Schema (#763)

    * inform about schema store in docs
    
    * json schema store for tsup
    
    * provide store to files
    
    * schema composition for tsup.config.json
    
    Brings support for both package.json "tsup" property and "tsup.config.json" files. In addition, array configuration types are now supported, allowing for multiple configuration exports.
    
    * update documentation
    
    * align validators
    
    prevent the schema from revalidating the package.json
    
    * minor edits to code sample
    
    fixes semi and does not use plural on heading
    panoply authored Dec 26, 2022
    Copy the full SHA
    31b2e72 View commit details

Commits on Feb 7, 2023

  1. feat: Minify with terser (#789)

    closes #742
    PuruVJ authored Feb 7, 2023
    Copy the full SHA
    fdd4dfa View commit details
  2. feat: Bump esbuild 0.15 -> 0.16 (#805)

    Co-authored-by: EGOIST <hi@egoist.sh>
    amitdahan and EGOIST authored Feb 7, 2023
    Copy the full SHA
    904e07a View commit details
  3. chore: update lockfile

    egoist committed Feb 7, 2023
    Copy the full SHA
    eb23bd7 View commit details
  4. Copy the full SHA
    14ad4bd View commit details
  5. feat: update rollup-plugin-dts to support custom tsconfig and preserv…

    …e export {} for file that have no exports (#807)
    
    Co-authored-by: EGOIST <hi@egoist.dev>
    close #762
    close #791
    await-ovo authored Feb 7, 2023
    Copy the full SHA
    4154e05 View commit details
  6. Copy the full SHA
    398ae15 View commit details
  7. Copy the full SHA
    5780788 View commit details
  8. chore: cleanup

    incremental mode is not actually used
    egoist committed Feb 7, 2023
    Copy the full SHA
    85e01ad View commit details
  9. chore: update target type

    egoist committed Feb 7, 2023
    Copy the full SHA
    df6d1de View commit details
  10. Copy the full SHA
    2e73ca9 View commit details
  11. 1
    Copy the full SHA
    30ff79d View commit details
Showing with 1,921 additions and 180 deletions.
  1. +1 −1 .github/workflows/ci.yml
  2. +2 −1 .gitignore
  3. +32 −1 docs/README.md
  4. +9 −6 package.json
  5. +722 −125 pnpm-lock.yaml
  6. +352 −0 schema.json
  7. +1 −1 src/cli-main.ts
  8. +1 −2 src/esbuild/index.ts
  9. +8 −7 src/esbuild/postcss.ts
  10. +19 −1 src/index.ts
  11. +28 −12 src/log.ts
  12. +40 −4 src/options.ts
  13. +67 −0 src/plugins/terser.ts
  14. +1 −0 src/plugins/tree-shaking.ts
  15. +1 −0 src/rollup.ts
  16. +4 −0 test/__snapshots__/index.test.ts.snap
  17. +112 −10 test/index.test.ts
  18. +5 −0 test/package.json
  19. +516 −8 test/pnpm-lock.yaml
  20. +0 −1 types.d.ts
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 18.x
- name: Cache ~/.pnpm-store
uses: actions/cache@v2
env:
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
*.log
dist
.cache
.cache
playground
33 changes: 32 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -134,6 +134,27 @@ The `options` here is derived from CLI flags.
}
```

#### JSON Schema Store

Developers who are using [vscode](https://code.visualstudio.com/) or text editor which supports the JSON Language Server can leverage the [tsup schema store](https://unpkg.com/tsup/schema.json) via CDN. This schema store will provide intellisense capabilities such as completions, validations and descriptions within JSON file configurations like the `tsup.config.json` and `package.json` (tsup) property.

Provide the following configuration in your `.vscode/settings.json` (or global) settings file:

```json
{
"json.schemas": [
{
"url": "https://unpkg.com/tsup/schema.json",
"fileMatch": [
"package.json",
"tsup.config.json"
]
}
]
}
```


### Multiple entrypoints

Beside using positional arguments `tsup [...files]` to specify multiple entrypoints, you can also use the cli flag `--entry`:
@@ -323,7 +344,7 @@ tsup src/index.ts --env.NODE_ENV production
### Building CLI app
When an entry file like `src/cli.ts` contains hashbang like `#!/bin/env node` tsup will automatically make the outout file executable, so you don't have to run `chmod +x dist/cli.js`.
When an entry file like `src/cli.ts` contains hashbang like `#!/bin/env node` tsup will automatically make the output file executable, so you don't have to run `chmod +x dist/cli.js`.
### Watch mode
@@ -388,6 +409,16 @@ You can also minify the output, resulting into lower bundle sizes by using the `
tsup src/index.ts --minify
```

To use [Terser](https://github.com/terser/terser) instead of esbuild for minification, pass terser as argument value

```bash
tsup src/index.ts --minify terser
```

> NOTE: You must have terser installed. Install it with `npm install -D terser`
In `tsup.config.js`, you can pass `terserOptions` which will be passed to `terser.minify` as it is.

### Custom loader

Esbuild loader list:
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -10,10 +10,12 @@
"types": "dist/index.d.ts",
"files": [
"/dist",
"/assets"
"/assets",
"/schema.json"
],
"author": "EGOIST",
"license": "MIT",
"homepage": "https://tsup.egoist.dev/",
"repository": {
"url": "https://github.com/egoist/tsup.git"
},
@@ -26,11 +28,11 @@
"build-fast": "npm run build -- --no-dts"
},
"dependencies": {
"bundle-require": "^3.1.2",
"bundle-require": "^4.0.0",
"cac": "^6.7.12",
"chokidar": "^3.5.1",
"debug": "^4.3.1",
"esbuild": "^0.15.1",
"esbuild": "^0.17.6",
"execa": "^5.0.0",
"globby": "^11.0.3",
"joycon": "^3.0.1",
@@ -57,15 +59,16 @@
"postcss-simple-vars": "6.0.3",
"prettier": "2.5.1",
"resolve": "1.20.0",
"rollup-plugin-dts": "5.0.0",
"rollup-plugin-dts": "5.1.0",
"rollup-plugin-hashbang": "2.2.2",
"strip-json-comments": "4.0.0",
"svelte": "3.46.4",
"terser": "^5.16.0",
"ts-essentials": "9.1.2",
"tsconfig-paths": "3.12.0",
"tsup": "6.4.0",
"typescript": "4.6.3",
"vitest": "0.21.1",
"typescript": "4.9.5",
"vitest": "0.28.4",
"wait-for-expect": "3.0.2"
},
"peerDependencies": {
Loading