Commit Graph

34 Commits

Author SHA1 Message Date
Gabriel Grubba
31f928206d update semver in package version parser 2023-11-16 16:52:09 -03:00
Ben Newman
4a70b12edd Allow package-name@x.y.z! override syntax in .meteor/packages.
With this commit, if a top-level package version constraint in
.meteor/packages ends with a '!' character, any other (non-!) constraints
on that package elsewhere in the application will be weakened to accept
any version of the package that is not less than the constraint,
regardless of whether the major/minor versions actually match.

This functionality is extremely useful in cases where an unmaintained
package was last published with api.versionsFrom(<some ancient version>),
thus constraining the major version of any Meteor core package it depended
on, but you really want to upgrade that core package anyway. Just put a
'!' after the core package's version constraint in your .meteor/packages
file, and you will almost certainly get your way. The fact that minimum
versions are still enforced is good/fine because the constraints you want
to override are typically ancient, so they easily match any recent version
of the package.

Your only recourse before this @x.y.z! syntax was to find a replacement
for the unmaintained package, or fork and modify it locally, or somehow
persuade the package author to publish a new version with a more
reasonable api.versionsFrom. None of these options were easy.

Many thanks to @GeoffreyBooth, long-time maintainer of the `coffeescript`
package, for originally suggesting a ! syntax similar to this one:
https://github.com/meteor/meteor-feature-requests/issues/208#issuecomment-400154209

The limitation of this syntax to .meteor/packages is deliberate, since
overriding package version constraints is a power-tool that should be used
sparingly by application developers, and never abused by package authors.
Also, limiting the scope of this syntax reduces the risk of an arms race
between overrides, a la the infamous CSS !important modifier.
2018-08-14 20:27:23 -04:00
Ben Newman
cfdc69bf71 Support @~ version constraints and use them for core packages. (#8991) 2017-08-08 18:01:30 -04:00
Ben Newman
d3aff777a2 Modernize package-version-parser by using modules. (#8914)
Also removed the underscore dependency while I was at it.

cc @abernix @hwillson @fschaeffler

Prerequisite for #8859.
2017-07-23 11:31:35 -04:00
David Greenspan
601cfbcebd Don't re-parse versions during sorting; profiling
- We don't want to do a bunch of parsing *per comparison* when sorting
  a list of package version strings.  package-version-parser's `compare`
  (and server's `compare`, which it uses) both accept either a string
  or a parsed record.  By parsing explicitly with memoization, we avoid
  a super-linear blow-up in the amount of parsing.  This'll save someone
  half a second, at least.
- Adjust profiling hooks and messages
- Expose `Profile` to isopackets
2016-02-05 10:04:31 -08:00
Sashko Stubailo
aab90ea7c2 Merge branch 'windows-preview-0.2.1' into release-1.1
Conflicts:
	History.md
	packages/accounts-password/package.js
	packages/autoupdate/package.js
	packages/constraint-solver/package.js
	packages/less/package.js
	packages/meteor-tool/package.js
	packages/minifiers/package.js
	packages/observe-sequence/package.js
	packages/package-version-parser/package-version-parser.js
	packages/package-version-parser/package.js
	packages/templating/package.js
	packages/tracker/package.js
	scripts/admin/meteor-release-experimental.json
	tools/selftest.js
2015-03-20 17:52:29 -07:00
David Glasser
21bdac8734 Merge branch 'master' into devel
Conflicts:
	History.md
	packages/accounts-password/package.js
	packages/accounts-password/password_server.js
	packages/constraint-solver/package.js
	packages/meteor-tool/package.js
	packages/non-core/npm-bcrypt/package.js
	packages/package-version-parser/package-version-parser-tests.js
	packages/package-version-parser/package-version-parser.js
	packages/package-version-parser/package.js
	tools/selftest.js
2015-03-17 13:41:14 -07:00
Sashko Stubailo
efdfe62331 Validate number of colons in package name on create
Instead of in the general package version parser
2015-03-17 10:56:33 -07:00
Sashko Stubailo
c6ea68f9b3 Make meteor create --package not use prefix
It used to create a directory with an underscore instead of a colon
Now, it just removes the prefix.

In cases where the name of the package has more than one colon or starts or ends
witha colon, we report an error.
2015-03-12 17:57:27 -07:00
Sashko Stubailo
cffd5cc78d Merge branch 'release-1.0.4' into windows-preview-0.2.1
Conflicts:
	History.md
	packages/accounts-password/password_server.js
	packages/constraint-solver/package.js
	packages/meteor-tool/package.js
	packages/package-version-parser/package-version-parser.js
	packages/package-version-parser/package.js
	tools/selftest.js
2015-03-12 16:56:11 -07:00
David Greenspan
070ca69f9a Validate package names more strictly
In particular, ban leading `-`, trailing `.`, and `..` anywhere.

This backport commit drops the changes to constraint-solver and adds a
History.md note.
2015-03-10 15:20:36 -07:00
David Greenspan
08bc9ab002 Nicer errors when tool encounters bad package name
Verified manually that `meteor update asdf.` displays an error,
not a stack trace.

Include the offending name in all error messages (as we do for
invalid versions).
2015-03-10 13:58:27 -07:00
David Greenspan
f51a033e73 Validate package names more strictly
In particular, ban leading `-`, trailing `.`, and `..` anywhere.
2015-03-10 13:47:14 -07:00
David Greenspan
050fae168f Merge remote-tracking branch 'origin/devel' into use-logic-solver 2015-03-02 19:17:40 -08:00
Sashko Stubailo
e0c24cf7e4 Reapply PVP fix that we lost in merge from devel 2015-02-04 14:33:08 -08:00
Sashko Stubailo
b3cb7a49f7 Merge branch 'devel' into windows-cr
Conflicts:
	packages/application-configuration/package.js
	packages/ctl-helper/package.js
	packages/ctl/package.js
	packages/dev-bundle-fetcher/package.js
	packages/follower-livedata/package.js
	packages/jquery/package.js
	packages/star-translate/package.js
	packages/test-in-browser/package.js
	tools/bundler.js
	tools/compiler.js
	tools/package-client.js
	tools/package-source.js
	tools/package-version-parser.js
	tools/server/boot.js
2015-02-04 13:56:54 -08:00
Sashko Stubailo
f428b55e20 Stop having a copy of pvp 2015-01-22 16:12:07 -08:00
Sashko Stubailo
8b36243375 Update package version parser 2015-01-20 22:34:19 -08:00
Slava Kim
219357098a Temporarily copy-paste version-parser 2015-01-20 22:03:24 -08:00
Slava Kim
9db7c37737 Bad code: copy paste package-version-parser.js
The symlinks don't work that well on Windows.
This will require some other workaround.
2015-01-20 22:03:23 -08:00
David Glasser
5d5d1876da De-dup package name/constraint parsing code
Now we can all any of them from even before uniload is ready in the tool

I <3 symlinks
2014-08-21 17:00:21 -07:00
David Glasser
5bc415c51a Improve package name/version parsing errors
We now throw more specific errors, consistent between both tools and
package-version-parser (copy-and-pasted code, sadly, but we really do
have to make this check before uniload-from-checkout).
2014-08-21 16:21:12 -07:00
David Glasser
f39a820d96 Don't parse '@>=' ranges by default
They are still used internally by the constraint solver (to implement
update --breaking) but cannot be externally specified.

Also, stop supporting "@none", whatever that was.
2014-08-15 22:12:04 -07:00
David Glasser
4428f2b06d sync tests passes 2014-07-24 17:12:14 -07:00
David Glasser
6850b679e9 fix bug in 'meteor add x@=1.0.0'
Used to print a "avoid conflicting dependencies" message. Now doesn't.

Start moving some uses of splitConstraint to parseConstraint
2014-07-24 16:21:25 -07:00
David Glasser
8e2c97cd58 meteor update sorta works sometimes 2014-05-20 11:09:53 -07:00
Slava Kim
98d9a56a62 Extend the number of types of constraints from 2 to 3
Instead of having a "exact" flag, have a "type" field with 3 different values
2014-05-15 18:16:30 -07:00
ekatek
f2d3972857 integration mostly works except for bizarre constraint solver output bug 2014-05-09 15:15:45 -07:00
Geoff Schmidt
985ffea9fa WIP - make package build run the constraint solver.
move constraint solver from a package into the tool.
unipackage loading is broken; next step is to fix that
2014-03-12 19:02:47 -07:00
Slava Kim
926305bae0 Support "none" dependencies (no constraint) 2014-03-07 00:17:19 -08:00
Geoff Schmidt
63f13fbb87 Create the Catalog object 2014-03-06 21:56:47 -08:00
ekatek
876276418a add-pakage refined 2014-03-06 18:02:14 -08:00
Slava Kim
9dd40fa1db extract parseVersionConstraint from parseConstraint 2014-03-05 01:25:51 -08:00
Slava Kim
468f32bd80 package-version-parser package
first version of a package that parses smart package version string
2014-03-04 23:08:38 -08:00