Package detail

mkdist

unjs765kMIT2.3.0

Lightweight file-to-file transformer

readme

mkdist

npm version npm downloads Github Actions Codecov

Lightweight file-to-file transformer

✅ Copies all assets

✅ Supports Vue Single File Components

✅ Fast and minimal transform by esbuild

.d.ts generation for .ts, .js and .vue files

✅ Support postcss (autoprefixer, cssnano and postcss-nested enabled out of the box!)

❓ Why?

Bundling libraries isn't always the best choice:

  • We lose original file structure
  • We lose modern syntax by transpiling in bundle
  • We lose critical-css by extracting css to a global dist (vue)
  • Dependencies will be always imported from bundle even if not used (a second bundling step might fix this but it usually won't happen in development and for dependencies with side-effects)

While there are tools like tsc and @babel/cli, they mostly focus on transpiling rather than keeping source level quality. Also they lack support for handling custom extensions like .vue and copying assets.

🚀 Usage

npx mkdist [rootDir] [--src=src] [--dist=dist] [--no-clean] [--pattern=glob [--pattern=more-glob]] [--format=cjs|esm] [-d|--declaration] [--ext=mjs|js|ts]

License

MIT

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

v2.3.0

compare changes

🚀 Enhancements

  • vue: Support adding relative extensions to dynamic imports (#269)
  • vue: Use vue-sfc-transformer if installed (#300)

🩹 Fixes

  • Use dynamic import pkg-types (9d6065b)

🏡 Chore

✅ Tests

  • Sort file list before snapshot (152817d)

🤖 CI

  • Force enable latest corepack (587a5e4)

❤️ Contributors

v2.2.0

compare changes

🚀 Enhancements

  • dts: Expose ts compiler errors (#278)

🩹 Fixes

  • Only add known ignore patterns by default (#279)

❤️ Contributors

v2.1.0

compare changes

🚀 Enhancements

  • Support globOptions (#266)

🩹 Fixes

  • Convert absolute gitignore patterns to relative (#265)

🏡 Chore

❤️ Contributors

  • Pooya Parsa (@pi0)

v2.0.1

compare changes

🩹 Fixes

  • vue: Conditionally import vue/compiler-sfc (c2f1a2e)

❤️ Contributors

v2.0.0

compare changes

🚀 Enhancements

  • vue: ⚠️ Refactor vue loader with vue/compiler-sfc (#251)

🩹 Fixes

  • Scan dotfiles in source paths (#253)
  • cli: Add --no-clean option (#217)

🏡 Chore

⚠️ Breaking Changes

  • vue: ⚠️ Refactor vue loader with vue/compiler-sfc (#251)

❤️ Contributors

v1.6.0

compare changes

🚀 Enhancements

💅 Refactors

  • dts: Improve internal extractDeclarations readability (#248)
  • Replace fast-glob with tinyglobby (#237)

🏡 Chore

✅ Tests

  • Add test for components/index.ts dts behavior (eb495b0)

❤️ Contributors

v1.5.9

compare changes

🩹 Fixes

  • dts: Handle dir + file of same name (#245)

❤️ Contributors

v1.5.8

compare changes

🩹 Fixes

  • dts: Resolve directory exports in .dts files (#244)

❤️ Contributors

v1.5.7

compare changes

🩹 Fixes

  • vue: Skip transpilation with multiple script blocks (#243)

❤️ Contributors

v1.5.6

compare changes

🩹 Fixes

  • dts: Compatible with vue-tsc 2.0.x (#242)

❤️ Contributors

v1.5.5

compare changes

🩹 Fixes

  • dts: Update for compatibility with vue-tsc >=2.1 (#240)

❤️ Contributors

v1.5.4

compare changes

💅 Refactors

  • Replace fs-extra with node:fs/promises (#231)
  • Replace globby w/ fast-glob (#230)

🏡 Chore

  • Update deps (3515d36)
  • Remove unused mri dependency (d43b142)
  • Remove unused globby dependency` (eb1f556)

❤️ Contributors

v1.5.3

compare changes

🩹 Fixes

  • dts: Use ts.convertCompilerOptionsFromJson to normalise (#224)

🏡 Chore

❤️ Contributors

v1.5.2

compare changes

🩹 Fixes

  • Upgrade volar implementation (#222)

🏡 Chore

  • release: V1.5.1 (b4c0a82)
  • Bump all dependencies (#221)

❤️ Contributors

v1.5.1

compare changes

🩹 Fixes

  • Dynamically import typescript when normalising options (b8afd50)

❤️ Contributors

v1.5.0

compare changes

🚀 Enhancements

  • Use vue-tsc generate vue declarations (#154)
  • Support vue-tsc v2 (#201)
  • Support custom typescript compilerOptions (#215)

🩹 Fixes

  • De-default typescript import (c518477)
  • Log errors emitting declarations (1fb5a74)

🏡 Chore

🎨 Styles

🤖 CI

❤️ Contributors

v1.4.0

compare changes

🚀 Enhancements

  • Support postcss loader (#167)

🩹 Fixes

  • cjs: Hotfix babel transformation issue (94444df)
  • Resolve dynamic import paths (#165)
  • Pass all options to loader context (ea5ba97)

🌊 Types

  • Add cjs, mts and cts to the supported extensions (e7d3ffb)

🏡 Chore

❤️ Contributors

v1.3.1

compare changes

🩹 Fixes

  • cjs: Hotfix babel transformation issue (94444df)

🏡 Chore

🤖 CI

  • Use conventional commit for autofix (2e20d10)

❤️ Contributors

v1.3.0

compare changes

🚀 Enhancements

  • Allow passing esbuild transform options (#144)
  • Support jsx and tsx files (#71)
  • Support configurable loaders (#152)
  • cli: Support --minify and --target (84c59aa)

🩹 Fixes

  • Handle .cts and .mts as typescript (#162)

💅 Refactors

  • cli: Migrate to unjs/citty (#157)

🏡 Chore

❤️ Contributors

v1.2.0

compare changes

🚀 Enhancements

  • Add support for relativising type exports (#135)
  • Add support for relativising type exports (#140)

🏡 Chore

❤️ Contributors

v1.1.2

compare changes

🩹 Fixes

  • Add .js extension for relative import and exports in declarations (#134)

❤️ Contributors

v1.1.1

compare changes

🩹 Fixes

  • Add support for multi-line import extension normalization (#120)

🏡 Chore

❤️ Contributors

1.1.0 (2023-01-10)

Features

Bug Fixes

  • ensure sass output file has css extension (#111) (ea0c57c)

1.0.0 (2022-11-15)

0.4.1 (2022-11-15)

0.4.0 (2022-10-27)

⚠ BREAKING CHANGES

  • upgrade globby

Features

  • support multiple glob patterns (#41) (b339163)
  • vue: support transpilation of <style> blocks with sass (#27) (36e5b4f)

Bug Fixes

0.3.13 (2022-06-23)

Bug Fixes

  • dts: introp default for typescript import (5578a7c)

0.3.12 (2022-06-23)

0.3.11 (2022-06-23)

Features

  • resolve full path to cjs cunks (df2a548)

Bug Fixes

  • downgrade pathe to 0.2.x (659f7e9)

0.3.10 (2022-02-04)

Bug Fixes

  • support emitting .d.mts for .mjs files (#26) (3f21784)

0.3.9 (2022-01-21)

Features

0.3.8 (2021-12-14)

Bug Fixes

0.3.7 (2021-12-13)

Bug Fixes

0.3.6 (2021-12-10)

Bug Fixes

  • multiline regex to replace import extensions (#17) (7a2690c)
  • vue: skip transforming for <script setup> (#15) (93cb489), closes #14

0.3.5 (2021-10-20)

Bug Fixes

  • pkg: remove vue-template-compiler as dep (#13) (8094c43)

0.3.4 (2021-10-13)

Bug Fixes

  • handle script tags with attributes (#12) (19f9d5d)

0.3.3 (2021-07-15)

Bug Fixes

  • avoid overriding files with original extension (resolves #11) (bb59350)

0.3.2 (2021-06-16)

0.3.1 (2021-05-24)

Bug Fixes

  • use default export with cjs transform (68e1ed1)

0.3.0 (2021-05-24)

⚠ BREAKING CHANGES

  • resolve relative imports for mjs files (resolves #7)

Features

  • resolve relative imports for mjs files (resolves #7) (86b6175)

0.2.1 (2021-04-23)

Features

0.2.0 (2021-04-21)

⚠ BREAKING CHANGES

  • emit .mjs files whn format is mjs

Features

  • emit .mjs files whn format is mjs (ec5fcc4)

0.1.7 (2021-04-14)

0.1.6 (2021-04-09)

Bug Fixes

  • update esbuild to use transform directly (9b56d1c)

0.1.5 (2021-04-08)

Features

0.1.4 (2021-04-07)

Features

  • support cleanDist option (f613c17)

0.1.3 (2021-03-30)

Bug Fixes

  • unlink before cleaning up dist dir (c8cb2b8)

0.1.2 (2021-03-06)

0.1.1 (2021-01-17)

Bug Fixes

0.1.0 (2021-01-17)

Bug Fixes

0.0.5 (2021-01-15)

Bug Fixes

0.0.4 (2021-01-15)

Bug Fixes

0.0.3 (2021-01-14)

0.0.2 (2021-01-14)

Features

  • support format option (c70f54e)
  • cli: support src, dist and help arguments (5f3606d)

0.0.1 (2021-01-14)