Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'gulp-typescript' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
function packageDefinitions() {
console.log(global.TSDist.RootFolder + "/" + global.TSDist.DefinitionFileName);
var src = global.TSWorkspace.Files.slice(0);
// create a project specific to our typings build and specify the outFile. This will result
// in a single pnp.d.ts file being creating and piped to the typings folder
var typingsProject = tsc.createProject('tsconfig.json', { "declaration": true, "outFile": "pnp.js", "removeComments": false, "module": "system" });
return gulp.src(src)
.pipe(typingsProject())
.dts.pipe(gulp.dest(global.TSDist.RootFolder));
}
gulp.task("typescript", ["clean-scripts"], function() {
var tsProject = ts.createProject("tsconfig.json", {
typescript: require("typescript")
});
return gulp.src(["./src/**/*.ts", "!src/tests/**/resources/*.ts"])
.pipe(sourcemaps.init())
.pipe(ts(tsProject))
.pipe(replace(/(}\)\()(.*\|\|.*;)/g, '$1/* istanbul ignore next */$2'))
.pipe(replace(/(var __extends = \(this && this.__extends\))/g, '$1/* istanbul ignore next */'))
.pipe(replace(/(if \(!exports.hasOwnProperty\(p\)\))/g, '/* istanbul ignore else */ $1'))
// ignore empty constructors (for mixins and static classes)
.pipe(replace(/(function [A-Za-z]+\(\) {[\s\n\t]+})/g, '/* istanbul ignore next */ $1'))
.pipe(sourcemaps.write("./"))
.pipe(gulp.dest("./dist"));
});
gulp.task("typescript", ["clean-scripts"], function() {
var tsProject = ts.createProject("tsconfig.json", {
typescript: require("typescript")
});
return gulp.src(["./src/typings/**/*.d.ts", "./src/**/*.ts", "./ts-nameof.d.ts", "!./src/tests/definitionFileTests.ts"])
.pipe(sourcemaps.init())
.pipe(ts(tsProject))
.pipe(replace(/(}\)\()(.*\|\|.*;)/g, '$1/* istanbul ignore next */$2'))
.pipe(replace(/(var __extends = \(this && this.__extends\))/g, '$1/* istanbul ignore next */'))
.pipe(replace(/(if \(!exports.hasOwnProperty\(p\)\))/g, '/* istanbul ignore else */ $1'))
// ignore empty constructors (for mixins and static classes)
.pipe(replace(/(function [A-Za-z]+\(\) {[\s\n\t]+})/g, '/* istanbul ignore next */ $1'))
.pipe(sourcemaps.write("./"))
.pipe(gulp.dest("./dist"));
});
gulp.task('compile:ts', () => {
var ts = require('gulp-typescript'); // TypeScript compiler for gulp.js
var project = ts.createProject('./src/tsconfig.json');
var files = project.config.files.map(path => src + path);
return gulp.src(files, { base: src }).pipe(project()).pipe(gulp.dest(src));
});
function typescript(srcs = [], useSourcemaps = false) {
const tsc = require('gulp-typescript');
const sourceMaps = require('gulp-sourcemaps');
const project = tsc.createProject('tsconfig.json', {
typescript: require('typescript'),
declaration: true
});
const src = gulp.src(srcs.concat(['src/**/*', '_references.ts']));
return (() => {
if (useSourcemaps) {
return src.pipe(sourceMaps.init());
}
return src;
})()
.pipe(project());
}
gulp.task('compile', () => {
const tsResult = gulp.src(sources)
.pipe(sourcemaps.init())
.pipe(ts.createProject('tsconfig.json')())
.on('error', onError);
return merge([
tsResult.dts.pipe(gulp.dest(`${outDir}/definitions`)),
tsResult.js
.pipe(sourcemaps.write(
'.', {includeContent : false, sourceRoot : '../../src'}))
.pipe(gulp.dest(`${outDir}/src`)),
tsResult.js.pipe(gulp.dest(`${outDir}/src`))
]);
});
gulp.task('compile', ['copy-data', 'copy-package-json'], function() {
var tsResult = gulp.src(sources)
.pipe(sourcemaps.init())
.pipe(ts.createProject('tsconfig.json')())
.on('error', onError);
return merge([
tsResult.dts.pipe(gulp.dest(outDir + '/definitions')),
tsResult.js
.pipe(sourcemaps.write(
'.', {includeContent: false, sourceRoot: '../../src'}))
.pipe(gulp.dest(outDir + '/src')),
tsResult.js.pipe(gulp.dest(outDir + '/src'))
]);
});
gulp.task('tsc', function(done) {
var tsProject = ts.createProject('tsconfig.json');
const tsResults = tsProject
.src()
.pipe(sourcemaps.init())
.pipe(tsProject())
.on('error', function(err) {
done(err);
});
return merge([
tsResults.dts.pipe(gulp.dest('./build/')),
tsResults.js.pipe(sourcemaps.write('')).pipe(gulp.dest('./build')),
]);
});
gulp.task('compile:ts', () => {
var tsProject = gulpTs.createProject(TSCONFIG);
var tsResult = tsProject.src()
.pipe(sourceMap.init())
.pipe(tsProject());
return merge([
tsResult.dts,
tsResult.pipe(sourceMap.write('.'))
])
.pipe(gulp.dest(DEST));
});
gulp.task('build', ['build.lib'], function () {
var tsProject = typescript.createProject('./tsconfig.json', { typescript: require('typescript') });
var tsSrcInlined = gulp.src([webroot + '**/*.ts', 'typings/**/*.d.ts'], { base: webroot })
.pipe(inlineNg2Template({ base: webroot }));
return tsSrcInlined
.pipe(sourcemaps.init())
.pipe(typescript(tsProject))
.pipe(sourcemaps.write())
.pipe(gulp.dest(webroot));
});