当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript merge2.default函数代码示例

本文整理汇总了TypeScript中merge2.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

/**
 * Compiles source files with Webpack into the dist folder.
 */
export default function (settings: IGulpSettings): any {
    "use strict";

    const merge = require("merge2");
    const rename = require("gulp-rename");
    const sourcemaps = require("gulp-sourcemaps");
    const uglify = require("gulp-uglify");
    const webpack = require("webpack-stream");

    const entriesAndSources: IEntry[] = getEntriesAndSources(settings.packageSchema.shenanigans);
    const externals = getExternals(settings.packageSchema.shenanigans);
    const streams = entriesAndSources.map(({ entry, name, sources }: IEntry): any =>
        settings.gulp
            .src(sources)
            .pipe(sourcemaps.init())
            .pipe(webpack({
                entry,
                externals,
                output: {
                    library: name,
                    libraryTarget: "amd"
                }
            }))
            .pipe(rename(`${name}.js`))
            .pipe(uglify())
            .pipe(sourcemaps.write("."))
            .pipe(settings.gulp.dest(Constants.folders.dist)));

    return merge(streams);
}
开发者ID:FullScreenShenanigans,项目名称:gulp-shenanigans,代码行数:33,代码来源:webpack.ts

示例2: merge

gulp.task("compile", function() {
	var tsResult = tsProject.src()
		.pipe(sourcemaps.init())
		.pipe(ts(tsProject));
	
	var dts = tsResult.dts
		.pipe(insert.transform(function(contents: string, file: any) {
			contents = contents.replace(/\/\/\/\s*\<reference path=".*"\s*\/\>\s*\n/ig, "");
			contents += "declare module \"updraft\" {\n" +
									"	export = Updraft;\n" +
									"}\n";
			return contents;
		}));
	
	dts = tsResult.dts.pipe(gulp.dest("./"));
	
	var js = tsResult.js;
	
	js = js.pipe(insert.transform(function(contents: string, file: any) {
		contents = contents.replace(/(Updraft = {})/g, "/* istanbul ignore next */ $1");
		contents = contents.replace(/(var _a(,|;))/g, "/* istanbul ignore next */ $1");
		return contents;
	}));
	

	if(minify) {
		js = js.pipe(uglify());
	}
	
	js = js
		.pipe(sourcemaps.write("./"))
		.pipe(gulp.dest("./"));

	return merge([dts, js]);
});
开发者ID:arolson101,项目名称:updraft,代码行数:35,代码来源:Gulpfile.ts

示例3: error

gulp.task("scripts:ts", () => {
  let n_errors = 0

  function error(err: {message: string}) {
    gutil.log(err.message)
    n_errors++
  }

  const project = ts.createProject(join(paths.src_dir.coffee, "tsconfig.json"))
  const compiler = project
    .src()
    .pipe(sourcemaps.init())
    .pipe(project(ts.reporter.nullReporter()).on("error", error))

  const result = merge([
    compiler.js
      .pipe(sourcemaps.write("."))
      .pipe(gulp.dest(paths.build_dir.tree)),
    compiler.dts
      .pipe(gulp.dest(paths.build_dir.types)),
  ])

  result.on("finish", function() {
    if (argv.emitError && n_errors > 0) {
      gutil.log(`There were ${chalk.red("" + n_errors)} TypeScript errors.`)
      process.exit(1)
    }
  })

  return result
})
开发者ID:Zyell,项目名称:bokeh,代码行数:31,代码来源:scripts.ts

示例4: merge

  gulp.task('tsc:jasmineHelper', () => {

    var tsResult = gulp.src(env.path.jasmine.helpers)
      .pipe(sourcemaps.init())
      .pipe(ts(tsConf));

    return merge([
      tsResult.dts.pipe(gulp.dest(`${env.dir.jasmine}`)),
      tsResult.js.pipe(sourcemaps.write()).pipe(gulp.dest(env.dir.tmpJasmine)),
    ]);
  });
开发者ID:MSakamaki,项目名称:rxjs-handson,代码行数:11,代码来源:typescript.ts

示例5: error

gulp.task("scripts:tsjs", ["scripts:coffee", "scripts:js", "scripts:ts"], () => {
  function error(err: {message: string}) {
    const raw = stripAnsi(err.message)
    const result = raw.match(/(.*)(\(\d+,\d+\): error TS(\d+):.*)/)

    if (result != null) {
      const [, file, rest, code] = result
      const real = path.join('src', 'coffee', ...file.split(path.sep).slice(3))
      if (fs.existsSync(real)) {
        gutil.log(`${chalk.red(real)}${rest}`)
        return
      }

      // XXX: can't enable "6133", because CS generates faulty code for closures
      if (["2307", "2688", "6053"].indexOf(code) != -1) {
        gutil.log(err.message)
        return
      }
    }

    if (!argv.ts)
      return

    if (typeof argv.ts === "string") {
      const keywords = argv.ts.split(",")
      for (let keyword of keywords) {
        let must = true
        if (keyword[0] == "^") {
          keyword = keyword.slice(1)
          must = false
        }
        const found = err.message.indexOf(keyword) != -1
        if (!((found && must) || (!found && !must)))
          return
      }
    }

    gutil.log(err.message)
  }

  const tree_ts = paths.build_dir.tree_ts
  const project = gulp
    .src(`${tree_ts}/**/*.ts`)
    .pipe(sourcemaps.init())
    .pipe(ts(tsconfig.compilerOptions, ts.reporter.nullReporter()).on('error', error))

  return merge([
    project.js
      .pipe(sourcemaps.write("."))
      .pipe(gulp.dest(paths.build_dir.tree_js)),
    project.dts
      .pipe(gulp.dest(paths.build_dir.types)),
  ])
})
开发者ID:jsalcal,项目名称:bokeh,代码行数:54,代码来源:scripts.ts

