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


TypeScript broccoli-stew.mv函数代码示例

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


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

示例1: makeDartTree

module.exports = function makeDartTree() {
  var sourceTree = mergeTrees([getSourceTree(), getHtmlSourcesTree()]);
  sourceTree = fixDartFolderLayout(sourceTree);

  var mergedResult = mergeTrees([sourceTree, getTemplatedPubspecsTree(), getDocsTree()]);

  // Move the tree under the 'dart' folder.
  return stew.mv(mergedResult, 'dart');
};
开发者ID:Alexandre-Herve,项目名称:angular,代码行数:9,代码来源:dart_tree.ts

示例2: makeDartTree

module.exports = function makeDartTree(destinationPath) {
  var sourceTree = mergeTrees([getSourceTree(), getHtmlSourcesTree()]);
  sourceTree = fixDartFolderLayout(sourceTree);

  var dartTree = mergeTrees([sourceTree, getTemplatedPubspecsTree(), getDocsTree()]);

  // TODO(iminar): tree differ seems to have issues with trees created by mergeTrees, investigate!
  //   ENOENT error is thrown while doing fs.readdirSync on inputRoot
  //   in the meantime, we just do noop mv to create a new tree
  dartTree = stew.mv(dartTree, '');

  return destCopy(dartTree, destinationPath);
};
开发者ID:cstkevin,项目名称:angular,代码行数:13,代码来源:dart_tree.ts

示例3: makeDartTree

