@parcel/utils 2.0.0-nightly.1162 → 2.0.0-nightly.1164
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +1207 -68
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
- package/src/getModuleParts.js +23 -0
- package/src/index.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/utils",
|
|
3
|
-
"version": "2.0.0-nightly.
|
|
3
|
+
"version": "2.0.0-nightly.1164+527e477d1",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@parcel/codeframe": "2.0.0-nightly.
|
|
37
|
-
"@parcel/diagnostic": "2.0.0-nightly.
|
|
38
|
-
"@parcel/hash": "2.7.1-nightly.
|
|
39
|
-
"@parcel/logger": "2.0.0-nightly.
|
|
40
|
-
"@parcel/markdown-ansi": "2.0.0-nightly.
|
|
36
|
+
"@parcel/codeframe": "2.0.0-nightly.1164+527e477d1",
|
|
37
|
+
"@parcel/diagnostic": "2.0.0-nightly.1164+527e477d1",
|
|
38
|
+
"@parcel/hash": "2.7.1-nightly.2787+527e477d1",
|
|
39
|
+
"@parcel/logger": "2.0.0-nightly.1164+527e477d1",
|
|
40
|
+
"@parcel/markdown-ansi": "2.0.0-nightly.1164+527e477d1",
|
|
41
41
|
"@parcel/source-map": "^2.0.0",
|
|
42
42
|
"chalk": "^4.1.0"
|
|
43
43
|
},
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"./src/http-server.js": false,
|
|
64
64
|
"./src/openInBrowser.js": false
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "527e477d15441219216ed05b220cf8d48fa2d258"
|
|
67
67
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @flow strict-local
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
import {normalizeSeparators} from './path';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns the package name and the optional subpath
|
|
8
|
+
*/
|
|
9
|
+
export default function getModuleParts(_name: string): [string, ?string] {
|
|
10
|
+
let name = path.normalize(_name);
|
|
11
|
+
let splitOn = name.indexOf(path.sep);
|
|
12
|
+
if (name.charAt(0) === '@') {
|
|
13
|
+
splitOn = name.indexOf(path.sep, splitOn + 1);
|
|
14
|
+
}
|
|
15
|
+
if (splitOn < 0) {
|
|
16
|
+
return [normalizeSeparators(name), undefined];
|
|
17
|
+
} else {
|
|
18
|
+
return [
|
|
19
|
+
normalizeSeparators(name.substring(0, splitOn)),
|
|
20
|
+
name.substring(splitOn + 1) || undefined,
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export {default as countLines} from './countLines';
|
|
|
11
11
|
export {default as generateBuildMetrics} from './generateBuildMetrics';
|
|
12
12
|
export {default as generateCertificate} from './generateCertificate';
|
|
13
13
|
export {default as getCertificate} from './getCertificate';
|
|
14
|
+
export {default as getModuleParts} from './getModuleParts';
|
|
14
15
|
export {default as getRootDir} from './getRootDir';
|
|
15
16
|
export {default as isDirectoryInside} from './isDirectoryInside';
|
|
16
17
|
export {default as isURL} from './is-url';
|