diff options
Diffstat (limited to 'deps/npm/html/doc/files/npm-json.html')
-rw-r--r-- | deps/npm/html/doc/files/npm-json.html | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/deps/npm/html/doc/files/npm-json.html b/deps/npm/html/doc/files/npm-json.html index 9dbb57d6d2a..bcb0a56bf8b 100644 --- a/deps/npm/html/doc/files/npm-json.html +++ b/deps/npm/html/doc/files/npm-json.html @@ -3,6 +3,7 @@ <title>package.json</title> <meta http-equiv="content-type" value="text/html;utf-8"> <link rel="stylesheet" type="text/css" href="../../static/style.css"> + <link rel="canonical" href="https://www.npmjs.org/doc/files/package.json.html"> <script async=true src="../../static/toc.js"></script> <body> @@ -310,7 +311,7 @@ a tarball or git URL.</p> <p>See <a href="../misc/semver.html">semver(7)</a> for more details about specifying version ranges.</p> -<ul><li><code>version</code> Must match <code>version</code> exactly</li><li><code>>version</code> Must be greater than <code>version</code></li><li><code>>=version</code> etc</li><li><code><version</code></li><li><code><=version</code></li><li><code>~version</code> "Approximately equivalent to version" See <a href="../misc/semver.html">semver(7)</a></li><li><code>1.2.x</code> 1.2.0, 1.2.1, etc., but not 1.3.0</li><li><code>http://...</code> See 'URLs as Dependencies' below</li><li><code>*</code> Matches any version</li><li><code>""</code> (just an empty string) Same as <code>*</code></li><li><code>version1 - version2</code> Same as <code>>=version1 <=version2</code>.</li><li><code>range1 || range2</code> Passes if either range1 or range2 are satisfied.</li><li><code>git...</code> See 'Git URLs as Dependencies' below</li><li><code>user/repo</code> See 'GitHub URLs' below</li></ul> +<ul><li><code>version</code> Must match <code>version</code> exactly</li><li><code>>version</code> Must be greater than <code>version</code></li><li><code>>=version</code> etc</li><li><code><version</code></li><li><code><=version</code></li><li><code>~version</code> "Approximately equivalent to version" See <a href="../misc/semver.html">semver(7)</a></li><li><code>^version</code> "Compatible with version" See <a href="../misc/semver.html">semver(7)</a></li><li><code>1.2.x</code> 1.2.0, 1.2.1, etc., but not 1.3.0</li><li><code>http://...</code> See 'URLs as Dependencies' below</li><li><code>*</code> Matches any version</li><li><code>""</code> (just an empty string) Same as <code>*</code></li><li><code>version1 - version2</code> Same as <code>>=version1 <=version2</code>.</li><li><code>range1 || range2</code> Passes if either range1 or range2 are satisfied.</li><li><code>git...</code> See 'Git URLs as Dependencies' below</li><li><code>user/repo</code> See 'GitHub URLs' below</li></ul> <p>For example, these are all valid:</p> @@ -396,6 +397,40 @@ can consume the functionality without requiring them to compile it themselves. In dev mode (ie, locally running <code>npm install</code>), it'll run this script as well, so that you can test it easily.</p> +<h2 id="peerDependencies">peerDependencies</h2> + +<p>In some cases, you want to express the compatibility of your package with an +host tool or library, while not necessarily doing a <code>require</code> of this host. +This is usually refered to as a <em>plugin</em>. Notably, your module may be exposing +a specific interface, expected and specified by the host documentation.</p> + +<p>For example:</p> + +<pre><code>{ + "name": "tea-latte", + "version": "1.3.5" + "peerDependencies": { + "tea": "2.x" + } +}</code></pre> + +<p>This ensures your package <code>tea-latte</code> can be installed <em>along</em> with the second +major version of the host package <code>tea</code> only. The host package is automatically +installed if needed. <code>npm install tea-latte</code> could possibly yield the following +dependency graph:</p> + +<pre><code>├── tea-latte@1.3.5 +└── tea@2.2.0</code></pre> + +<p>Trying to install another plugin with a conflicting requirement will cause an +error. For this reason, make sure your plugin requirement is as broad as +possible, and not to lock it down to specific patch versions.</p> + +<p>Assuming the host complies with <a href="http://semver.org/">semver</a>, only changes in +the host package's major version will break your plugin. Thus, if you've worked +with every 1.x version of the host package, use <code>"^1.0"</code> or <code>"1.x"</code> to express +this. If you depend on features introduced in 1.5.2, use <code>">= 1.5.2 < 2"</code>.</p> + <h2 id="bundledDependencies">bundledDependencies</h2> <p>Array of package names that will be bundled when publishing the package.</p> @@ -554,5 +589,5 @@ ignored.</p></li></ul> <tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr> <tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr> </table> -<p id="footer">package.json — npm@1.4.6</p> +<p id="footer">package.json — npm@1.4.8</p> |