Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function (context, opts = {}) {
return {
presets: [
opts.es2015 !== false && [presetES2015.buildPreset, opts.es2015],
opts.es2016 !== false && presetES2016,
opts.es2017 !== false && presetES2017
].filter(Boolean) // filter out falsy values
};
}
* http://polymer.github.io/PATENTS.txt
*/
import {transform as babelTransform, TransformOptions as BabelTransformOptions} from 'babel-core';
import * as cssSlam from 'css-slam';
import * as gulpif from 'gulp-if';
import {minify as htmlMinify, Options as HTMLMinifierOptions} from 'html-minifier';
import * as logging from 'plylog';
import {Transform} from 'stream';
import * as vinyl from 'vinyl';
import matcher = require('matcher');
const babelPresetES2015 = require('babel-preset-es2015');
const minifyPreset = require('babel-preset-minify');
const babelPresetES2015NoModules =
babelPresetES2015.buildPreset({}, {modules: false});
const externalHelpersPlugin = require('babel-plugin-external-helpers');
const babelObjectRestSpreadPlugin =
require('babel-plugin-transform-object-rest-spread');
const babelPluginSyntaxDynamicImport =
require('babel-plugin-syntax-dynamic-import');
const babelPluginSyntaxObjectRestSpread =
require('babel-plugin-syntax-object-rest-spread');
// TODO(fks) 09-22-2016: Latest npm type declaration resolves to a non-module
// entity. Upgrade to proper JS import once compatible .d.ts file is released,
// or consider writing a custom declaration in the `custom_typings/` folder.
import File = require('vinyl');
const logger = logging.getLogger('cli.build.optimize-streams');
export type FileCB = (error?: any, file?: File) => void;
const del = require('del');
const gulp = require('gulp');
const gulpif = require('gulp-if');
const gulpdebug = require('gulp-debug');
const gulpHelp = require('gulp-help')(gulp);
const gulpfilter = require('gulp-filter');
const mergeStream = require('merge-stream');
const polymerBuild = require('polymer-build');
const babel = require('gulp-babel');
const babelPresetES2015 = require('babel-preset-es2015');
const babiliPreset = require('babel-preset-babili');
const babelPresetES2015NoModules = babelPresetES2015.buildPreset({}, {modules: false});
const cssSlam = require('css-slam').gulp;
const htmlMinifier = require('gulp-html-minifier');
const polymerJson = require('./polymer.json');
const buildRoot = 'build';
const debug = false;
// Waits for the given ReadableStream
function waitFor(stream) {
return new Promise((resolve, reject) => {
stream.on('end', resolve);
stream.on('error', reject);
});
}
// @ts-ignore
const minifyPreset = require('babel-preset-minify');
// @ts-ignore
const presetEs3 = require('babel-preset-es3');
const htmlMinifier = require('html-minifier');
const mergeStream = require('merge-stream');
const ProgressBar = require('progress');
const babelCore = require('babel-core');
const dest = require('vinyl-fs').dest;
// @ts-ignore
const cssSlam = require('css-slam');
const gulpif = require('gulp-if');
const stream = require('stream');
const path = require('path');
const babelTransform = babelCore.transform;
const es2015Preset = babelPreset2015.buildPreset({}, {
modules: false
});
function pipeStreams(streams) {
return Array.prototype.concat.apply([], streams)
.filter(val => val !== null)
.reduce((a, b) => {
return a.pipe(b);
});
}
class GenericOptimizeTransform extends stream.Transform {
constructor(optimizerName, optimizer, optimizerOptions) {
super({objectMode: true});
const externalHelpers = require('babel-plugin-external-helpers');
const babelPreset2015 = require('babel-preset-es2015');
const minifyPreset = require('babel-preset-minify');
const presetEs3 = require('babel-preset-es3');
import * as htmlMinifier from 'html-minifier';
import * as babelCore from 'babel-core';
import mergeStream from 'merge-stream';
import ProgressBar from 'progress';
import * as stream from 'stream';
import { dest } from 'vinyl-fs';
import cssSlam from 'css-slam';
import * as path from 'path';
import gulpif from 'gulp-if';
const babelTransform = babelCore.transform;
const es2015Preset = babelPreset2015.buildPreset({}, {
modules: false
});
function pipeStreams(streams: (NodeJS.ReadWriteStream|NodeJS.ReadWriteStream[])[]): NodeJS.ReadWriteStream {
return Array.prototype.concat.apply([], streams)
.filter((val: any) => val !== null)
.reduce((a: NodeJS.ReadWriteStream, b: NodeJS.ReadWriteStream) => {
return a.pipe(b);
});
}
interface StreamFile {
path: string;
contents: Buffer;
}