X Tutup
Skip to content

rewrite broccoli-replace plugin to be incremental #2050

@IgorMinar

Description

@IgorMinar

currently we use https://github.com/outaTiME/broccoli-replace in both browser and node tree

this plugin is accounting for 600-700ms during full build and 400-500ms during incremental rebuild.

if you look at the replacements we are doing they are fairly simple and can't cause us to waste that much time.

we should try to reimplement the plugin (with only the features we actually need) in plain javascript without any additional templating libraries. a few regular expression replacements should do the trick. the plugin should be implemented as a DiffingBroccoliPlugin

api compatibility would be nice, but is not required. example usage:

  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();"
      }
    ]
  });

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup