-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add symlink link: dependency type (fixes #884)
- Loading branch information
Showing
9 changed files
with
115 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* @flow */ | ||
|
||
import type {FetchedOverride} from '../types.js'; | ||
import BaseFetcher from './base-fetcher.js'; | ||
|
||
export default class LinkFetcher extends BaseFetcher { | ||
_fetch(): Promise<FetchedOverride> { | ||
// nothing to fetch | ||
return Promise.resolve({ | ||
hash: this.hash || '', | ||
resolved: null, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* @flow */ | ||
|
||
import type {Manifest} from '../../types.js'; | ||
import type {RegistryNames} from '../../registries/index.js'; | ||
import type PackageRequest from '../../package-request.js'; | ||
import ExoticResolver from './exotic-resolver.js'; | ||
import * as util from '../../util/misc.js'; | ||
|
||
const path = require('path'); | ||
|
||
export default class FileResolver extends ExoticResolver { | ||
constructor(request: PackageRequest, fragment: string) { | ||
super(request, fragment); | ||
this.loc = util.removePrefix(fragment, 'link:'); | ||
} | ||
|
||
loc: string; | ||
|
||
static protocol = 'link'; | ||
|
||
resolve(): Promise<Manifest> { | ||
let loc = this.loc; | ||
if (!path.isAbsolute(loc)) { | ||
loc = path.join(this.config.cwd, loc); | ||
} | ||
|
||
const registry: RegistryNames = 'npm'; | ||
const manifest: Manifest = {_uid: '', name: '', version: 'link', _registry: registry}; | ||
|
||
manifest._remote = { | ||
type: 'link', | ||
registry, | ||
reference: loc, | ||
}; | ||
|
||
manifest._uid = manifest.version; | ||
|
||
return Promise.resolve(manifest); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters