See TSBunch for the successor
Deprecated --📦 Minipack_TS
A VERY simple bundler designed to bundle TypeScript without compiling it into JS (Multiple .ts -> Single .ts)
Introduction
There are plenty of TypeScript bundlers out there but none that don't also compile TypeScript into regular JS. This bundler seeks to rectify that by providing a very simple way to concatenate multiple TypeScript modules into one TypeScript file.
The impetus behind this was to allow TypeScript projects composed of multiple modules to be uploaded to CodinGame (which only accepts single flat files) either by hand or by using the CodinGame Sync App WITHOUT converting those TypeScript files to JavaScript in the process.
Usage
Installing:
$ npm install --save-dev minipack_ts
minipack(entryFilePath, [outputFilePath], [declarationsFile(s)])
- entryFilePath: String file path of the bundle entry file
- outputFilePath: (Optional) Name of output file, will default to
out.ts
- declarationsFile(s): (Optional) Single or array of string file paths to files which will placed at the top of the output file 'outside' of the bundle
Create a file with the following in it:
const minipack = require('minipack_ts');
minipack('path/to/entryFile.ts', 'path/to/outputFile.ts', 'path/to/declarationsFile.d.ts');
Finally run that file with:
$ node file.js
Caveats
This bundler is VERY basic so only the following module expressions are supported:
import defaultExport from 'path'
import { export1 } from 'path'
import { export1, export2 } from 'path'
export default expression
export default function(){}
export let/var/const/enum name
export let/var/const/enum name = expression
This will also not resolve any circular dependencies.
Scripts
npm run build
: applies Babelnpm run test
: runs all testsnpm run testWatch
: runs all tests in watch mode
Todo/Future Improvements
- Use
tsconfig.json
for file import
Notes
- Example of usage can be found here
Credits
- Forked from minipack, originally created by Ronen Amiel
- Typescript dependency checking heavily inspired from detective-typescript
Available for Hire
I'm available for freelance, contracts, and consulting both remotely and in the Hudson Valley, NY (USA) area. Some more about me and what I can do for you.
Feel free to drop me a message at:
hi [a+] zweisolutions {●} com