-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verify version when resolving Node builtin polyfills (#8387)
- Loading branch information
Showing
9 changed files
with
172 additions
and
124 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// @flow strict-local | ||
import path from 'path'; | ||
|
||
import {normalizeSeparators} from './path'; | ||
|
||
/** | ||
* Returns the package name and the optional subpath | ||
*/ | ||
export default function getModuleParts(_name: string): [string, ?string] { | ||
let name = path.normalize(_name); | ||
let splitOn = name.indexOf(path.sep); | ||
if (name.charAt(0) === '@') { | ||
splitOn = name.indexOf(path.sep, splitOn + 1); | ||
} | ||
if (splitOn < 0) { | ||
return [normalizeSeparators(name), undefined]; | ||
} else { | ||
return [ | ||
normalizeSeparators(name.substring(0, splitOn)), | ||
name.substring(splitOn + 1) || undefined, | ||
]; | ||
} | ||
} |
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
Oops, something went wrong.