treshugart / galvatron Goto Github PK
View Code? Open in Web Editor NEWSuite of Gulp plugins for streamlining your JavaScript builds.
License: MIT License
Suite of Gulp plugins for streamlining your JavaScript builds.
License: MIT License
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';
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));
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.
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.
Maybe something like:
galvatron().file.expire();
The bower.json's main
field allows the user to also specify an array. Should we search the array for .js
files or just ignore the bower.json if main
is an array
?
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.
We have support for AMD in the globalizer but we need to add a matcher for it.
Getting this error:
SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'
Seems we might not be able to use detective-cjs because I don't think there's an option to ignore ES6 code.
References #35.
Instead of using an object literal, we should use an array.
Almond expects to work with named defines, so when globalize transforms an unnamed define it breaks when it calls to the actual define
(which is almond's define) (calling through to the actual define
was introduced in b06bc0c).
It should return an empty array. Other properties that do a similar thing should also be looked at to ensure they also return an empty array.
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.
In the globalize transform when calling through to the real define
it doesn't pass along the name of the module for named defines.
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.
Just opening this one as something to explore for those that don't want to use streams.
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?
Tracer should support an optional API to filter files based on:
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.
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();
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())
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.