module.exports = function makeDartTree() {
  // Transpile everything in 'modules'...
  var modulesTree = new Funnel('modules', {
    include: ['**/*.js', '**/*.ts', '**/*.dart'],  // .dart file available means don't translate.
    exclude: ['rtts_assert/**/*'],  // ... except for the rtts_asserts (don't apply to Dart).
    destDir: '/'                    // Remove the 'modules' prefix.
  });

  // Transpile to dart.
  var dartTree = ts2dart.transpile(modulesTree);

  // Move around files to match Dart's layout expectations.
  dartTree = stew.rename(dartTree, function(relativePath) {
    // If a file matches the `pattern`, insert the given `insertion` as the second path part.
    var replacements = [
      {pattern: /^benchmarks\/test\//, insertion: ''},
      {pattern: /^benchmarks\//, insertion: 'web'},
      {pattern: /^benchmarks_external\/test\//, insertion: ''},
      {pattern: /^benchmarks_external\//, insertion: 'web'},
      {pattern: /^example.?\//, insertion: 'web/'},
      {pattern: /^example.?\/test\//, insertion: ''},
      {pattern: /^[^\/]*\/test\//, insertion: ''},
      {pattern: /^./, insertion: 'lib'},  // catch all.
    ];

    for (var i = 0; i < replacements.length; i++) {
      var repl = replacements[i];
      if (relativePath.match(repl.pattern)) {
        var parts = relativePath.split('/');
        parts.splice(1, 0, repl.insertion);
        return path.join.apply(path, parts);
      }
    }
    throw new Error('Failed to match any path: ' + relativePath);
  });

  // Move the tree under the 'dart' folder.
  return stew.mv(dartTree, 'dart');
};
开发者ID:MandeepSinghthakur,项目名称:angular,代码行数:39,代码来源:dart_tree.ts

示例4: makeBrowserTree


//.........这里部分代码省略.........
        modulesTree, {include: ['**/*'], exclude: ['**/*.{html,ts,dart}'], destDir: '/'});
  }

  var htmlTree = new Funnel(modulesTree, {
    include: ['*/src/**/*.html', '**/playground/**/*.html', '**/payload_tests/**/ts/**/*.html'],
    destDir: '/'
  });

  if (modules.playground) {
    htmlTree = replace(htmlTree, {
      files: ['playground*/**/*.html'],
      patterns: [
        {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS')}, scriptPathPatternReplacement,
        scriptFilePatternReplacement, useBundlesPatternReplacement
      ]
    });
  }

  if (modules.benchmarks) {
    htmlTree = replace(htmlTree, {
      files: ['benchmarks/**'],
      patterns: [
        {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS_benchmarks')},
        scriptPathPatternReplacement, scriptFilePatternReplacement, useBundlesPatternReplacement
      ]
    });
  }

  if (modules.benchmarks_external) {
    htmlTree = replace(htmlTree, {
      files: ['benchmarks_external/**'],
      patterns: [
        {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS_benchmarks_external')},
        scriptPathPatternReplacement, scriptFilePatternReplacement, useBundlesPatternReplacement
      ]
    });
  }

  if (modules.playground) {
    // We need to replace the regular angular bundle with the web-worker bundle
    // for web-worker e2e tests.
    htmlTree = replace(htmlTree, {
      files: ['playground*/**/web_workers/**/*.html'],
      patterns: [{match: '/bundle/angular2.dev.js', replacement: '/bundle/web_worker/ui.dev.js'}]
    });
  }

  if (modules.benchmarks || modules.benchmarks_external) {
    var scripts = mergeTrees(servingTrees);
  }

  if (modules.benchmarks_external) {
    var polymerFiles = new Funnel('.', {
      files: [
        'bower_components/polymer/polymer.html', 'bower_components/polymer/polymer-micro.html',
        'bower_components/polymer/polymer-mini.html', 'tools/build/snippets/url_params_to_form.js'
      ]
    });
    var polymer = stew.mv(flatten(polymerFiles), 'benchmarks_external/src/tree/polymer');

    var reactFiles = new Funnel('.', {files: ['node_modules/react/dist/react.min.js']});
    var react = stew.mv(flatten(reactFiles), 'benchmarks_external/src/tree/react');
  }

  if (modules.benchmarks || modules.benchmarks_external || modules.playground) {
    htmlTree = mergeTrees([htmlTree, scripts, polymer, react]);
  }

  // this is needed only for creating a bundle
  // typescript resolves dependencies automatically
  if (modules.bundle_deps) {
    var nodeModules = new Funnel(
        'node_modules', {include: ['rxjs/**/**', 'parse5/**/**', 'css/**/**'], destDir: '/'});
  }

  if (generateEs6) {
    // Use TypeScript to transpile the *.ts files to ES6
    var es6Tree = compileWithTypescript(modulesTree, {
      declaration: false,
      emitDecoratorMetadata: true,
      experimentalDecorators: true,
      noEmitOnError: false,
      rootDir: './',
      rootFilePaths: [
        'angular2/typings/zone.js/zone.js.d.ts',
        'angular2/typings/hammerjs/hammerjs.d.ts',
        'angular2/typings/node/node.d.ts',
      ],
      inlineSourceMap: sourceMaps,
      inlineSources: sourceMaps,
      target: 'es6'
    });

    es6Tree = stew.mv(mergeTrees([es6Tree, htmlTree, assetsTree, nodeModules]), '/es6');
  }
  es5Tree = stew.mv(mergeTrees([es5Tree, htmlTree, assetsTree, nodeModules]), '/es5');

  var mergedTree = mergeTrees([es6Tree, es5Tree]);
  return destCopy(mergedTree, destinationPath);
};
开发者ID:LordBinary,项目名称:angular,代码行数:101,代码来源:browser_tree.ts

示例5: makeBrowserTree


//.........这里部分代码省略.........
    traceurOptions: {modules: 'instantiate', sourceMaps: true}
  });

  // Now we add a few more files to the es6 tree that Traceur should not see
  ['angular2', 'rtts_assert'].forEach(function(destDir) {
    var extras = new Funnel('tools/build', {files: ['es5build.js'], destDir: destDir});
    es6Tree = mergeTrees([es6Tree, extras]);
  });


  var vendorScriptsTree = flatten(new Funnel('.', {
    files: [
      'node_modules/zone.js/dist/zone-microtask.js',
      'node_modules/zone.js/dist/long-stack-trace-zone.js',
      'node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.src.js',
      'node_modules/systemjs/dist/system.src.js',
      'node_modules/systemjs/lib/extension-register.js',
      'node_modules/systemjs/lib/extension-cjs.js',
      'node_modules/rx/dist/rx.js',
      'node_modules/reflect-metadata/Reflect.js',
      'tools/build/snippets/runtime_paths.js',
      path.relative(projectRootDir, TRACEUR_RUNTIME_PATH)
    ]
  }));

  var vendorScripts_benchmark =
      new Funnel('tools/build/snippets', {files: ['url_params_to_form.js'], destDir: '/'});
  var vendorScripts_benchmarks_external =
      new Funnel('node_modules/angular', {files: ['angular.js'], destDir: '/'});

  // Get scripts for each benchmark or example
  let servingTrees = kServedPaths.reduce(getServedFunnels, []);
  function getServedFunnels(funnels, destDir) {
    let options = {
      srcDir: '/',
      destDir: destDir
    };
    funnels.push(new Funnel(vendorScriptsTree, options));
    if (destDir.indexOf('benchmarks') > -1) {
      funnels.push(new Funnel(vendorScripts_benchmark, options));
    }
    if (destDir.indexOf('benchmarks_external') > -1) {
      funnels.push(new Funnel(vendorScripts_benchmarks_external, options));
    }
    return funnels;
  }

  var scriptPathPatternReplacement = {
    match: '@@FILENAME_NO_EXT',
    replacement: function(replacement, relativePath) { return relativePath.replace(/\.\w+$/, ''); }
  };

  var htmlTree = new Funnel(modulesTree, {include: ['*/src/**/*.html'], destDir: '/'});
  htmlTree = replace(htmlTree, {
    files: ['examples*/**'],
    patterns: [
      {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS')},
      scriptPathPatternReplacement
    ]
  });

  htmlTree = replace(htmlTree, {
    files: ['benchmarks/**'],
    patterns: [
      {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS_benchmarks')},
      scriptPathPatternReplacement
    ]
  });

  htmlTree = replace(htmlTree, {
    files: ['benchmarks_external/**'],
    patterns: [
      {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS_benchmarks_external')},
      scriptPathPatternReplacement
    ]
  });

  var assetsTree =
      new Funnel(modulesTree, {include: ['**/*'], exclude: ['**/*.{html,ts,dart}'], destDir: '/'});

  var scripts = mergeTrees(servingTrees);
  var polymerFiles = new Funnel('.', {
    files: [
      'bower_components/polymer/lib/polymer.html',
      'tools/build/snippets/url_params_to_form.js'
    ]
  });
  var polymer = stew.mv(flatten(polymerFiles), 'benchmarks_external/src/tree/polymer');

  var reactFiles = new Funnel('.', {files: ['node_modules/react/dist/react.min.js']});
  var react = stew.mv(flatten(reactFiles), 'benchmarks_external/src/tree/react');

  htmlTree = mergeTrees([htmlTree, scripts, polymer, react]);

  es5Tree = mergeTrees([es5Tree, htmlTree, assetsTree]);

  var mergedTree = mergeTrees([stew.mv(es6Tree, '/es6'), stew.mv(es5Tree, '/es5')]);

  return destCopy(mergedTree, destinationPath);
};
开发者ID:amzinino,项目名称:angular,代码行数:101,代码来源:browser_tree.ts

示例6: makeBrowserTree


//.........这里部分代码省略.........
  var vendorScripts_benchmark =
      new Funnel('tools/build/snippets', {files: ['url_params_to_form.js'], destDir: '/'});
  var vendorScripts_benchmarks_external =
      new Funnel('node_modules/angular', {files: ['angular.js'], destDir: '/'});

  // Get scripts for each benchmark or example
  let servingTrees = kServedPaths.reduce(getServedFunnels, []);
  function getServedFunnels(funnels, destDir) {
    let options = {srcDir: '/', destDir: destDir};
    funnels.push(new Funnel(vendorScriptsTree, options));
    if (destDir.indexOf('benchmarks') > -1) {
      funnels.push(new Funnel(vendorScripts_benchmark, options));
    }
    if (destDir.indexOf('benchmarks_external') > -1) {
      funnels.push(new Funnel(vendorScripts_benchmarks_external, options));
    }
    return funnels;
  }

  var htmlTree = new Funnel(
      modulesTree, {include: ['*/src/**/*.html', '**/playground/**/*.html'], destDir: '/'});
  htmlTree = replace(htmlTree, {
    files: ['playground*/**/*.html'],
    patterns: [
      {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS')},
      scriptPathPatternReplacement,
      scriptFilePatternReplacement
    ]
  });


  htmlTree = replace(htmlTree, {
    files: ['benchmarks/**'],
    patterns: [
      {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS_benchmarks')},
      scriptPathPatternReplacement,
      scriptFilePatternReplacement
    ]
  });

  htmlTree = replace(htmlTree, {
    files: ['benchmarks_external/**'],
    patterns: [
      {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS_benchmarks_external')},
      scriptPathPatternReplacement,
      scriptFilePatternReplacement
    ]
  });

  // We need to replace the regular angular bundle with the web-worker bundle
  // for web-worker e2e tests.
  htmlTree = replace(htmlTree, {
    files: ['playground*/**/web_workers/**/*.html'],
    patterns: [{match: "/bundle/angular2.dev.js", replacement: "/bundle/web_worker/ui.dev.js"}]
  });

  var assetsTree =
      new Funnel(modulesTree, {include: ['**/*'], exclude: ['**/*.{html,ts,dart}'], destDir: '/'});

  var scripts = mergeTrees(servingTrees);
  var polymerFiles = new Funnel('.', {
    files: [
      'bower_components/polymer/lib/polymer.html',
      'tools/build/snippets/url_params_to_form.js'
    ]
  });
  var polymer = stew.mv(flatten(polymerFiles), 'benchmarks_external/src/tree/polymer');

  var reactFiles = new Funnel('.', {files: ['node_modules/react/dist/react.min.js']});
  var react = stew.mv(flatten(reactFiles), 'benchmarks_external/src/tree/react');

  htmlTree = mergeTrees([htmlTree, scripts, polymer, react]);

  var typingsTree = new Funnel(
      'modules',
      {include: ['angular2/typings/**/*.d.ts', 'angular2/manual_typings/*.d.ts'], destDir: '/'});

  // Add a line to the end of our top-level .d.ts file.
  // This HACK for transitive typings is a workaround for
  // https://github.com/Microsoft/TypeScript/issues/5097
  //
  // This allows users to get our top-level dependencies like es6-shim.d.ts
  // to appear when they compile against angular2.
  //
  // This carries the risk that the user brings their own copy of that file
  // (or any other symbols exported here) and they will get a compiler error
  // because of the duplicate definitions.
  // TODO(alexeagle): remove this when typescript releases a fix
  es5Tree = replace(es5Tree, {
    files: ['angular2/angular2.d.ts'],
    patterns: [{match: /$/, replacement: 'import "./manual_typings/globals.d.ts";\n'}]
  });

  es5Tree = mergeTrees([es5Tree, htmlTree, assetsTree, clientModules, typingsTree]);
  es6Tree = mergeTrees([es6Tree, htmlTree, assetsTree, clientModules, typingsTree]);

  var mergedTree = mergeTrees([stew.mv(es6Tree, '/es6'), stew.mv(es5Tree, '/es5')]);

  return destCopy(mergedTree, destinationPath);
};
开发者ID:,项目名称:,代码行数:101,代码来源:

示例7: makeNodeTree


//.........这里部分代码省略.........
  nodeTree = replace(nodeTree, {
    files: ['**/test/**/*_spec.js'],
    patterns: [
      {
        // Override the default DOM adapter with Parse5 for all tests
        match: /"use strict";/,
        replacement:
            "'use strict'; var parse5Adapter = require('angular2/src/dom/parse5_adapter'); " +
                "parse5Adapter.Parse5DomAdapter.makeCurrent();"
      },
      {
        // Append main() to all tests since all of our tests are wrapped in exported main fn
        match: /$/g,
        replacement: "\r\n main();"
      }
    ]
  });

  // Now we add the LICENSE file into all the folders that will become npm packages
  outputPackages.forEach(function(destDir) {
    var license = new Funnel('.', {files: ['LICENSE'], destDir: destDir});
    nodeTree = mergeTrees([nodeTree, license]);
  });

  // Get all docs and related assets and prepare them for js build
  var docs = new Funnel(modulesTree, {include: ['**/*.md', '**/*.png'], exclude: ['**/*.dart.md']});
  docs = stew.rename(docs, 'README.js.md', 'README.md');

  // Generate shared package.json info
  var BASE_PACKAGE_JSON = require(path.join(projectRootDir, 'package.json'));
  var COMMON_PACKAGE_JSON = {
    version: BASE_PACKAGE_JSON.version,
    homepage: BASE_PACKAGE_JSON.homepage,
    bugs: BASE_PACKAGE_JSON.bugs,
    license: BASE_PACKAGE_JSON.license,
    contributors: BASE_PACKAGE_JSON.contributors,
    dependencies: BASE_PACKAGE_JSON.dependencies,
    devDependencies: {
      "yargs": BASE_PACKAGE_JSON.devDependencies['yargs'],
      "gulp-sourcemaps": BASE_PACKAGE_JSON.devDependencies['gulp-sourcemaps'],
      "gulp-traceur": BASE_PACKAGE_JSON.devDependencies['gulp-traceur'],
      "gulp": BASE_PACKAGE_JSON.devDependencies['gulp'],
      "gulp-rename": BASE_PACKAGE_JSON.devDependencies['gulp-rename'],
      "through2": BASE_PACKAGE_JSON.devDependencies['through2']
    }
  };

  // Add a .template extension since renderLodashTemplate strips one extension
  var packageJsons = stew.rename(new Funnel(modulesTree, {include: ['**/package.json']}), '.json',
                                 '.json.template');
  packageJsons = renderLodashTemplate(
      packageJsons, {files: ["**/**"], context: {'packageJson': COMMON_PACKAGE_JSON}});

  // HACK: workaround for Traceur behavior.
  // It expects all transpiled modules to contain this marker.
  // TODO: remove this when we no longer use traceur
  var traceurCompatibleTsModulesTree = replace(modulesTree, {
    files: ['**/*.ts'],
    patterns: [{
      // Empty replacement needed so that replaceWithPath gets triggered...
      match: /$/g,
      replacement: ""
    }],
    replaceWithPath: function(path, content) {
      if (!path.endsWith('.d.ts')) {
        content += '\r\nexport var __esModule = true;\n';
      }
      return content;
    }
  });

  // TODO(iminar): tree differ seems to have issues with trees created by mergeTrees, investigate!
  //   ENOENT error is thrown while doing fs.readdirSync on inputRoot
  //   in the meantime, we just do noop mv to create a new tree
  traceurCompatibleTsModulesTree = stew.mv(traceurCompatibleTsModulesTree, '');

  var typescriptTree = compileWithTypescript(traceurCompatibleTsModulesTree, {
    allowNonTsExtensions: false,
    emitDecoratorMetadata: true,
    declaration: true,
    mapRoot: '', /* force sourcemaps to use relative path */
    module: 'commonjs',
    noEmitOnError: true,
    rootDir: '.',
    rootFilePaths: ['angular2/traceur-runtime.d.ts', 'angular2/globals.d.ts'],
    sourceMap: true,
    sourceRoot: '.',
    target: 'ES5'
  });


  nodeTree = mergeTrees([nodeTree, typescriptTree, docs, packageJsons]);

  // TODO(iminar): tree differ seems to have issues with trees created by mergeTrees, investigate!
  //   ENOENT error is thrown while doing fs.readdirSync on inputRoot
  //   in the meantime, we just do noop mv to create a new tree
  nodeTree = stew.mv(nodeTree, '');

  return destCopy(nodeTree, destinationPath);
};
开发者ID:jeffwhelpley,项目名称:angular,代码行数:101,代码来源:node_tree.ts

示例8: makeBrowserTree

module.exports = function makeBrowserTree(options, destinationPath) {
  var modulesTree = new Funnel(
      'modules',
      {include: ['**/**'], exclude: ['**/*.cjs', 'benchmarks/e2e_test/**'], destDir: '/'});

  // Use Traceur to transpile *.js sources to ES6
  var traceurTree = transpileWithTraceur(modulesTree, {
    destExtension: '.es6',
    destSourceMapExtension: '.map',
    traceurOptions: {
      sourceMaps: true,
      annotations: true,      // parse annotations
      types: true,            // parse types
      script: false,          // parse as a module
      memberVariables: true,  // parse class fields
      modules: 'instantiate',
      // typeAssertionModule: 'rtts_assert/rtts_assert',
      // typeAssertions: options.typeAssertions,
      outputLanguage: 'es6'
    }
  });

  // Use TypeScript to transpile the *.ts files to ES6
  // We don't care about errors: we let the TypeScript compilation to ES5
  // in node_tree.ts do the type-checking.
  var typescriptTree = compileWithTypescript(modulesTree, {
    allowNonTsExtensions: false,
    declaration: true,
    emitDecoratorMetadata: true,
    mapRoot: '',           // force sourcemaps to use relative path
    noEmitOnError: false,  // temporarily ignore errors, we type-check only via cjs build
    rootDir: '.',
    sourceMap: true,
    sourceRoot: '.',
    target: 'ES6'
  });
  typescriptTree = stew.rename(typescriptTree, '.js', '.es6');

  var es6Tree = mergeTrees([traceurTree, typescriptTree]);

  // TODO(iminar): tree differ seems to have issues with trees created by mergeTrees, investigate!
  //   ENOENT error is thrown while doing fs.readdirSync on inputRoot
  //   in the meantime, we just do noop mv to create a new tree
  es6Tree = stew.mv(es6Tree, '');

  // Call Traceur again to lower the ES6 build tree to ES5
  var es5Tree = transpileWithTraceur(es6Tree, {
    destExtension: '.js',
    destSourceMapExtension: '.js.map',
    traceurOptions: {modules: 'instantiate', sourceMaps: true}
  });

  // Now we add a few more files to the es6 tree that Traceur should not see
  ['angular2', 'rtts_assert'].forEach(function(destDir) {
    var extras = new Funnel('tools/build', {files: ['es5build.js'], destDir: destDir});
    es6Tree = mergeTrees([es6Tree, extras]);
  });


  var vendorScriptsTree = flatten(new Funnel('.', {
    files: [
      'node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.src.js',
      'node_modules/zone.js/zone.js',
      'node_modules/zone.js/long-stack-trace-zone.js',
      'node_modules/systemjs/dist/system.src.js',
      'node_modules/systemjs/lib/extension-register.js',
      'node_modules/systemjs/lib/extension-cjs.js',
      'node_modules/rx/dist/rx.js',
      'node_modules/reflect-metadata/Reflect.js',
      'tools/build/snippets/runtime_paths.js',
      path.relative(projectRootDir, TRACEUR_RUNTIME_PATH)
    ]
  }));
  var vendorScripts_benchmark =
      new Funnel('tools/build/snippets', {files: ['url_params_to_form.js'], destDir: '/'});
  var vendorScripts_benchmarks_external =
      new Funnel('node_modules/angular', {files: ['angular.js'], destDir: '/'});

  var servingTrees = [];

  function copyVendorScriptsTo(destDir) {
    servingTrees.push(new Funnel(vendorScriptsTree, {srcDir: '/', destDir: destDir}));
    if (destDir.indexOf('benchmarks') > -1) {
      servingTrees.push(new Funnel(vendorScripts_benchmark, {srcDir: '/', destDir: destDir}));
    }
    if (destDir.indexOf('benchmarks_external') > -1) {
      servingTrees.push(
          new Funnel(vendorScripts_benchmarks_external, {srcDir: '/', destDir: destDir}));
    }
  }

  function writeScriptsForPath(relativePath, result) {
    copyVendorScriptsTo(path.dirname(relativePath));
    return result.replace('@@FILENAME_NO_EXT', relativePath.replace(/\.\w+$/, ''));
  }

  var htmlTree = new Funnel(modulesTree, {include: ['*/src/**/*.html'], destDir: '/'});
  htmlTree = replace(htmlTree, {
    files: ['examples*/**'],
    patterns: [{match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS')}],
//.........这里部分代码省略.........
开发者ID:IlanFrumer,项目名称:angular,代码行数:101,代码来源:browser_tree.ts

示例9: makeBrowserTree


//.........这里部分代码省略.........
    rootFilePaths: ['angular2/manual_typings/globals.d.ts'],
    sourceMap: true,
    sourceRoot: '.',
    target: 'es5'
  };
  var es5Tree = compileWithTypescript(es5ModulesTree, typescriptOptions);

  var vendorScriptsTree = flatten(new Funnel('.', {
    files: [
      'node_modules/es6-shim/es6-shim.js',
      'node_modules/zone.js/dist/zone-microtask.js',
      'node_modules/zone.js/dist/long-stack-trace-zone.js',
      'node_modules/systemjs/dist/system.src.js',
      'node_modules/base64-js/lib/b64.js',
      'node_modules/reflect-metadata/Reflect.js'
    ]
  }));

  var vendorScripts_benchmark =
      new Funnel('tools/build/snippets', {files: ['url_params_to_form.js'], destDir: '/'});
  var vendorScripts_benchmarks_external =
      new Funnel('node_modules/angular', {files: ['angular.js'], destDir: '/'});

  // Get scripts for each benchmark or example
  let servingTrees = kServedPaths.reduce(getServedFunnels, []);
  function getServedFunnels(funnels, destDir) {
    let options = {srcDir: '/', destDir: destDir};
    funnels.push(new Funnel(vendorScriptsTree, options));
    if (destDir.indexOf('benchmarks') > -1) {
      funnels.push(new Funnel(vendorScripts_benchmark, options));
    }
    if (destDir.indexOf('benchmarks_external') > -1) {
      funnels.push(new Funnel(vendorScripts_benchmarks_external, options));
    }
    return funnels;
  }

  var htmlTree = new Funnel(
      modulesTree, {include: ['*/src/**/*.html', '**/playground/**/*.html'], destDir: '/'});
  htmlTree = replace(htmlTree, {
    files: ['playground*/**/*.html'],
    patterns: [
      {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS')},
      scriptPathPatternReplacement,
      scriptFilePatternReplacement
    ]
  });


  htmlTree = replace(htmlTree, {
    files: ['benchmarks/**'],
    patterns: [
      {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS_benchmarks')},
      scriptPathPatternReplacement,
      scriptFilePatternReplacement
    ]
  });

  htmlTree = replace(htmlTree, {
    files: ['benchmarks_external/**'],
    patterns: [
      {match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS_benchmarks_external')},
      scriptPathPatternReplacement,
      scriptFilePatternReplacement
    ]
  });

  // We need to replace the regular angular bundle with the web-worker bundle
  // for web-worker e2e tests.
  htmlTree = replace(htmlTree, {
    files: ['playground*/**/web_workers/**/*.html'],
    patterns: [{match: "/bundle/angular2.dev.js", replacement: "/bundle/web_worker/ui.dev.js"}]
  });

  var assetsTree =
      new Funnel(modulesTree, {include: ['**/*'], exclude: ['**/*.{html,ts,dart}'], destDir: '/'});

  var scripts = mergeTrees(servingTrees);
  var polymerFiles = new Funnel('.', {
    files: [
      'bower_components/polymer/polymer.html',
      'bower_components/polymer/polymer-micro.html',
      'bower_components/polymer/polymer-mini.html',
      'tools/build/snippets/url_params_to_form.js'
    ]
  });
  var polymer = stew.mv(flatten(polymerFiles), 'benchmarks_external/src/tree/polymer');

  var reactFiles = new Funnel('.', {files: ['node_modules/react/dist/react.min.js']});
  var react = stew.mv(flatten(reactFiles), 'benchmarks_external/src/tree/react');

  htmlTree = mergeTrees([htmlTree, scripts, polymer, react]);

  es5Tree = mergeTrees([es5Tree, htmlTree, assetsTree, clientModules]);
  es6Tree = mergeTrees([es6Tree, htmlTree, assetsTree, clientModules]);

  var mergedTree = mergeTrees([stew.mv(es6Tree, '/es6'), stew.mv(es5Tree, '/es5')]);

  return destCopy(mergedTree, destinationPath);
};
开发者ID:TedSander,项目名称:angular,代码行数:101,代码来源:browser_tree.ts

示例10: makeBrowserTree

module.exports = function makeBrowserTree(options) {
  var modulesTree = new Funnel(
      'modules',
      {include: ['**/**'], exclude: ['**/*.cjs', 'benchmarks/e2e_test/**'], destDir: '/'});

  // Use Traceur to transpile original sources to ES6
  var es6Tree = new TraceurCompiler(modulesTree, '.es6', '.map', {
    sourceMaps: true,
    annotations: true,      // parse annotations
    types: true,            // parse types
    script: false,          // parse as a module
    memberVariables: true,  // parse class fields
    modules: 'instantiate',
    typeAssertionModule: 'rtts_assert/rtts_assert',
    typeAssertions: options.typeAssertions,
    outputLanguage: 'es6'
  });


  // Call Traceur again to lower the ES6 build tree to ES5
  var es5Tree =
      new TraceurCompiler(es6Tree, '.js', '.js.map', {modules: 'instantiate', sourceMaps: true});

  // Now we add a few more files to the es6 tree that Traceur should not see
  ['angular2', 'rtts_assert'].forEach(function(destDir) {
    var extras = new Funnel('tools/build', {files: ['es5build.js'], destDir: destDir});
    es6Tree = mergeTrees([es6Tree, extras]);
  });


  var vendorScriptsTree = flatten(new Funnel('.', {
    files: [
      'node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.src.js',
      'node_modules/zone.js/zone.js',
      'node_modules/zone.js/long-stack-trace-zone.js',
      'node_modules/systemjs/dist/system.src.js',
      'node_modules/systemjs/lib/extension-register.js',
      'node_modules/systemjs/lib/extension-cjs.js',
      'node_modules/rx/dist/rx.all.js',
      'tools/build/snippets/runtime_paths.js',
      path.relative(projectRootDir, TraceurCompiler.RUNTIME_PATH)
    ]
  }));
  var vendorScripts_benchmark =
      new Funnel('tools/build/snippets', {files: ['url_params_to_form.js'], destDir: '/'});
  var vendorScripts_benchmarks_external =
      new Funnel('node_modules/angular', {files: ['angular.js'], destDir: '/'});

  var servingTrees = [];

  function copyVendorScriptsTo(destDir) {
    servingTrees.push(new Funnel(vendorScriptsTree, {srcDir: '/', destDir: destDir}));
    if (destDir.indexOf('benchmarks') > -1) {
      servingTrees.push(new Funnel(vendorScripts_benchmark, {srcDir: '/', destDir: destDir}));
    }
    if (destDir.indexOf('benchmarks_external') > -1) {
      servingTrees.push(
          new Funnel(vendorScripts_benchmarks_external, {srcDir: '/', destDir: destDir}));
    }
  }

  function writeScriptsForPath(relativePath, result) {
    copyVendorScriptsTo(path.dirname(relativePath));
    return result.replace('@@FILENAME_NO_EXT', relativePath.replace(/\.\w+$/, ''));
  }

  var htmlTree = new Funnel(modulesTree, {include: ['*/src/**/*.html'], destDir: '/'});
  htmlTree = replace(htmlTree, {
    files: ['examples*/**'],
    patterns: [{match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS')}],
    replaceWithPath: writeScriptsForPath
  });
  htmlTree = replace(htmlTree, {
    files: ['benchmarks/**'],
    patterns: [{match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS_benchmarks')}],
    replaceWithPath: writeScriptsForPath
  });
  htmlTree = replace(htmlTree, {
    files: ['benchmarks_external/**'],
    patterns: [{match: /\$SCRIPTS\$/, replacement: htmlReplace('SCRIPTS_benchmarks_external')}],
    replaceWithPath: writeScriptsForPath
  });

  // Copy all vendor scripts into all examples and benchmarks
  ['benchmarks/src', 'benchmarks_external/src', 'examples/src/benchpress'].forEach(
      copyVendorScriptsTo);

  var scripts = mergeTrees(servingTrees, {overwrite: true});
  var css = new Funnel(modulesTree, {include: ["**/*.css"]});
  var polymerFiles = new Funnel('.', {
    files: [
      'bower_components/polymer/lib/polymer.html',
      'tools/build/snippets/url_params_to_form.js'
    ]
  });
  var polymer = stew.mv(flatten(polymerFiles), 'benchmarks_external/src/tree/polymer');
  htmlTree = mergeTrees([htmlTree, scripts, polymer, css]);

  es5Tree = mergeTrees([es5Tree, htmlTree]);

//.........这里部分代码省略.........
开发者ID:Alexandre-Herve,项目名称:angular,代码行数:101,代码来源:browser_tree.ts


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