-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add cat
#5
Comments
Likely would use @ef4's source map aware concat internally. |
Can we close this as |
We likely do need cat to combine |
|
Afk ATM. It should work like cat normally does When I get home I'll flesh out the issue :) |
This isn't really helpful to me without some syntax examples. I'm sorry for being dense.
Sounds good. |
Ya I agree. I'll flesh out the design asap |
the following might be a good starting point: cat is M:1 transform with the following signature
points:
questions:
|
I wonder if cat can be even more general purpose. cat(tree, '**/*.js', transform); where @rwjblue / @chadhietala / @Rich-Harris thoughts? |
Not sure I understand what the |
map is 1:1, cat is M:N (primarily M:1) but both likely want to optionally delegate functionality to arbitrary transforms. An example to help illustrate my early thoughts cat **/*.js | es6ModuleBundler > out.js # M:1 cat(tree, '**/*.js', es6ModuleBundler(options), 'out.js'); // M:1 map(tree, '**/*.js', 6to5(options)); // 1:1 maybe: var pipeline = [
es6ModuleBundler(options),
write('out.js')
];
cat(tree, '**/*.js', ...moreGlobs, pipeline); // M:1 |
In the examples above aren't we forcing transforms to be closures? What might be better is to just do. function pipeline(tree) {
var es6 = 6to5(tree, {...});
es6 = es3SafeRecast(es6);
return write('out.js');
}
var dist = cat(tree, '**/*.js', ...moreGlobs, pipeline); This approach is leaky though because the developer needs to know that they need to return a The approach below forces developers into defining a resulting file like in the stdout example above. function pipeline(tree) {
var es6 = 6to5(tree, {...});
return es3SafeRecast(es6)
}
var dist = cat(tree, '**/*.js', ...moreGlobs, pipeline, 'out.js');
// or
var dist = cat(tree, '**/*.js', ...moreGlobs, 'out.js'); |
I suppose we could create |
hmm nice, i like the, |
https://www.npmjs.com/package/magic-string might be interesting re: source maps cc @chadhietala |
Comparing the source of fast-source-map-concat and magic string, it seems magic string sourcemap concating would be faster. |
this would allow someone to quickly
cat
changed files contents into a function for simple transformsThe text was updated successfully, but these errors were encountered: