Meteor 0.6.0 is out!

306 views
Skip to first unread message

David Glasser

unread,
Apr 4, 2013, 3:30:54 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
http://www.meteor.com/blog/2013/04/04/meteor-060-brand-new-distribution-system-app-packages-npm-integration

Very excited to get this out there! Thanks to the community for all
the feedback during development.

meteor update now!

--dave

Dror Matalon

unread,
Apr 4, 2013, 3:41:47 PM4/4/13
to meteo...@googlegroups.com
Awesome.

I really like:
Meteor packages, including private application packages, can depend
on NPM modules, using the new Npm.depends directive in their
package.js file.

Is the package system documented yet?
> --
> You received this message because you are subscribed to the Google Groups "meteor-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to meteor-core...@googlegroups.com.
> To post to this group, send email to meteo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/meteor-core?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Andrew Wilcox

unread,
Apr 4, 2013, 3:58:49 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Suggest you might like to add a small note for CoffeeScript to the blog post / release notes:
 
We've added file-level JavaScript variable scoping. Variables declared with var at the outermost level of a JavaScript source file are now private to that file. Remove the var to share a value between files.

+  (If you're using CoffeeScript, see http://docs.meteor.com/#coffeescript for how to share a value between files).

Tarang Patel

unread,
Apr 4, 2013, 4:07:14 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Engine looks slick! 

I ran into a bit of trouble with an older project though. I used to use __meteor_bootstrap__.require but now it looks like I have to have a package and use npm.depends & npm.require. Is there a way of using a npm module direcly?

David Glasser

unread,
Apr 4, 2013, 4:15:21 PM4/4/13
to meteo...@googlegroups.com
There aren't docs for the packages API yet, but it hasn't stopped 90+
folks on Atmosphere from figuring it out :)

In all seriousness: if you take a peek at the 'linker' branch you'll
see some heavy refactoring from Geoff. The past year+ has taught us
what parts of the package API are great and what need to be fixed, and
we're going to wait for full docs until we've gotten rid of the parts
of the API that are easier to improve than to document :)

David Glasser

unread,
Apr 4, 2013, 4:17:25 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
You can use Npm.require instead of __meteor_bootstrap__.require. If
you're just pulling in things that ship with Node, that's all you need
to do. If you're trying to pull in another Npm module, use Npm.depends
in a package.js inside a package (eg, in your app,
APP/packages/somepackage/package.js), then use Npm.require from within
the package.
> --
> You received this message because you are subscribed to the Google Groups
> "meteor-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to meteor-talk...@googlegroups.com.

matt debergalis

unread,
Apr 4, 2013, 4:19:38 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Good idea.  Added to the blog post.

Tarang Patel

unread,
Apr 4, 2013, 5:03:49 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
OK thats great! Personally I like that idea because this way we'll see lots of node-meteor packages and know which ones are going to work!

I'm having a bit of trouble with Fiber(), is it also scoped out? I'm trying to get Tom Coleman's router to work but having a bit of trouble. Do i have to use Npm.require to make a new fiber declaration?

Avital Oliver

unread,
Apr 4, 2013, 5:07:09 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
You'll need to access Fiber using:

var Fiber = Npm.require('fibers');


You received this message because you are subscribed to the Google Groups "meteor-core" group.

To unsubscribe from this group and stop receiving emails from it, send an email to meteor-core...@googlegroups.com.
To post to this group, send email to meteo...@googlegroups.com.
Visit this group at http://groups.google.com/group/meteor-core?hl=en.

Tarang Patel

unread,
Apr 4, 2013, 5:17:19 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Fast response! Yes so everythings working & running smooth with engine'd 0.60! Thanks guys

Avital Oliver

unread,
Apr 4, 2013, 5:24:42 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
You have to create a small wrapper package in your app. I'm about to publish a small example to Github.


On Thu, Apr 4, 2013 at 2:22 PM, Stephan Tual <stepha...@gmail.com> wrote:
Great! But how can we use Npm.depends?

I'm trying to create a package.js in the root of my app, then just type in:
Npm.depends 'node-blahblah'

This throws:

