A normal dependency of X on Y consists of a "must-use" constraint ("if X is
loaded, Y must be loaded too") and an "ordering" constraint ("if X and Y are
both loaded, Y must be loaded before X").
The previously-existing support for "unordered" dependencies allows you to
create a dependency with "must-use" but not "ordering". This commit adds "weak"
dependencies, which have "ordering" but not "must-use".
As an example, the accounts-base package wants to define some Handlebars helpers
like {{currentUser}} if the handlebars package is being used, but it's fine to
use accounts-base without handlebars. So it should declare a weak dependency on
handlebars.
A package can tell if another package has already been loaded by checking to see
if `Packages.foo` exists. (So as a result, even slices which export no variables
get a `Packages.foo = {}` line.) Weak dependencies do not import symbols into
your namespace; you must access their symbols through
`Packages.foo.someExportedSymbol`. You don't get to use plugins from your weak
dependency.
@export is now an error in test slices.
This is preparation for ensuring that any slice with exports has at least
"Package.foo = {}"; without this commit, both the use and test slice would (with
that change) try to overwrite Package.foo.
Remove the attempt to allow @export in 'use strict' CoffeeScript files:
ECMAScript 'use strict' is fundamentally incompatible with our implementation of
exports, and it was probably a bug that this used to work at all.
You must declare your @exports using single-line ### comments:
### @export x ###
x = 5
This involves some ugly and not 100% correct low-level source hackery, making
some assumptions about the format that CoffeeScript generates.
The change I care about is that single-line ### comments get output as
single-line /**/ comments, which is what linker's @keyword parser is looking
for.
CoffeeScript doesn't allow you to assign to global variables using variable
assignment syntax (though you can assign properties to the global object), which
is the way to create package-level shared variables in Meteor. This commit
provides a CoffeeScript-specific to share variables between files in a package
without adding a redundant alternative for JavaScript files: simply assign
properties on the symbol `shared`.
Apply this to the current tree, which deletes the unused .npm directory from the
ctl package.
Specifically, this deletes the ".npm/package" or ".npm/plugin/foo" directory. We
don't attempt to also clean up the ".npm/plugin" or ".npm" directory, but a "git
clean -df" will do the trick if you really care.
We were looking at "argv._" to find package names, where that was the argv that
was parsed at the top level, where we had no idea that "--production" was a
boolean, so it was pased as "--production=onepackage" and "onepackage" was not
included in argv._.