<commit_before>import {task, watch, src, dest} from 'gulp';
import {ScriptTarget, ModuleKind} from 'typescript';
import * as path from 'path';

import {
  DIST_COMPONENTS_ROOT, PROJECT_ROOT, COMPONENTS_DIR, HTML_MINIFIER_OPTIONS, LICENSE_BANNER
} from '../constants';
import {
  sassBuildTask, tsBuildTask, execNodeTask, sequenceTask,
  triggerLivereload
} from '../util/task_helpers';

// There are no type definitions available for these imports.
const inlineResources = require('../../../scripts/release/inline-resources');
const gulpRollup = require('gulp-better-rollup');
const gulpMinifyHtml = require('gulp-htmlmin');
const gulpIf = require('gulp-if');

/** Path to tsconfig file for the components. */
const tsconfigPath = path.join(COMPONENTS_DIR, 'tsconfig.json');

/** Asset files to be added to the components output. */
const assetFiles = [
  path.join(COMPONENTS_DIR, '**/*.html'),
  path.join(COMPONENTS_DIR, 'package.json'),
  path.join(PROJECT_ROOT, 'README.md'),
  path.join(PROJECT_ROOT, 'LICENSE'),
];

/** Builds components to UMD bundle. */
task('build:components', [':build:components:bundle:umd']);

/** Builds components for Angular Material releases */
task(':build:components:release', sequenceTask(
  ':build:components:bundle:umd',
  ':build:components:bundle:esm',
  ':build:components:ngc'
));

/** Builds components typescript in ES5, ES6 target. For specs Karma needs CJS output. */
task(':build:components:ts:es5', tsBuildTask(tsconfigPath, { target: ScriptTarget.ES5 }));
task(':build:components:ts:es6', tsBuildTask(tsconfigPath, { target: ScriptTarget.ES6 }));
task(':build:components:ts:spec', tsBuildTask(tsconfigPath, {
  target: ScriptTarget.ES5, module: ModuleKind.CommonJS
}));

/** Tasks to create a UMD or ES bundle */
task(':build:components:bundle:umd', sequenceTask(
  ':build:components:ts:es5', ':build:components:inline', ':build:components:rollup:umd'
));

task(':build:components:bundle:esm', sequenceTask(
  ':build:components:ts:es6', ':build:components:inline', ':build:components:rollup:esm'
));

/** Copies all component assets to the build output. */
task(':build:components:assets', () => {
  return src(assetFiles)
    .pipe(gulpIf(/.html$/, gulpMinifyHtml(HTML_MINIFIER_OPTIONS)))
    .pipe(dest(DIST_COMPONENTS_ROOT));<commit_msg>build(components): update TypeScript ScriptTarget option (#3663)<commit_after>import {task, watch, src, dest} from 'gulp';
import {ScriptTarget, ModuleKind} from 'typescript';
import * as path from 'path';

import {
  DIST_COMPONENTS_ROOT, PROJECT_ROOT, COMPONENTS_DIR, HTML_MINIFIER_OPTIONS, LICENSE_BANNER
} from '../constants';
import {
  sassBuildTask, tsBuildTask, execNodeTask, sequenceTask,
  triggerLivereload
} from '../util/task_helpers';

// There are no type definitions available for these imports.
const inlineResources = require('../../../scripts/release/inline-resources');
const gulpRollup = require('gulp-better-rollup');
const gulpMinifyHtml = require('gulp-htmlmin');
const gulpIf = require('gulp-if');

/** Path to tsconfig file for the components. */
const tsconfigPath = path.join(COMPONENTS_DIR, 'tsconfig.json');

/** Asset files to be added to the components output. */
const assetFiles = [
  path.join(COMPONENTS_DIR, '**/*.html'),
  path.join(COMPONENTS_DIR, 'package.json'),
  path.join(PROJECT_ROOT, 'README.md'),
  path.join(PROJECT_ROOT, 'LICENSE'),
];

/** Builds components to UMD bundle. */
task('build:components', [':build:components:bundle:umd']);

/** Builds components for Angular Material releases */
task(':build:components:release', sequenceTask(
  ':build:components:bundle:umd',
  ':build:components:bundle:esm',
  ':build:components:ngc'
));

/** Builds components typescript in ES5, ES6 target. For specs Karma needs CJS output. */
task(':build:components:ts:es5', tsBuildTask(tsconfigPath, { target: ScriptTarget.ES5 }));
task(':build:components:ts:es6', tsBuildTask(tsconfigPath, { target: ScriptTarget.ES2015 }));
task(':build:components:ts:spec', tsBuildTask(tsconfigPath, {
  target: ScriptTarget.ES5, module: ModuleKind.CommonJS
}));

/** Tasks to create a UMD or ES bundle */
task(':build:components:bundle:umd', sequenceTask(
  ':build:components:ts:es5', ':build:components:inline', ':build:components:rollup:umd'
));

task(':build:components:bundle:esm', sequenceTask(
  ':build:components:ts:es6', ':build:components:inline', ':build:components:rollup:esm'
));

/** Copies all component assets to the build output. */
task(':build:components:assets', () => {
  return src(assetFiles)
    .pipe(gulpIf(/.html$/, gulpMinifyHtml(HTML_MINIFIER_OPTIONS)))
    .pipe(dest(DIST_COMPONENTS_ROOT));
{'fraction_non_alphanumeric': 0.16163793103448276, 'fraction_numerical': 0.005387931034482759, 'mean_word_length': 6.390127388535032, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6935764', 'n_tokens_mistral': 1530, 'n_tokens_neox': 1484, 'n_words': 326}