tar 6.1.10 → 6.1.11
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/normalize-unicode.js +11 -0
- package/lib/path-reservations.js +4 -5
- package/lib/strip-trailing-slashes.js +10 -21
- package/lib/unpack.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// warning: extremely hot code path.
|
|
2
|
+
// This has been meticulously optimized for use
|
|
3
|
+
// within npm install on large package trees.
|
|
4
|
+
// Do not edit without careful benchmarking.
|
|
5
|
+
const normalizeCache = Object.create(null)
|
|
6
|
+
const {hasOwnProperty} = Object.prototype
|
|
7
|
+
module.exports = s => {
|
|
8
|
+
if (!hasOwnProperty.call(normalizeCache, s))
|
|
9
|
+
normalizeCache[s] = s.normalize('NFKD')
|
|
10
|
+
return normalizeCache[s]
|
|
11
|
+
}
|
package/lib/path-reservations.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// while still allowing maximal safe parallelization.
|
|
8
8
|
|
|
9
9
|
const assert = require('assert')
|
|
10
|
-
const
|
|
10
|
+
const normalize = require('./normalize-unicode.js')
|
|
11
11
|
const stripSlashes = require('./strip-trailing-slashes.js')
|
|
12
12
|
const { join } = require('path')
|
|
13
13
|
|
|
@@ -28,7 +28,7 @@ module.exports = () => {
|
|
|
28
28
|
const getDirs = path => {
|
|
29
29
|
const dirs = path.split('/').slice(0, -1).reduce((set, path) => {
|
|
30
30
|
if (set.length)
|
|
31
|
-
path =
|
|
31
|
+
path = join(set[set.length - 1], path)
|
|
32
32
|
set.push(path || '/')
|
|
33
33
|
return set
|
|
34
34
|
}, [])
|
|
@@ -116,9 +116,8 @@ module.exports = () => {
|
|
|
116
116
|
// So, we just pretend that every path matches every other path here,
|
|
117
117
|
// effectively removing all parallelization on windows.
|
|
118
118
|
paths = isWindows ? ['win32 parallelization disabled'] : paths.map(p => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
.toLowerCase()
|
|
119
|
+
// don't need normPath, because we skip this entirely for windows
|
|
120
|
+
return normalize(stripSlashes(join(p))).toLowerCase()
|
|
122
121
|
})
|
|
123
122
|
|
|
124
123
|
const dirs = new Set(
|
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
'/'.repeat(1024),
|
|
6
|
-
'/'.repeat(512),
|
|
7
|
-
'/'.repeat(256),
|
|
8
|
-
'/'.repeat(128),
|
|
9
|
-
'/'.repeat(64),
|
|
10
|
-
'/'.repeat(32),
|
|
11
|
-
'/'.repeat(16),
|
|
12
|
-
'/'.repeat(8),
|
|
13
|
-
'/'.repeat(4),
|
|
14
|
-
'/'.repeat(2),
|
|
15
|
-
'/',
|
|
16
|
-
]
|
|
17
|
-
|
|
1
|
+
// warning: extremely hot code path.
|
|
2
|
+
// This has been meticulously optimized for use
|
|
3
|
+
// within npm install on large package trees.
|
|
4
|
+
// Do not edit without careful benchmarking.
|
|
18
5
|
module.exports = str => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
let i = str.length - 1
|
|
7
|
+
let slashesStart = -1
|
|
8
|
+
while (i > -1 && str.charAt(i) === '/') {
|
|
9
|
+
slashesStart = i
|
|
10
|
+
i--
|
|
22
11
|
}
|
|
23
|
-
return str
|
|
12
|
+
return slashesStart === -1 ? str : str.slice(0, slashesStart)
|
|
24
13
|
}
|
package/lib/unpack.js
CHANGED
|
@@ -17,6 +17,7 @@ const pathReservations = require('./path-reservations.js')
|
|
|
17
17
|
const stripAbsolutePath = require('./strip-absolute-path.js')
|
|
18
18
|
const normPath = require('./normalize-windows-path.js')
|
|
19
19
|
const stripSlash = require('./strip-trailing-slashes.js')
|
|
20
|
+
const normalize = require('./normalize-unicode.js')
|
|
20
21
|
|
|
21
22
|
const ONENTRY = Symbol('onEntry')
|
|
22
23
|
const CHECKFS = Symbol('checkFs')
|
|
@@ -101,8 +102,7 @@ const uint32 = (a, b, c) =>
|
|
|
101
102
|
// Note that on windows, we always drop the entire cache whenever a
|
|
102
103
|
// symbolic link is encountered, because 8.3 filenames are impossible
|
|
103
104
|
// to reason about, and collisions are hazards rather than just failures.
|
|
104
|
-
const cacheKeyNormalize = path => stripSlash(normPath(path))
|
|
105
|
-
.normalize('NFKD')
|
|
105
|
+
const cacheKeyNormalize = path => normalize(stripSlash(normPath(path)))
|
|
106
106
|
.toLowerCase()
|
|
107
107
|
|
|
108
108
|
const pruneCache = (cache, abs) => {
|
package/package.json
CHANGED