Coder Social home page Coder Social logo

browserify-transform-tools's People

Contributors

bpeacock avatar call-a3 avatar cape-dev avatar cgc avatar flozz avatar ipanasenko avatar jwalton avatar matthewdunsdon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

browserify-transform-tools's Issues

supporting `require` aliases

hey, there!

i was wondering if there was any plan to support specifying aliases for require in the makeRequireTransform method. i ask because of things like proxyquireify and others that do "hygienic" require monkey-patching by providing an alias, but still need to be potentially transformed.

i started poking at PRing the change for discussion, but encountered a brick wall in the form of (what seems like) necessarily breaking the current API. ideally, in my estimation, the require "word" would be somehow linked to each "argument" in the transform callback. because of this, i decided to instead ask if it was even something considered worth supporting, and if so if there was any preference about how to support it. if desired, i am more than willing to do the work to support it.

thoughts?

thanks for your time!

Only parse js extensions

For require and falafel transforms, it would be nice if there was an option to only parse js type files by default. Trying to run a JSON file through a require or falafel transform wouldn't go vey well, for example.

  • ".js"
  • ".coffee", ".coffee.md", ".litcoffee" - via coffeeify
  • "._js", "._coffee" - Streamline.js
  • ".jade" - jadeify
  • ".vash" - vashify
  • No ".hbs" from hbsfy, because Handlebars can't inline Javascript code?

It would be nice if there was a way for end-users to specify what extensions should be processed in the module config, or even for them to specify exactly which files should be processed for performance optimization.

Configuration can only be set in the top level package

I want to use the transform I create with browserify-transform-tools to apply to reusable packages, but configuration can't be set for each package the same way browserify transforms are.

Browserify transforms are defined at the package level, but browserify-transform-tools reads configuration only from the top level package.

For example, I want to create a transform called somethingify. I then want to create a reusable package called reuseMe that uses somethingify and sets it's own configuration.

myProject
    package.json  <----Config for somethingify transform must be set here
    node_modules
        somethingify
        reuseMe
            package.json   <---I should be able to set somethingify config here
            node_modules
                  somethingify

To be consistent with browserify behavior, transform options should not apply to child packages. Each package should be responsible for describing the transforms it uses and the configurations for those transforms.

Incorrect Falafel dependency

The package.json specifies a dependency on falafel, version 1.0.2. The latest published npm version is 1.0.1, so npm installing the package fails...

Not able to programatically specify what file extensions are included

When using browserify-transform-tools (v 1.5.1), I am not able to programatically specify what file extensions to include (includeExtensions).

Partial code sample:

var DEFAULT_EXTENSIONS = ['.js']
var options = { includeExtensions: DEFAULT_EXTENSIONS }
var myStringTransform = transformTools.makeStringTransform("hello", options, function(content, transformOptions, done) {
    done(null, 'hello ' + content);
});
browserify({ entries: ['index.html'] })
    .transform(myStringTransform, { appliesTo: { includeExtensions: ['.html'] } })
    .bundle()

require transform parse error on 'const' (and probably others)

Hi.

We have a global require transform that balks on a module that uses a const variable decl. We get the following error:

error: SyntaxError: Unexpected token (83:6) (while requireTransform was processing /Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/pem-jwk/index.js) while parsing file: /Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/pem-jwk/index.js
    at Parser.pp.raise (/Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/acorn/dist/acorn.js:1745:13)
    at Parser.pp.unexpected (/Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/acorn/dist/acorn.js:2264:8)
    at Parser.pp.semicolon (/Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/acorn/dist/acorn.js:2243:59)
    at Parser.pp.parseExpressionStatement (/Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/acorn/dist/acorn.js:2677:8)
    at Parser.pp.parseStatement (/Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/acorn/dist/acorn.js:2462:160)
    at Parser.pp.parseTopLevel (/Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/acorn/dist/acorn.js:2379:21)
    at parse (/Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/acorn/dist/acorn.js:101:12)
    at module.exports (/Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/falafel/index.js:22:15)
    at Stream.<anonymous> (/Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/browserify-transform-tools/lib/transformTools.js:187:21)
    at Stream.end (/Users/tfennelly/projects/blueocean/blueocean-dashboard/node_modules/browserify-transform-tools/lib/transformTools.js:108:30)

Where 83:6 is pointing at a const.

I tried the latest version of browserify and browserify-transform-tools.

