Git Product home page Git Product logo

tsify's Introduction

tsify

Browserify plugin for compiling TypeScript

NPM version Build status Dependency status devDependency Status peerDependency Status

example usage

On the command line:

$ browserify main.ts -p [ tsify --noImplicitAny ] > bundle.js

With the Browserify API:

browserify()
    .add('main.ts')
    .plugin('tsify', { noImplicitAny: true })
    .bundle();

installation

Just plain ol' npm installation:

npm install tsify

options

  • tsify will generate sourcemaps if the --debug option is set on Browserify.
  • tsify supports the following options from the TypeScript compiler:

--noImplicitAny

Warn on expressions and declarations with an implied any type.

--removeComments

Do not emit comments to output.

--target=version

Specify ECMAScript target version: 'ES3' (default), or 'ES5'

--stopOnError

Stop processing output when there are typing errors.

does this work with...

Watchify?

Yes! tsify can do incremental compilation using watchify, resulting in much faster incremental build times. Just follow the Watchify documentation, and add tsify as a plugin as indicated in the documentation above.

Gulp?

No problem. See the Gulp recipes on using browserify and watchify, and add tsify as a plugin as indicated in the documentation above.

Grunt?

Use grunt-browserify and you should be good! Just add tsify as a plugin in your Grunt configuration.

IE 11?

The inlined sourcemaps that Browserify generates may not be readable by IE 11 for debugging purposes. This is easy to fix by adding exorcist to your build workflow after Browserify.

why a plugin?

There are several TypeScript compilation transforms available on npm, all with various issues. The TypeScript compiler automatically performs dependency resolution on module imports, much like Browserify itself. Browserify transforms are not flexible enough to deal with multiple file outputs given a single file input, which means that any working TypeScript compilation transform either skips the resolution step (which is necessary for complete type checking) or performs multiple compilations of source files further down the dependency graph.

tsify avoids this problem by using the power of plugins to perform a single compilation of the TypeScript source up-front, using Browserify to glue together the resulting files.

license

MIT

changelog

  • 0.10.0 - Added stopOnError option and changed default behavior to continue building when there are typing errors.
  • 0.9.0 - Updated to use TypeScript from npm (thanks @hexaglow)
  • 0.8.2 - Updated peerDependency for Browserify to allow any version >= 6.x
  • 0.8.1 - Updated peerDependency for Browserify 9.x
  • 0.8.0 - Updated to TypeScript 1.4.1.
  • 0.7.1 - Updated peerDependency for Browserify 8.x
  • 0.7.0 - Updated error handling for compatibility with Watchify
  • 0.6.5 - Updated peerDependency for Browserify 7.x
  • 0.6.4 - Included richer file position information in syntax error messages.
  • 0.6.3 - Updated to TypeScript 1.3.
  • 0.6.2 - Included empty *.d.ts compiled files in bundle for Karma compatibility.
  • 0.6.1 - Fixed compilation cache miss when given absolute filenames.
  • 0.6.0 - Updated to TypeScript 1.1.
  • 0.5.2 - Bugfix for 0.5.1 for files not included with expose.
  • 0.5.1 - Handled *.d.ts files passed as entries. Fix for files included with expose.
  • 0.5.0 - Updated to Browserify 6.x.
  • 0.4.1 - Added npmignore to clean up published package.
  • 0.4.0 - Dropped Browserify 4.x support. Fixed race condition causing pathological performance with some usage patterns, e.g. when used with karma-browserify.
  • 0.3.1 - Supported adding files with bundler.add().
  • 0.3.0 - Added Browserify 5.x support.
  • 0.2.1 - Fixed paths for sources in sourcemaps.
  • 0.2.0 - Made Browserify prioritize *.ts files over *.js files in dependency resolution.
  • 0.1.4 - Handled case where the entry point is not a TypeScript file.
  • 0.1.3 - Automatically added *.ts to Browserify's list of file extensions to resolve.
  • 0.1.2 - Added sourcemap support.
  • 0.1.1 - Fixed issue where intermediate *.js files were being written to disk when using watchify.
  • 0.1.0 - Initial version.

tsify's People

Contributors

bendrucker avatar hexaglow avatar jonathantyates avatar lcorneliussen avatar nikku avatar smrq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.