Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
gulp-typescript
Advanced tools
gulp-typescript is a TypeScript compiler for gulp, a toolkit that helps automate time-consuming tasks in your development workflow. It allows you to integrate TypeScript compilation into your gulp build process, providing a seamless way to compile TypeScript files into JavaScript.
Basic Compilation
This feature allows you to compile TypeScript files into JavaScript. The code sample demonstrates how to set up a basic gulp task to compile TypeScript files using a tsconfig.json configuration file.
const gulp = require('gulp');
const ts = require('gulp-typescript');
const tsProject = ts.createProject('tsconfig.json');
gulp.task('scripts', function () {
return tsProject.src()
.pipe(tsProject())
.js.pipe(gulp.dest('dist'));
});
Incremental Compilation
This feature enables incremental compilation, which can significantly speed up the build process by only recompiling files that have changed. The code sample shows how to enable incremental compilation by setting the 'incremental' option to true.
const gulp = require('gulp');
const ts = require('gulp-typescript');
const tsProject = ts.createProject('tsconfig.json', { incremental: true });
gulp.task('scripts', function () {
return tsProject.src()
.pipe(tsProject())
.js.pipe(gulp.dest('dist'));
});
Source Maps
This feature allows you to generate source maps for your TypeScript files, which can be very useful for debugging. The code sample demonstrates how to integrate source map generation into your gulp task.
const gulp = require('gulp');
const ts = require('gulp-typescript');
const sourcemaps = require('gulp-sourcemaps');
const tsProject = ts.createProject('tsconfig.json');
gulp.task('scripts', function () {
return tsProject.src()
.pipe(sourcemaps.init())
.pipe(tsProject())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
});
The 'typescript' package is the official TypeScript compiler. It can be used directly via the command line or integrated into build tools like Webpack or Rollup. Unlike gulp-typescript, it does not provide built-in support for gulp, so additional configuration is needed to use it in a gulp workflow.
ts-loader is a TypeScript loader for Webpack. It allows you to compile TypeScript files within a Webpack build process. While it offers similar functionality to gulp-typescript, it is specifically designed for use with Webpack rather than gulp.
awesome-typescript-loader is another TypeScript loader for Webpack. It is known for its performance optimizations and additional features like caching. Similar to ts-loader, it is intended for use with Webpack and not gulp.
Compile TypeScript
Issues with the output should be reported on the TypeScript issue tracker.
npm install --save-dev gulp-typescript
var gulp = require('gulp');
var typescript = require('gulp-typescript');
gulp.task('default', function () {
gulp.src('app.ts')
.pipe(typescript())
.pipe(gulp.dest('dist'));
});
MIT © Sindre Sorhus
FAQs
A typescript compiler for gulp with incremental compilation support.
The npm package gulp-typescript receives a total of 167,438 weekly downloads. As such, gulp-typescript popularity was classified as popular.
We found that gulp-typescript demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.