Is there anything I can do? Maybe I need to apply a global babel transform or something? Seems bad to publish unprocessed modules with const etc in them.

Do requireTransforms allow for relative path changes?

I'm using the following to change a require in a given transform:

  var transform = transformTools.makeRequireTransform("requireTransform",
    {evaluateArguments: true},
    function(args, opts, cb) {
      if (args[0] === 'modernizr') {
        return cb(null, "require('../../../libs/modernizr/modernizr.js')");
      } else {
        return cb();
      }
  });

And yet I'm not seeing the relative file change. Is this something supported? Am I overlooking something?

forward falafel errors

I think you forget to emit an error event somewhere (may be somewhere here?)[https://github.com/benbria/browserify-transform-tools/blob/master/src/transformTools.coffee#L157] .

At least my node process crashes when having a syntax error whereas I get an error event on the builder to handle.

Error: Line 5: Unexpected token ILLEGAL (while aliasify was processing /Users/bodokaiser/Documents/Repositories/satisfeet/app/index.js)
    at throwError (/Users/bodokaiser/Documents/Repositories/satisfeet/node_modules/aliasify/node_modules/browserify-transform-tools/node_modules/falafel/node_modules/esprima/esprima.js:1472:21)
    at scanPunctuator (/Users/bodokaiser/Documents/Repositories/satisfeet/node_modules/aliasify/node_modules/browserify-transform-tools/node_modules/falafel/node_modules/esprima/esprima.js:689:9)
    at advance (/Users/bodokaiser/Documents/Repositories/satisfeet/node_modules/aliasify/node_modules/browserify-transform-tools/node_modules/falafel/node_modules/esprima/esprima.js:1065:16)
    at lex (/Users/bodokaiser/Documents/Repositories/satisfeet/node_modules/aliasify/node_modules/browserify-transform-tools/node_modules/falafel/node_modules/esprima/esprima.js:1076:21)
    at consumeSemicolon (/Users/bodokaiser/Documents/Repositories/satisfeet/node_modules/aliasify/node_modules/browserify-transform-tools/node_modules/falafel/node_modules/esprima/esprima.js:1589:13)
    at parseVariableStatement (/Users/bodokaiser/Documents/Repositories/satisfeet/node_modules/aliasify/node_modules/browserify-transform-tools/node_modules/falafel/node_modules/esprima/esprima.js:2295:9)
    at parseStatement (/Users/bodokaiser/Documents/Repositories/satisfeet/node_modules/aliasify/node_modules/browserify-transform-tools/node_modules/falafel/node_modules/esprima/esprima.js:2826:24)
    at /Users/bodokaiser/Documents/Repositories/satisfeet/node_modules/aliasify/node_modules/browserify-transform-tools/node_modules/falafel/node_modules/esprima/esprima.js:3588:38
    at parseSourceElement (/Users/bodokaiser/Documents/Repositories/satisfeet/node_modules/aliasify/node_modules/browserify-transform-tools/node_modules/falafel/node_modules/esprima/esprima.js:3068:24)
    at parseSourceElements (/Users/bodokaiser/Documents/Repositories/satisfeet/node_modules/aliasify/node_modules/browserify-transform-tools/node_modules/falafel/node_modules/esprima/esprima.js:3106:29)
make: *** [boot] Error 8

Supporting `appliesTo` configuration being set through command line

When running browserify from the command line, I am not able to pass through the appliesTo configuration.

browserify -t [ abc --opt1 val --appliesTo [ --includeExtensions [.html .abc] ] ] test.abc

Does anyone agree that this is this something we would want to support?

Accept transform options provided upstream

Browserify's API for writing transforms allows transforms to accept two parameters: the file name, which is mandatory if the transform is to do anything meaningful; and trOpts, or transform options, which are optional but can be used by the transform if it so chooses.

Presently, the make*Transform methods all return a function that accepts a file parameter but no trOpts. Consequently it's impossible for any parameters provided to the transform from somewhere upstream (i.e. via Browserify's own b.transform API, or a build tool such as grunt-browserify) to be processed by the created transform.

I propose modifying the function signature of the transform function returned by makeStringTransform (see transformTools.coffee line 53) from

transform = (file) ->

to

transform = (file, opts) ->

and to change the transformOptions from

transformOptions = {
    file: file,
    configData, configData,
    config: configData?.config
}

to

transformOptions = {
    file: file,
    configData, configData,
    config: configData?.config,
    opts: opts
}

Thoughts?

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.