-
Notifications
You must be signed in to change notification settings - Fork 7
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
Meteor and external libraries #1
Comments
I was working with an original library author to accept a PR for Meteor. Would that be an even better solution than wrapping through Famono? |
@dandv depends on the library - famous is nicely split up into smaller files, if they added a package.js all of the code would be added - so I'm not a fan - I think we should have better ways for reusing code and only add the code needed. At the moment MDG isnt concerned about footprint, I guess size doesnt matter and we could have some tool minimizing the code/dead code removal. But as far as I know, none of scoped functions can be matched up / linked. So we still have too much non-sharable code / more code to maintain / more errors etc.. So to me its more of a battle between order and chaos - where imho the chaos could be avoided. |
Oh wow, almost missed this, nice!
And yes, package dependencies... I thought a lot about it and have a very good idea of how this should work (I could put it down somewhere if you want and see if we see eye-to-eye) but it's a lot of work :) Versioning remains a big issue that we'll have to figure out. I think despite the initial pain MDG have done a good job here. |
Some non-famono-specific discussion: https://groups.google.com/forum/#!topic/meteor-core/DPd6XK4Ow-w Potential idea could be to integrate 3rd party package managers using the new namespacing:
|
This would be awesome. I wanted to do this, but if you guys do it, then yeah. :D jspm makes AMD/UMD/CJS/ES6 work interchangeably with each other. e.g. import AMDModule from "path/to/AMDModule" or var ES6Module = require("path/to/ES6Module") |
jspm pattern looks very similar to the meteor package naming. We could rig a wrapper farm enabling npm and bower - it wouldnt be too difficult - but who reserved |
bower reserved by @dandv for this purpose :) but is a wrapper farm the right approach? it's definitely the fastest, to work through the existing meteor package system. but i'm not sure i'd like to see wrapped packages showing up in atmosphere, nor the extra load of serving them, if it's something we can have the meteor tool do itself straight from npmjs / github. |
@gadicc @raix A wrapper farm just means you're lucky enough to own the username
This is exactly what jspm does. :D jspm install npm:async@=x.x.x jspm has a registry system. It's easy to create new registries. A registry could be used to store build info for each library to make each lib Meteor compatible. But that would also mean that someone needs to create a registry entry for each package if needed, still using man power (it's inevitable, somewhere in the production line it's needed since Metoer's packaging system is it's own system). IMHO, using jspm would be sweet to use for this. It's a single package manager for all module types. @guybedford has done amazing work with jspm, es6-module-loader, and systemjs and the projects are making super progress. Plus, when native ES6 Module systems finally land in browsers, jspm will be there to handle all the legacy AMD/CJS/UMD modules in harmony with ES6. It'd be pretty amazing to support/use jspm.
(with two colons?) for example, to install meteor-agnostic packages from places besides AtmosphereJS. This could translate to
behind the scenes. |
not sure @gadicc - I have to read up on the build tool etc. but at the moment @glasser seems to be on a sprint rewriting alot of the compiler/constraint resolver etc. But when it settles we could try to create a local package wrapper as a Meteor release - proof of concept. The current approach I'm puzzling with is:
The wrapped package could depend on a It might make sense to actually convert the bower package name into the git hub name (since most/all bower packages are on github?) - the reason for this is that if a package includes So it should become possible to do: meteor add github:Famous/[email protected]
# or
meteor add bower:[email protected] @dandv I'm glad you got the @trusktr It would be nice, but I'm not sure if jspm and the meteor build tool work of the same principles internally - Meteor resolves versions and builds the js code into a bundle - Should be investigated. Btw. The registry seems limited - imho we should be able to use all sources local/remote. EDIT: @trusktr could be two colons like |
What do you find limited about it? @guybedford has been super responsive and might be able to help us out with it. |
Now I'm thinking out loud... I'm working on some prototypes of package wrappers from bower/github/npm - since these will be useful in local/farm approach. I'm currently thinking of creating a small node-bower-wrapper that could be deployed on a server/farm and would keep 10 bower/npm packages updated on meteors package server. 10 packages for starters - at some point it could do the whole thing So the reason why the meteor package server publish would be nice is:
The downside is that
@trusktr the registry in their repo. |
I would hate to see the atmosphere package list junked up with more stuff for me to sift through. What do we really gain by having this automated approach? |
@queso Agree about spamming atmosphere - We gain having the version constraint resolver doing some work for us? Update: I'm in the works of writing/adding a |
Reserved |
@dandv its super - I'm deep in the meteor-tool, it overrules what ever, but if a problem we could use |
One reason mentioned multiple times is that for the server side you would not want just to provide a package, but also provide a blocking (fiber enabled) interface to otherwise callback-style API usually available in node.js packages. I do think that this is a valid argument. On the other hand, I do agree that there it should be easier to bring files into Meteor package, especially when they already have some packaging logic around, which combines files and so on, and then add on top of that blocking interface. |
I have a theory: a package (let's call it "meteor-webpack" for reference) being a dependency of a Meteor application could Since Meteor's API is stored in globals, any module in the bundle can access Meteor API. I think that an entry point (stored somewhere that meteor doesn't source) could This theory seems like it'd work for an application, but I'm not sure how it'd work for packages of an application. For example, suppose we want to make a package that depends on npm modules for the client side and we want to use that package in our app. Maybe meteor-webpack would load itself first, detect dependencies for all packages (???) @gadicc I was thinking about this because of gadicc/meteor-famous-views#166 (comment). I think that pre-including libraries in a package wouldn't be ideal (suppose your app depends on multiple packages that do this, and they all include different version of the same dependency). |
But, let me look at the meteor-include and isohouse prototype first! |
@trusktr would be nice to be able to use bower/npm with the version constraint solver but theres a lot of ways to Rome, the Meteor-include is just a package for the |
Using webpack for client code seems to be working nicely. The source code lives outside of the meteor folder, then webpack builds the bundle into the # in the project root
webpack # builds entry point from outside of meteor folder into meteor folder
(cd meteor && meteor)
var webpack = require('webpack')
module.exports = {
entry: "./src/app.js",
output: {
path: './meteor/public',
filename: "app.js"
}
} |
I started experimenting with meteor+webpack here: https://github.com/trusktr/meteor-with-webpack |
We should avoid writing pure wrapper packages.
Why:
Meteor wrapper:
Examples as language syntax:
Examples as current CLI and package.js api's:
Examples of CLI:
We could have a build farm that scans npm/bower/components/browserify and builds wrapped versions... But the folks holding usernames/org names as their meteor login would have to donate/release it.
We could create a meteor release where
bower:
/npm:
etc. were handled specially bymeteor add
or figure out who reserved thenpm:
andbower:
orgs on meteor and create a wrapper farm.References:
meteor/meteor#2798 (comment)
gadicc/meteor-famous-views#136
https://groups.google.com/forum/#!topic/meteor-core/DPd6XK4Ow-w
mquandalle/meteor-bower#38
meteor/meteor#2919
Todo: (having a proof of concept)
Ref to the proof of concept code:
$ meteor --release iso:[email protected]
allows:$ meteor add bower:[email protected]
or$ meteor add github:jashkenas:[email protected]
var myBowerUnderscore = Iso.require('bower:underscore/underscore');
The text was updated successfully, but these errors were encountered: