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


TypeScript merge-stream.default函数代码示例

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


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

示例1: test

    test('add prefetch links for transitive deps of bundled', async () => {
      const project = new PolymerProject({
        root: 'test-fixtures/bundle-project/',
        entrypoint: 'index.html',
        fragments: ['simple-import.html'],
      });

      const files = await emittedFiles(
          mergeStream(project.sources(), project.dependencies())
              .pipe(project.bundler({inlineScripts: false}))
              .pipe(project.addPrefetchLinks()),
          project.config.root);
      const expectedFiles =
          ['index.html', 'simple-import.html', 'simple-script.js'];
      assert.deepEqual(expectedFiles, [...files.keys()].sort());

      const html = files.get('index.html')!.contents!.toString();

      // `simple-import.html` is a direct dependency, so we should not add
      // prefetch link to it.
      assert.notInclude(
          html, '<link rel="prefetch" href="/simple-import.html">');

      // `simple-import.html` has inlined `simple-import-2.html` which has an
      // external script import `simple-script.js`.  A prefetch link is added
      // for `simple-script.js` because it is a transitive dependency of the
      // `index.html`
      assert.include(html, '<link rel="prefetch" href="/simple-script.js">');
    });
开发者ID:MehdiRaash,项目名称:tools,代码行数:29,代码来源:prefetch-links_test.ts

示例2: test

    test('adds prefetch links for transitive deps of unbundled', async () => {

      const project = new PolymerProject({
        root: 'test-fixtures/bundle-project/',
        entrypoint: 'index.html',
      });

      const files = await emittedFiles(
          mergeStream(project.sources(), project.dependencies())
              .pipe(project.addPrefetchLinks()),
          project.config.root);

      const html = files.get('index.html').contents.toString();

      // No prefetch links needed for direct dependency.
      assert.notInclude(
          html, '<link rel="prefetch" href="/simple-import.html">');

      // Prefetch added for the transitive dependencies of `index.html`,
      // which are all direct dependencies of `simple-import.html`.
      assert.include(html, '<link rel="prefetch" href="/simple-script.js">');
      assert.include(html, '<link rel="prefetch" href="/simple-style.css">');
      assert.include(
          html, '<link rel="prefetch" href="/simple-import-2.html">');
    });
开发者ID:chrisekelley,项目名称:polymer-build,代码行数:25,代码来源:prefetch-links_test.ts

示例3: Error

      transform?: FileTransform) => new Promise((resolve, reject) => {
    if (projectOptions.root === undefined) {
      throw new Error('projectOptions.root is undefined');
    }
    root = projectOptions.root;
    const config = new ProjectConfig(projectOptions);
    const analyzer = new BuildAnalyzer(config);

    bundler = new BuildBundler(config, analyzer, bundlerOptions);
    bundledStream = mergeStream(analyzer.sources(), analyzer.dependencies());
    if (transform) {
      bundledStream = bundledStream.pipe(transform);
    }
    bundledStream = bundledStream.pipe(bundler);
    bundler = new BuildBundler(config, analyzer);
    files = new Map<LocalFsPath, File>();
    bundledStream.on('data', (file: File) => {
      files.set(file.path, file);
    });
    bundledStream.on('end', () => {
      resolve(files);
    });
    bundledStream.on('error', (err: Error) => {
      reject(err);
    });
  });
开发者ID:MehdiRaash,项目名称:tools,代码行数:26,代码来源:bundle_test.ts

示例4: merge

gulp.task('!build:commonjs', () => {
  const stream = gulp
    .src([
      'src/**/*.ts',
      'typings/globals/**/*.d.ts'
    ])
    .pipe(ts(commonCompilerConfig));
  return merge([
    stream.js.pipe(gulp.dest(commonCompilerConfig.outDir)),
    stream.dts.pipe(gulp.dest(commonCompilerConfig.outDir))
  ]);
});
开发者ID:Splaktar,项目名称:mobile-toolkit,代码行数:12,代码来源:gulpfile.ts

示例5: constructor

  constructor(workerPath: string, options: WorkerPoolOptions) {
    this._options = options;
    this._workers = new Array(options.numWorkers);

    if (!path.isAbsolute(workerPath)) {
      workerPath = require.resolve(workerPath);
    }

    const stdout = mergeStream();
    const stderr = mergeStream();

    const {forkOptions, maxRetries, setupArgs} = options;

    for (let i = 0; i < options.numWorkers; i++) {
      const workerOptions: WorkerOptions = {
        forkOptions,
        maxRetries,
        setupArgs,
        workerId: i,
        workerPath,
      };

      const worker = this.createWorker(workerOptions);
      const workerStdout = worker.getStdout();
      const workerStderr = worker.getStderr();

      if (workerStdout) {
        stdout.add(workerStdout);
      }

      if (workerStderr) {
        stderr.add(workerStderr);
      }

      this._workers[i] = worker;
    }

    this._stdout = stdout;
    this._stderr = stderr;
  }
开发者ID:Volune,项目名称:jest,代码行数:40,代码来源:BaseWorkerPool.ts

示例6: execute

        /**
         * Misc resources are special because a single file input may generate multiple
         * input/output configurations.
         *
         * Let's take an example. If you have a configuration like:
         *
         * misc:
         *   input: 'assets/images/**'
         *   output: 'public/images'
         *
         * This will copy every file in the 'assets/images' folder into 'public/images'.
         * But 'assets/images' may contain sub folders, and if so, they have to be kept!
         *
         * So the line "input: 'assets/images/**'" will generate as many input/output configurations
         * as there are sub folders when resolving the glob.
         *
         * It's a bit ugly but the fastest way to handle this without restructuring the whole GulpTask class is
         * to create sub tasks for each sub input/output pair.
         *
         * This method does exactly that.
         *
         * When a file generates a sub task, it is removed from the current task's input.
         */
        public execute(): any {
            let subTasks: GulpTask[] = [];
            let originalInputs: any = [];

            for (let i = 0; i < this.configuration.input.length; ++i) {
                for (let j = 0; j < this.configuration.input[i].files.length; ++j) {
                    let path = this.configuration.input[i].files[j];
                    if (path.isGlob && path.globBase) {
                        let indexed: {[key: string]: PackageInputOutputConfiguration} = {};
                        let files: string[] = globby.sync(path.absolute);
                        for (let k = 0; k < files.length; ++k) {
                            if (!FileSystem.isDirectory(files[k])) {
                                let relativeDir = FileSystem.getDirectoryName(files[k]).substring(path.globBase.length);
                                if (!Utils.isSet(indexed[relativeDir])) {
                                    let newInput = Utils.clone(this.configuration.input[i]);
                                    let newOutput = Utils.clone(this.configuration.output);

                                    newInput.files = [];
                                    newOutput.dev.absolute += relativeDir;
                                    newOutput.prod.absolute += relativeDir;
                                    indexed[relativeDir] = {watch: [], input: [newInput], output: newOutput};
                                }
                                indexed[relativeDir].input[0].files.push({
                                    packageId: path.packageId,
                                    original: files[k],
                                    absolute: files[k],
                                    extension: FileSystem.getExtension(files[k]),
                                    isGlob: false,
                                    globBase: ''
                                });
                            }
                        }
                        for (let p in indexed) {
                            if (indexed.hasOwnProperty(p)) {
                                subTasks.push(new MiscTask(this.gulpfile, this.packageName, indexed[p], this.processorsManager));
                            }
                        }
                        originalInputs.push(Utils.clone(this.configuration.input[i]));
                        this.configuration.input[i].files.splice(j--, 1);
                    }
                }
            }
            let stream: any = super.execute();
            this.configuration.input = originalInputs;
            for (let i = 0; i < subTasks.length; ++i) {
                const nextStream: any = subTasks[i].execute();
                if (nextStream !== null) {
                    stream = (stream !== null) ? merge(stream, nextStream) : nextStream;
                }
            }
            return stream;
        }
开发者ID:Stnaire,项目名称:gulp-yaml-packages,代码行数:75,代码来源:MiscTask.ts

示例7: merge

gulp.task('task:worker:compile_system', () => {
  const stream = gulp
    .src([
      'src/worker/**/*.ts',
      'src/typings/**/*.d.ts',
      'typings/globals/**/*.d.ts'
    ])
    .pipe(ts(systemCompilerConfig));
  return merge([
    stream.js.pipe(gulp.dest(systemCompilerConfig.outDir)),
    stream.dts.pipe(gulp.dest(systemCompilerConfig.outDir))
  ]);
});
开发者ID:iller7,项目名称:mobile-toolkit-ng,代码行数:13,代码来源:gulpfile.ts

示例8: merge

gulp.task('task:companion:compile', () => {
  const stream = gulp
    .src([
      'src/companion/**/*.ts',
      'src/typings/**/*.d.ts',
      'typings/globals/**/*.d.ts',
      'typings/modules/**/*.d.ts'
    ])
    .pipe(ts(commonCompilerConfig));
  return merge([
    stream.js.pipe(gulp.dest(commonCompilerConfig.outDir)),
    stream.dts.pipe(gulp.dest(commonCompilerConfig.outDir))
  ]);
});
开发者ID:SuperSoe,项目名称:mobile-toolkit,代码行数:14,代码来源:gulpfile.ts

示例9: merge

gulp.task('production:scripts:compile', () => {
  const tsProject = typescript.createProject(paths.typescript.baseConfig, config.typescript);
  const typings = gulp.src(paths.typings);
  const scripts = gulp.src([
    paths.sources.scripts,
    '!' + paths.scripts.tests.unit,
    '!' + paths.scripts.tests.e2e
  ]);

  return merge(typings, scripts)
    .pipe(typescript(tsProject))
    .js
    .on('error', errors)
    .pipe(gulp.dest(paths.output.app))
    .pipe(browsersync.stream());
});
开发者ID:mogusbi,项目名称:ts-starter,代码行数:16,代码来源:scripts.ts


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