noflo / noflo-ui

NoFlo Development Environment
https://app.flowhub.io
MIT License
767 stars 173 forks source link

make a module to require() in components #410

Open forresto opened 9 years ago

forresto commented 9 years ago

I want to make a constants.coffee module to require() in several components and tests. We need UI to do this, as well as the reworked build process to make it work in the browser.

forresto commented 9 years ago

Trying to work around it, made a fake Constants component, but it errors when I try to require('./Constants') it from another component:

Error: Failed to require "./Constants" from "noflo-noflo/src/lib/ComponentLoader.js"

because it is evaling the source from within ComponentLoader.

... I think we need a comprehensive solution to using CommonJS/Browserify/npm dependencies.

exports =
  Library:
    ROUTE: 'lib_actions'
    NEW_LIBRARY: 'new library'
    CHANGE_LIBRARY: 'change library'
  Graph:
    ROUTE: 'graph_actions'
    NEW_GRAPH: 'new graph'
    CHANGE_GRAPH: 'change graph'
    ADD_NODE: 'addNode'
  Error:
    NEED_NOFLO_GRAPH: 'IP should be a valid NoFlo Graph'

noflo = require 'noflo'
exports.getComponent = -> new noflo.Component
forresto commented 9 years ago

For current feature parity, we need to:

We want to:

jonnor commented 9 years ago

Current workaround: Send an object with the constants as an IIP.