Giter Site home page Giter Site logo

broccoli-dependency-funnel's Introduction

broccoli-dependency-funnel

Build Status Build Status

This Broccoli plugin funnels a set of files included (or excluded) from a JS dependency graph.

In other words, you specify an ES6 module as an entry point and the plugin will walk its import graph and only copy-forward the files included in the graph. Alternatively, you can copy forward all files except those in the graph.

Usage

const DependencyFunnel = require('broccoli-dependency-funnel');
const input = 'src'; // Can be a directory or Broccoli plugin/node

module.exports = new DependencyFunnel(input, {
  include: true,
  entry: 'app.js',
  external: [ 'lodash' ]
});

Options

  • include / exclude: you must specify exactly one of these options set to true. This determines whether the files included in the dependency graph or the files excluded from the dependency graph will be funneled forward.

  • entry: you must specify an entry point to the dependency graph you wish to funnel. This should be a string path relative the input directory/node.

  • external: an optional array of imports to be treated as external, meaning they aren't present in the given input directory structure.

Development

Installation

  • git clone <repository-url>
  • cd broccoli-dependency-funnel
  • npm install

Testing

  • npm run test or npm run test:debug

broccoli-dependency-funnel's People

Contributors

rwjblue avatar stefanpenner avatar trentmwillis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

broccoli-dependency-funnel's Issues

Strange crash when changing many files

note: it isn't 100% that the issue is in the project, but the stack trace consistent appears from it

during rebase the following is quite common:

Error reporting instrumentation 'build'.
The Broccoli Plugin: [BroccoliDependencyFunnel] failed with:
Error: ENOENT: no such file or directory, unlink '/Users/user/code/the-app/tmp/broccoli_dependency_funnel-output_path-LFLVJztq.tmp/modules/jobs/templates/components/detail/referral-request.js'
    at Error (native)
    at Object.fs.unlinkSync (fs.js:1089:18)
    at FSMonitor._measure (/Users/user/code/the-app/node_modules/heimdalljs-fs-monitor/index.js:87:21)
    at Object.unlinkSync (/Users/user/code/the-app/node_modules/heimdalljs-fs-monitor/index.js:108:30)
    at Object.unlink (/Users/user/code/the-app/node_modules/fs-tree-diff/lib/index.js:16:8)
    at applyOperation (/Users/user/code/the-app/node_modules/fs-tree-diff/lib/index.js:222:21)
    at Function.FSTree.applyPatch (/Users/user/code/the-app/node_modules/fs-tree-diff/lib/index.js:210:5)
    at BroccoliDependencyFunnel.build (/Users/user/code/the-app/node_modules/broccoli-dependency-funnel/dist/index.js:152:37)
    at /Users/user/code/the-app/node_modules/broccoli-plugin/read_compat.js:93:34
    at tryCatch (/Users/user/code/the-app/node_modules/rsvp/dist/rsvp.js:539:12)
    at invokeCallback (/Users/user/code/the-app/node_modules/rsvp/dist/rsvp.js:554:13)
    at publish (/Users/user/code/the-app/node_modules/rsvp/dist/rsvp.js:522:7)
    at flush (/Users/user/code/the-app/node_modules/rsvp/dist/rsvp.js:2414:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

The broccoli plugin was instantiated at:
    at BroccoliDependencyFunnel.Plugin (/Users/user/code/the-app/node_modules/broccoli-plugin/index.js:7:31)
    at new BroccoliDependencyFunnel (/Users/user/code/the-app/node_modules/broccoli-dependency-funnel/dist/index.js:89:90)
    at Class.buildEngineJSTreeWithoutRoutes (/Users/user/code/the-app/node_modules/ember-engines/lib/engine-addon.js:178:10)
    at Class._memoize (/Users/user/code/the-app/node_modules/ember-engines/lib/utils/memoize.js:10:38)
    at Class.treeForPublic (/Users/user/code/the-app/node_modules/ember-engines/lib/engine-addon.js:631:59)
    at Class._treeFor (/Users/user/code/the-app/node_modules/ember-cli/lib/models/addon.js:513:33)
    at Class.treeFor (/Users/user/code/the-app/node_modules/ember-engines/lib/engine-addon.js:847:23)
    at project.addons.map.addon (/Users/user/code/the-app/node_modules/ember-cli/lib/broccoli/ember-app.js:525:20)
    at Array.map (native)
    at EmberApp.addonTreesFor (/Users/user/code/the-app/node_modules/ember-cli/lib/broccoli/ember-app.js:523:30)
    at EmberApp.publicTree (/Users/user/code/the-app/node_modules/ember-cli/lib/broccoli/ember-app.js:791:20)
    at EmberApp.toArray (/Users/user/code/the-app/node_modules/ember-cli/lib/broccoli/ember-app.js:1671:10)
    at EmberApp.toTree (/Users/user/code/the-app/node_modules/ember-cli/lib/broccoli/ember-app.js:1690:30)
    at getAppTree (/Users/user/code/the-app/core/application/ember-cli-build.js:222:14)
    at /Users/user/code/the-app/li-builder/index.js:164:19
    at Array.map (native)

Support multiple entry-points

When multiple final bundles will be produced, it can be advantageous to keep a single tree for as long as possible.

Allowing for multiple entry-points can enable us to avoid transpiling the same file if it were to occur in more than one tree. Making broccoli-dependency-funnel aware of this concept is better than the alternative (fork => dep funnel => merge) as it enables caching already walked subgraphs instead of needing to parse and walk N times for N trees.

If this is something we want, it likely needs to happen at the mr-dep-walk level with the entry-point configuration passed into mr-dep-walk from broccoli-dependency-funnel.

cc @stefanpenner @twokul

Actually use heimdall

Currently heimdall and heimdall-logger are installed, but unused. We should specify what we want to track and implement it accordingly.

Remove `rollup` options

Previously called this RollupFunnel when in ember-engines, but that name was more about implementation than behavior.

Since we've changed the name, we should also stop exposing rollup as an options field. Instead, we should just flatten the two pertinent options into the top level: entry and external.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.