Files
meteor/packages/package-version-parser/package.js
David Greenspan e885e78348 Change the format returned by PVP.parseConstraint
This is a breaking change to package-version-parser.

A PackageConstraint used to look like this:

```
{ name: String,
  constraintString: String,
  constraints: [{version: String|null,
                 type: String}]}
```

Now it looks like this:
```
{ name: String,
  constraintString: String,
  vConstraint: {
    raw: String,
    alternatives: [{versionString: String|null,
                    type: String}]}}
```

Where (vConstraint instanceof VersionConstraint) and
(vConstraint.raw === constraintString).

This achieves several desirable changes at once.

* `constraint.constraints` for the disjuncts in “1.0.0||2.0.0”
  was confusing.  `alternatives` is better.
* Having a class for VersionConstraint will come in handy because
  we can add methods to it, and we can use it in the constraint
  solver to represent the problem statement.
* The names “vConstraint” and “versionString” are a little verbose,
  but there really shouldn’t be a lot of code that dives into this
  structure, and I really wanted to avoid anyone ever writing:
  `constraint.constraint.alternatives[0].version`, and then wondering
  what sort of object that was (not a parsed PackageVersion! we could
  parse eagerly but that might be slow).
2015-01-07 20:10:44 -08:00

18 lines
422 B
JavaScript

Package.describe({
summary: "Parses Meteor Smart Package version strings",
version: "3.0.0"
});
Package.onUse(function (api) {
api.export('PackageVersion');
api.use('underscore');
api.addFiles(['semver410.js',
'package-version-parser.js']);
});
Package.onTest(function (api) {
api.use('package-version-parser');
api.use(['tinytest']);
api.addFiles('package-version-parser-tests.js');
});