示例6: createStream

export function createStream(q: string, mask: number) {
	var services = [];
	if (issetbit(mask, EService.Bighugelabs)) services.push(new Bighugelabs(q)); 
	if (issetbit(mask, EService.Altervistaorg)) services.push(new Altervistaorg(q)); 
	if (issetbit(mask, EService.CollinsDictionary)) services.push(new CollinsDictionary(q)); 
	if (issetbit(mask, EService.Thesauruscom)) services.push(new Thesauruscom(q)); 
	if (issetbit(mask, EService.Multitran)) services.push(new Multitran(q)); 
	if (issetbit(mask, EService.Mobythesaurus)) services.push(new Mobythesaurus(q)); 
	var stream = merge2(services);
	return stream;
}
开发者ID:unlight,项目名称:thesaurus-service,代码行数:11,代码来源:main.ts

示例7:

gulp.task('build:client', ['clean'], () => {
  return merge2([
    gulp.src(clientTsTree.concat('typings/browser/ambient/**/*.ts'))
      .pipe(ts(clientTsProject))
      .pipe(gulp.dest(`${distClientRoot}/app`)),
    gulp.src(clientHtmlTree)
      .pipe(gulp.dest(distClientRoot)),
    gulp.src(`${clientRoot}/firebase.json`)
      .pipe(gulp.dest(distClientRoot)),
    gulp.src(clientVendorDeps, {base: 'node_modules'})
      .pipe(gulp.dest(`${distClientRoot}/vendor`))
  ]);
});
开发者ID:jeffbcross,项目名称:issue-zero,代码行数:13,代码来源:_gulpfile.ts

示例8: stream

export function stream(q: string) {

	var stream = merge2([
		new Bighugelabs(q),
		new Altervistaorg(q),
		new CollinsDictionary(q),
		new Thesauruscom(q),
		new Multitran(q),
		new Mobythesaurus(q)
	]);

	return stream;
};
开发者ID:unlight,项目名称:thesaurus-service,代码行数:13,代码来源:main.ts

示例9: Promise

  return new Promise((resolve, reject) => {
    // Sequentially merge the changelog output and the previous changelog stream, so that
    // the new changelog section comes before the existing versions. Afterwards, pipe into the
    // changelog file, so that the changes are reflected on file system.
    const mergedCompleteChangelog = merge2(outputStream, previousChangelogStream);

    // Wait for the previous changelog to be completely read because otherwise we would
    // read and write from the same source which causes the content to be thrown off.
    previousChangelogStream.on('end', () => {
      mergedCompleteChangelog.pipe(createWriteStream(changelogPath))
        .once('error', (error: any) => reject(error))
        .once('finish', () => resolve());
    });
  });
开发者ID:Nodarii,项目名称:material2,代码行数:14,代码来源:changelog.ts

示例10: error

gulp.task("scripts:ts", () => {
  const errors: string[] = []

  function error(err: {message: string}) {
    const text = stripAnsi(err.message)
    errors.push(text)

    const result = text.match(/(.*)(\(\d+,\d+\): error TS(\d+):.*)/)
    if (result != null) {
      const [, file, , code] = result
      if (is_partial(file)) {
        if (is_excluded(parseInt(code))) {
          if (!(argv.include && text.includes(argv.include)))
            return
        }
      }
    }

    if (argv.filter && !text.includes(argv.filter))
      return

    gutil.log(err.message)
  }

  const tsconfig = require(join(paths.src_dir.coffee, "tsconfig.json"))
  let compilerOptions = tsconfig.compilerOptions

  if (argv.es6) {
    compilerOptions.target = "ES6"
    compilerOptions.lib[0] = "es6"
  }

  const project = gulp
    .src(join(paths.src_dir.coffee, "**", "*.ts"))
    .pipe(sourcemaps.init())
    .pipe(ts(tsconfig.compilerOptions, ts.reporter.nullReporter()).on('error', error))

  const result = merge([
    project.js
      .pipe(sourcemaps.write("."))
      .pipe(gulp.dest(paths.build_dir.tree)),
    project.dts
      .pipe(gulp.dest(paths.build_dir.types)),
  ])
  result.on("finish", () => {
    fs.writeFileSync(join(paths.build_dir.js, "ts.log"), errors.join("\n"))
  })
  return result
})
开发者ID:FourtekIT-incubator,项目名称:bokeh,代码行数:49,代码来源:scripts.ts


注:本文中的merge2.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。