app/package.js:1
(function(Npm){Npm.depends 'node-blahblah'
                           ^^^^^^^^^^^^^^
SyntaxError: Unexpected string

Avital Oliver

unread,
Apr 4, 2013, 6:39:21 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Here's a small example of using an NPM package in your app. https://github.com/avital/meteor-xml2js-npm-demo

David Glasser

unread,
Apr 4, 2013, 8:44:08 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Ken, are you sure about that? I specifically tested that that should
work, though that code underwent a lot of changes in the past week. Is
this fully reproducible?

--dave

On Thu, Apr 4, 2013 at 4:20 PM, Ken Yee <ken...@gmail.com> wrote:
> Forgot to mention that if you break stuff w/ a change in the /packages
> subdirectory, meteor doesn't sense when you change the files in that
> directory...you have to bounce the server to get it to look over your
> package.js again...

Nick Martin

unread,
Apr 4, 2013, 10:56:31 PM4/4/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Hi Stan,

Try moving the node_modules directory in your homedir somewhere else. It looks like you have an old version of Fibers there that is being picked up by node over the one that ships with meteor.

It's also curious that Meteor is trying to use fibers from your homedir. Do you have the NODE_PATH environment variable set?

-- Nick


On Thu, Apr 4, 2013 at 7:48 PM, Stan <say...@gmail.com> wrote:
Hi guys, I encountered a problem while upgrading to Meteor 0.6.0 on Mac Lion.

What i did:
mac$ meteor update

After downloading, error pops up

/Users/stan/node_modules/fibers/fibers.js:5
    throw new Error(
          ^
Error: `node` has a newer mtime than `fiber`; it is possible your build is out of date. This could happen if you upgrade node. Try `npm rebuild fibers` to rebuild. If that doesn't work you could consider running `touch /Users/stan/node_modules/fiberssrc/fibers` and maybe there won't be a problem.

Then i did a

mac$ npm rebuild fibers

and it passes.

I then did the update thing again.

mac$ sudo meteor update

/Users/stan/.meteor/tools/54fc781f89/tools/meteor.js:2
Fiber(function () {
^
TypeError: object is not a function
    at Object.<anonymous> (/Users/stan/.meteor/tools/54fc781f89/tools/meteor.js:2:1)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Stuck now, I'm not sure what to make of it - hoping to get your help.

Thanks!
--

Justin McCandless

unread,
Apr 5, 2013, 5:53:29 AM4/5/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Andrew Wilcox,

    Thank you so much for posting this, I was wondering what coffeescript users were supposed to do with the new var/no var thing.


Justin McCandless
justinmccandless.com
@justinjmcc

Avital Oliver

unread,
Apr 5, 2013, 12:48:00 PM4/5/13
to meteo...@googlegroups.com, meteo...@googlegroups.com

I think this happened even without NODE_PATH set because node's `require` looks up the directory tree for directories named 'node_modules'.

On Apr 4, 2013 10:32 PM, "Stan" <say...@gmail.com> wrote:
Hey Nick, thanks for getting back.

I've removed the node_modules directory and it seems fine now. Also I didn't have the NODE_PATH envir vars set. Anyhoo, it's working after removing the nodes_module directory.

Thanks for your help again.

fritz....@gmail.com

unread,
Apr 5, 2013, 2:41:40 PM4/5/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Awesome stuff. However - having migrated all my packages and tests I found the `meteor test-packages` command very frustrating. When testing my application (and it's packages) I don't want to test the framework as well (as I suppose you do ship a "all green" software). Especially those long-running tests make it a hard-time to write custom tests. Maybe there's a way to only test one package (e.g. `meteor test-packages {package}`) or exclude the core packages?

Avital Oliver

unread,
Apr 5, 2013, 2:50:11 PM4/5/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
'meteor test-packages' indeed accepts argument(s) for which packages to test. Run 'meteor test-packages --help' for more information.


--

fritz....@gmail.com

unread,
Apr 5, 2013, 3:07:02 PM4/5/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
That does the trick - thanks a lot!

David Glasser

unread,
Apr 5, 2013, 3:29:25 PM4/5/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
So, eg, "meteor test-packages packages/*"
> "meteor-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to meteor-core...@googlegroups.com.
> To post to this group, send email to meteo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/meteor-core?hl=en.

Micha Roon

unread,
Apr 6, 2013, 3:54:12 AM4/6/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
thank you for the example. It is precisely xml2js which I want to inclue.

Peter Aschenbrenner

unread,
Apr 6, 2013, 8:42:11 AM4/6/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Thx for the example.

I tried to create a wrapper package for the crypto module. I created the packages subfolder, the package.js and a file which requires the module (see below).

However meteor is throwing the following error: 

Error: Cannot find module 'MyProjectPath/.meteor/local/build/app/packages/cryptomodule/node_modules/crypto'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    ...

It seems that meteor doesn't copy the the node module to .meteor/local/... The module's content was properly downloaded and exists in my project's packages folder under 'MyProjectPath/packages/cryptomodule/.npm/node_modules/crypto'

What am I missing? Do I need to manually copy file within these folder?  Before 0.6.0 everything worked fine when I just required the cryptomodule.

THX
Peter

Here are my files:

package.js:
>>> start
Package.describe({
  summary: "Server package that encapsulates the NPM crypto module"
});

Npm.depends({crypto: "0.0.3"});

Package.on_use(function (api) {
  api.add_files("cryptomodule.js", "server");
});

CryptoModule.js:
>>> start
CryptoModule = {};

var cryptoModule = Npm.require("crypto");

CryptoModule.createMD5Hash = function(text) {
return cryptoModule.createHash("md5").update(text).digest("hex");
};


David Glasser

unread,
Apr 6, 2013, 2:05:25 PM4/6/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Can you make your app available as a clonable repo to test this?
> --
> You received this message because you are subscribed to the Google Groups
> "meteor-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to meteor-core...@googlegroups.com.
> To post to this group, send email to meteo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/meteor-core?hl=en.

David Glasser

unread,
Apr 6, 2013, 2:06:33 PM4/6/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
It means that if you have `var x = 42;`, you can't use x outside that
file. There wasn't an easy way to say "this variable is only for this
file" before, and now there is, just like in Node.js. If you want it
to be shared with other files, just write `x = 42;` instead.

On Sat, Apr 6, 2013 at 4:11 AM, Kevin Kaland <ad...@wizonesolutions.com> wrote:
> Do you have a good example of:
>
>>> We've added file-level JavaScript variable scoping. Variables declared
> with `var` at the outermost level of a JavaScript source file are now
> private to that file. Remove the `var` to share a value between files.
>
> ?
>
> In practice that probably wouldn't burn apps too hard, but would be good to
> understand what it means.
>
> On Thursday, April 4, 2013 9:30:54 PM UTC+2, David Glasser wrote:
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "meteor-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to meteor-talk...@googlegroups.com.

David Glasser

unread,
Apr 6, 2013, 5:14:05 PM4/6/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Ah!

crypto is a built in module that comes with Node.

There is also an NPM module called crypto, but it's not actually the
one you want! In fact, it's pretty broken: it looks like it's
impossible to require it.

But it's not the one you want anyway. The module you want is the built
in module (that's the API you're using). So just remove the
Npm.depends call and you'll be fine --- Npm.require will get you the
built in crypto, if you don't ask specifically for the broken NPM
crypto. (BTW, Npm.require to get a built in module will work in apps
too.)

On Sat, Apr 6, 2013 at 5:42 AM, Peter Aschenbrenner
<goodnews...@gmail.com> wrote:
> --
> You received this message because you are subscribed to the Google Groups
> "meteor-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to meteor-core...@googlegroups.com.
> To post to this group, send email to meteo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/meteor-core?hl=en.

Peter Aschenbrenner

unread,
Apr 7, 2013, 3:22:46 PM4/7/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
thx

I completely removed the internal package since I don't see any architectural benefit of encapsulating the internal node modules.

really appreciate what you are doing here

Andreas Karlsson

unread,
Apr 7, 2013, 5:08:49 PM4/7/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Yeah I've bumped into this problem as well. Seems just having a node_modules in any parent dir of your app, will break meteor bundling. It works the first time after adding a Npm.depends but the modules will be installed in the "parent" node_modules. Next time you run meteor it will complain:
Error: Corrupted .npm directory -- can't find npm-shrinkwrap.json ...

Avital Oliver

unread,
Apr 7, 2013, 6:46:25 PM4/7/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Thanks Andreas, I've been trying to figure out a repro for the "Corrupted .npm directory" error. I'll try to find a fix.


You received this message because you are subscribed to the Google Groups "meteor-core" group.

To unsubscribe from this group and stop receiving emails from it, send an email to meteor-core...@googlegroups.com.
To post to this group, send email to meteo...@googlegroups.com.
Visit this group at http://groups.google.com/group/meteor-core?hl=en.

Andreas Karlsson

unread,
Apr 7, 2013, 6:52:49 PM4/7/13
to meteo...@googlegroups.com, meteo...@googlegroups.com
Actually I just filed a PR with a simple fix for this problem (https://github.com/meteor/meteor/pull/927).

Avital Oliver

unread,
Apr 7, 2013, 7:11:57 PM4/7/13
to meteo...@googlegroups.com
Awesome, merged!
Reply all
Reply to author
Forward
0 new messages