當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。