Giter VIP home page Giter VIP logo

galvatron's People

Contributors

joscha avatar nicvenegas avatar nvenegas avatar treshugart avatar wbinnssmith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

galvatron's Issues

It seems that named modules no longer work.

For example:

import something from 'something';

You've always got to give it the path to bower_components or node_modules:

import something from '../../node_modules/something';

Add gulp sourcemap support

Feature request

Currently gulp sourcemaps (https://github.com/floridoo/gulp-sourcemaps) are not supported in galvatron.

The following config does not produce sourcemaps currently:

return gulp.src(ordered)
        .pipe(sourcemaps.init())
        .pipe(bundle.stream())
        .pipe(concat('main.js'))
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(dist));

Search symlink target directories for module when file is in a linked package

For a package foo that has a dependency on bar, when we npm link bar inside foo in npm 3+ (where nested dependencies are generally flattened into the "root" directory's node_modules, where "root" = foo's directory in this example), rather than searching inside bar/node_modules directory we should actually be searching inside foo/node_modules.

If bar's dependency isn't found inside foo/node_modules, then we should probably fall back to searching inside bar/node_modules.

And, of course, generalized for any symlinked parent structure.

JSX support

We should accept code that may contain JSX. Best path to do this would be to enable JSX support in node-source-walk therefore enabling it in each of the detective-* libs that we use.

If you require require, the globalize replacement won't work.

If you do:

define(["require", "./beautify", "./beautify-css"], function(requireamd) {
            var js_beautify = requireamd("./beautify");
            var css_beautify = requireamd("./beautify-css");

(source: https://github.com/beautify-web/js-beautify/blob/master/js/lib/beautify-html.js )

then

data = data.replace('require("' + imp.value + '")', replaceWith);
data = data.replace('require(\'' + imp.value + '\')', replaceWith);

(source: https://github.com/treshugart/galvatron/blob/master/src/globalize.js#L121 )
won't work, as it requires with an alias.

Ignore certain files for specific transforms.

It might be a good idea to have a way to tell a transform to not transform certain files. For example, when using the babel transform on files that don't need to be transformed by it is not recommended and can cause issues. Having a built-in way to say "don't transform these files" would be handy.

It could be implemented by supplying a function or minimatch expression when calling the transform methods.

Nesting of globalized modules.

If you're transforming sources that include already transformed modules, they'll be nested which makes the nested stuff not export their global to the window. This should work.

galvatron.watch doesn't accept an array of strings as second argument

example in the documentation has this line:

galv.watch('src/**', ['dist']);

which has an array of strings as the second argument.

It looks like galvatron.watch only accepts a function as the second arguments:

module.exports = function (pattern, task) {
  var stream = task();

When I try to use the example in the docs I get this error:

TypeError: object is not a function
    at Object.module.exports [as watch] (<project>/node_modules/galvatron/src/watch.js:6:16)
...

either the docs are wrong or this is a bug in galvatron watch?

Add ability to describe bundles with the tracer.

New tracer API

Tracer should support an optional API to filter files based on:

  • commonality
  • uniqueness
  • origin path (minimatch)

This would require that we pre-trace all files so that we can cross-reference them in the stream. If we don't do this and they're traced as they come into the stream, then we don't have all the information necessary to know whether or not a particular file will pass any of the filter tests above.

Tracer API

The API should should support the following:

var traced = trace('*.js');

// 1. Getting original pattern
gulp.src(traced.src);

// 2. Inserting into the middle of the stream
gulp.src(traced.src).pipe(traced);

// 3. Creating a vinyl-fs stream (same as #1)
traced.createStream();

Filter API

The filter API should support:

var traced = traced('*.js');

traced.createStream()
  // Unique files
  .pipe(traced.filter({ unique: true }))

  // Common files
  .pipe(traced.filter({ common: true }))

  // Matching origins
  .pipe(traced.filter({ origin: '**/main.js' }))

  // Combining rules
  .pipe(traced.filter({ unique: true, origin: '**/mai.js' }))

  // And combining rule sets (using logical "or")
  .pipe(traced.filter({ unique: true }, { origin: '**/main.js' }));

  // Restores the the last filter and removes it from the list.
  // You need to call this for every filter you add.
  .pipe(traced.restore())

Breaking changes

Since we now have to pre-trace for the tracer to be effective, the src parameter is now required. This is a breaking change because we didn't need to supply any arguments before. The opts argument is now specified as the second argument.

// before
galvatron.trace({ /* options */ });

// after
galvatron.trace(src, { /* options */ });

The new src parameter can be anything that can be passed to node-glob-all.

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.