pnpm 10.21.0 → 11.0.0-alpha.0
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/bin/{pnpm.cjs → pnpm.mjs} +8 -7
- package/bin/{pnpx.cjs → pnpx.mjs} +1 -1
- package/dist/node_modules/.modules.yaml +11 -9
- package/dist/node_modules/.pnpm/lock.yaml +6 -6
- package/dist/node_modules/.pnpm-workspace-state-v1.json +1 -1
- package/dist/node_modules/minipass-flush/node_modules/yallist/package.json +29 -0
- package/dist/node_modules/minipass-pipeline/node_modules/yallist/LICENSE +15 -0
- package/dist/node_modules/minipass-pipeline/node_modules/yallist/iterator.js +8 -0
- package/dist/node_modules/minipass-pipeline/node_modules/yallist/package.json +29 -0
- package/dist/node_modules/minipass-pipeline/node_modules/yallist/yallist.js +426 -0
- package/dist/node_modules/minipass-sized/node_modules/yallist/LICENSE +15 -0
- package/dist/node_modules/minipass-sized/node_modules/yallist/iterator.js +8 -0
- package/dist/node_modules/minipass-sized/node_modules/yallist/package.json +29 -0
- package/dist/node_modules/minipass-sized/node_modules/yallist/yallist.js +426 -0
- package/dist/node_modules/p-map/index.js +7 -5
- package/dist/node_modules/p-map/package.json +1 -1
- package/dist/node_modules/yallist/package.json +51 -12
- package/dist/{pnpm.cjs → pnpm.mjs} +155059 -152964
- package/dist/worker.js +4232 -4512
- package/package.json +19 -12
- package/dist/node_modules/tar/node_modules/yallist/package.json +0 -68
- /package/dist/node_modules/{yallist → minipass-flush/node_modules/yallist}/LICENSE +0 -0
- /package/dist/node_modules/{yallist → minipass-flush/node_modules/yallist}/iterator.js +0 -0
- /package/dist/node_modules/{yallist → minipass-flush/node_modules/yallist}/yallist.js +0 -0
- /package/dist/node_modules/{tar/node_modules/yallist → yallist}/dist/commonjs/index.d.ts.map +0 -0
- /package/dist/node_modules/{tar/node_modules/yallist → yallist}/dist/commonjs/index.js +0 -0
- /package/dist/node_modules/{tar/node_modules/yallist → yallist}/dist/commonjs/index.js.map +0 -0
- /package/dist/node_modules/{tar/node_modules/yallist → yallist}/dist/commonjs/package.json +0 -0
- /package/dist/node_modules/{tar/node_modules/yallist → yallist}/dist/esm/index.d.ts.map +0 -0
- /package/dist/node_modules/{tar/node_modules/yallist → yallist}/dist/esm/index.js +0 -0
- /package/dist/node_modules/{tar/node_modules/yallist → yallist}/dist/esm/index.js.map +0 -0
- /package/dist/node_modules/{tar/node_modules/yallist → yallist}/dist/esm/package.json +0 -0
|
@@ -3,26 +3,27 @@ const [major, minor] = process.version.slice(1).split('.')
|
|
|
3
3
|
const COMPATIBILITY_PAGE = `Visit https://r.pnpm.io/comp to see the list of past pnpm versions with respective Node.js version support.`
|
|
4
4
|
|
|
5
5
|
// We don't use the semver library here because:
|
|
6
|
-
// 1. it is already bundled to dist/pnpm.
|
|
6
|
+
// 1. it is already bundled to dist/pnpm.mjs, so we would load it twice
|
|
7
7
|
// 2. we want this file to support potentially older Node.js versions than what semver supports
|
|
8
|
-
if (major <
|
|
9
|
-
console.error(`ERROR: This version of pnpm requires at least Node.js
|
|
8
|
+
if (major < 20 || major == 20 && minor < 19) {
|
|
9
|
+
console.error(`ERROR: This version of pnpm requires at least Node.js v20.19
|
|
10
10
|
The current version of Node.js is ${process.version}
|
|
11
11
|
${COMPATIBILITY_PAGE}`)
|
|
12
12
|
process.exit(1)
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
import * as module from 'module'
|
|
16
|
+
|
|
15
17
|
// We need to load v8-compile-cache.js separately in order to have effect
|
|
16
18
|
try {
|
|
17
|
-
|
|
18
|
-
if(!require('module')?.enableCompileCache?.())
|
|
19
|
-
require('v8-compile-cache');
|
|
19
|
+
module.enableCompileCache?.()
|
|
20
20
|
} catch {
|
|
21
21
|
// We don't have/need to care about v8-compile-cache failed
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
global['pnpm__startedAt'] = Date.now()
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
import {} from '../dist/pnpm.mjs'
|
|
26
27
|
|
|
27
28
|
// if you want to debug at your local env, you can use this
|
|
28
29
|
// require('../lib/pnpm')
|
|
@@ -16,9 +16,9 @@ hoistedLocations:
|
|
|
16
16
|
agent-base@7.1.4:
|
|
17
17
|
- node_modules/agent-base
|
|
18
18
|
ansi-regex@5.0.1:
|
|
19
|
+
- node_modules/wrap-ansi-cjs/node_modules/ansi-regex
|
|
19
20
|
- node_modules/strip-ansi-cjs/node_modules/ansi-regex
|
|
20
21
|
- node_modules/string-width-cjs/node_modules/ansi-regex
|
|
21
|
-
- node_modules/wrap-ansi-cjs/node_modules/ansi-regex
|
|
22
22
|
ansi-regex@6.2.2:
|
|
23
23
|
- node_modules/ansi-regex
|
|
24
24
|
ansi-styles@4.3.0:
|
|
@@ -44,8 +44,8 @@ hoistedLocations:
|
|
|
44
44
|
eastasianwidth@0.2.0:
|
|
45
45
|
- node_modules/eastasianwidth
|
|
46
46
|
emoji-regex@8.0.0:
|
|
47
|
-
- node_modules/string-width-cjs/node_modules/emoji-regex
|
|
48
47
|
- node_modules/wrap-ansi-cjs/node_modules/emoji-regex
|
|
48
|
+
- node_modules/string-width-cjs/node_modules/emoji-regex
|
|
49
49
|
emoji-regex@9.2.2:
|
|
50
50
|
- node_modules/emoji-regex
|
|
51
51
|
encoding@0.1.13:
|
|
@@ -103,8 +103,8 @@ hoistedLocations:
|
|
|
103
103
|
minipass-sized@1.0.3:
|
|
104
104
|
- node_modules/minipass-sized
|
|
105
105
|
minipass@3.3.6:
|
|
106
|
-
- node_modules/minipass-flush/node_modules/minipass
|
|
107
106
|
- node_modules/minipass-pipeline/node_modules/minipass
|
|
107
|
+
- node_modules/minipass-flush/node_modules/minipass
|
|
108
108
|
- node_modules/minipass-sized/node_modules/minipass
|
|
109
109
|
minipass@7.1.2:
|
|
110
110
|
- node_modules/minipass
|
|
@@ -118,7 +118,7 @@ hoistedLocations:
|
|
|
118
118
|
- node_modules/node-gyp
|
|
119
119
|
nopt@8.1.0:
|
|
120
120
|
- node_modules/nopt
|
|
121
|
-
p-map@7.0.
|
|
121
|
+
p-map@7.0.4:
|
|
122
122
|
- node_modules/p-map
|
|
123
123
|
package-json-from-dist@1.0.1:
|
|
124
124
|
- node_modules/package-json-from-dist
|
|
@@ -158,8 +158,8 @@ hoistedLocations:
|
|
|
158
158
|
string-width@5.1.2:
|
|
159
159
|
- node_modules/string-width
|
|
160
160
|
strip-ansi@6.0.1:
|
|
161
|
-
- node_modules/string-width-cjs/node_modules/strip-ansi
|
|
162
161
|
- node_modules/wrap-ansi-cjs/node_modules/strip-ansi
|
|
162
|
+
- node_modules/string-width-cjs/node_modules/strip-ansi
|
|
163
163
|
- node_modules/strip-ansi-cjs
|
|
164
164
|
strip-ansi@7.1.2:
|
|
165
165
|
- node_modules/strip-ansi
|
|
@@ -182,9 +182,11 @@ hoistedLocations:
|
|
|
182
182
|
wrap-ansi@8.1.0:
|
|
183
183
|
- node_modules/wrap-ansi
|
|
184
184
|
yallist@4.0.0:
|
|
185
|
-
- node_modules/yallist
|
|
185
|
+
- node_modules/minipass-pipeline/node_modules/yallist
|
|
186
|
+
- node_modules/minipass-flush/node_modules/yallist
|
|
187
|
+
- node_modules/minipass-sized/node_modules/yallist
|
|
186
188
|
yallist@5.0.0:
|
|
187
|
-
- node_modules/
|
|
189
|
+
- node_modules/yallist
|
|
188
190
|
included:
|
|
189
191
|
dependencies: true
|
|
190
192
|
devDependencies: true
|
|
@@ -192,9 +194,9 @@ included:
|
|
|
192
194
|
injectedDeps: {}
|
|
193
195
|
layoutVersion: 5
|
|
194
196
|
nodeLinker: hoisted
|
|
195
|
-
packageManager: pnpm@10.
|
|
197
|
+
packageManager: pnpm@10.22.0
|
|
196
198
|
pendingBuilds: []
|
|
197
|
-
prunedAt:
|
|
199
|
+
prunedAt: Thu, 13 Nov 2025 16:20:17 GMT
|
|
198
200
|
publicHoistPattern: []
|
|
199
201
|
registries:
|
|
200
202
|
'@jsr': https://npm.jsr.io/
|
|
@@ -17,7 +17,7 @@ overrides:
|
|
|
17
17
|
hosted-git-info@1: npm:@pnpm/hosted-git-info@1.0.0
|
|
18
18
|
http-proxy-middleware@<2.0.7: ^2.0.7
|
|
19
19
|
istanbul-reports: npm:@zkochan/istanbul-reports
|
|
20
|
-
js-yaml@^4.0.0: npm:@zkochan/js-yaml@0.0.
|
|
20
|
+
js-yaml@^4.0.0: npm:@zkochan/js-yaml@0.0.10
|
|
21
21
|
json5@<2.2.2: ^2.2.3
|
|
22
22
|
jsonwebtoken@<=8.5.1: '>=9.0.0'
|
|
23
23
|
nopt@5: npm:@pnpm/nopt@^0.2.1
|
|
@@ -26,7 +26,7 @@ overrides:
|
|
|
26
26
|
path-to-regexp@>=4.0.0 <6.3.0: '>=6.3.0'
|
|
27
27
|
path-to-regexp@>=7.0.0 <8.0.0: '>=8.0.0'
|
|
28
28
|
request: npm:postman-request@2.88.1-postman.40
|
|
29
|
-
semver@<7.5.2: ^7.7.
|
|
29
|
+
semver@<7.5.2: ^7.7.2
|
|
30
30
|
send@<0.19.0: ^0.19.0
|
|
31
31
|
serve-static@<1.16.0: ^1.16.0
|
|
32
32
|
socks@2: ^2.8.1
|
|
@@ -269,8 +269,8 @@ packages:
|
|
|
269
269
|
engines: {node: ^18.17.0 || >=20.5.0}
|
|
270
270
|
hasBin: true
|
|
271
271
|
|
|
272
|
-
p-map@7.0.
|
|
273
|
-
resolution: {integrity: sha512-
|
|
272
|
+
p-map@7.0.4:
|
|
273
|
+
resolution: {integrity: sha512-tkAQEw8ysMzmkhgw8k+1U/iPhWNhykKnSk4Rd5zLoPJCuJaGRPo6YposrZgaxHKzDHdDWWZvE/Sk7hsL2X/CpQ==}
|
|
274
274
|
engines: {node: '>=18'}
|
|
275
275
|
|
|
276
276
|
package-json-from-dist@1.0.1:
|
|
@@ -470,7 +470,7 @@ snapshots:
|
|
|
470
470
|
minipass-collect: 2.0.1
|
|
471
471
|
minipass-flush: 1.0.5
|
|
472
472
|
minipass-pipeline: 1.2.4
|
|
473
|
-
p-map: 7.0.
|
|
473
|
+
p-map: 7.0.4
|
|
474
474
|
ssri: 12.0.0
|
|
475
475
|
tar: 7.5.2
|
|
476
476
|
unique-filename: 4.0.0
|
|
@@ -691,7 +691,7 @@ snapshots:
|
|
|
691
691
|
abbrev: 3.0.1
|
|
692
692
|
optional: true
|
|
693
693
|
|
|
694
|
-
p-map@7.0.
|
|
694
|
+
p-map@7.0.4:
|
|
695
695
|
optional: true
|
|
696
696
|
|
|
697
697
|
package-json-from-dist@1.0.1:
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "yallist",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Yet Another Linked List",
|
|
5
|
+
"main": "yallist.js",
|
|
6
|
+
"directories": {
|
|
7
|
+
"test": "test"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"yallist.js",
|
|
11
|
+
"iterator.js"
|
|
12
|
+
],
|
|
13
|
+
"dependencies": {},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"tap": "^12.1.0"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "tap test/*.js --100",
|
|
19
|
+
"preversion": "npm test",
|
|
20
|
+
"postversion": "npm publish",
|
|
21
|
+
"postpublish": "git push origin --all; git push origin --tags"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/isaacs/yallist.git"
|
|
26
|
+
},
|
|
27
|
+
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
28
|
+
"license": "ISC"
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
The ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
15
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "yallist",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Yet Another Linked List",
|
|
5
|
+
"main": "yallist.js",
|
|
6
|
+
"directories": {
|
|
7
|
+
"test": "test"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"yallist.js",
|
|
11
|
+
"iterator.js"
|
|
12
|
+
],
|
|
13
|
+
"dependencies": {},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"tap": "^12.1.0"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "tap test/*.js --100",
|
|
19
|
+
"preversion": "npm test",
|
|
20
|
+
"postversion": "npm publish",
|
|
21
|
+
"postpublish": "git push origin --all; git push origin --tags"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/isaacs/yallist.git"
|
|
26
|
+
},
|
|
27
|
+
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
28
|
+
"license": "ISC"
|
|
29
|
+
}
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
module.exports = Yallist
|
|
3
|
+
|
|
4
|
+
Yallist.Node = Node
|
|
5
|
+
Yallist.create = Yallist
|
|
6
|
+
|
|
7
|
+
function Yallist (list) {
|
|
8
|
+
var self = this
|
|
9
|
+
if (!(self instanceof Yallist)) {
|
|
10
|
+
self = new Yallist()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
self.tail = null
|
|
14
|
+
self.head = null
|
|
15
|
+
self.length = 0
|
|
16
|
+
|
|
17
|
+
if (list && typeof list.forEach === 'function') {
|
|
18
|
+
list.forEach(function (item) {
|
|
19
|
+
self.push(item)
|
|
20
|
+
})
|
|
21
|
+
} else if (arguments.length > 0) {
|
|
22
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
23
|
+
self.push(arguments[i])
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return self
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
Yallist.prototype.removeNode = function (node) {
|
|
31
|
+
if (node.list !== this) {
|
|
32
|
+
throw new Error('removing node which does not belong to this list')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var next = node.next
|
|
36
|
+
var prev = node.prev
|
|
37
|
+
|
|
38
|
+
if (next) {
|
|
39
|
+
next.prev = prev
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (prev) {
|
|
43
|
+
prev.next = next
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (node === this.head) {
|
|
47
|
+
this.head = next
|
|
48
|
+
}
|
|
49
|
+
if (node === this.tail) {
|
|
50
|
+
this.tail = prev
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
node.list.length--
|
|
54
|
+
node.next = null
|
|
55
|
+
node.prev = null
|
|
56
|
+
node.list = null
|
|
57
|
+
|
|
58
|
+
return next
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Yallist.prototype.unshiftNode = function (node) {
|
|
62
|
+
if (node === this.head) {
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (node.list) {
|
|
67
|
+
node.list.removeNode(node)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
var head = this.head
|
|
71
|
+
node.list = this
|
|
72
|
+
node.next = head
|
|
73
|
+
if (head) {
|
|
74
|
+
head.prev = node
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
this.head = node
|
|
78
|
+
if (!this.tail) {
|
|
79
|
+
this.tail = node
|
|
80
|
+
}
|
|
81
|
+
this.length++
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
Yallist.prototype.pushNode = function (node) {
|
|
85
|
+
if (node === this.tail) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (node.list) {
|
|
90
|
+
node.list.removeNode(node)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
var tail = this.tail
|
|
94
|
+
node.list = this
|
|
95
|
+
node.prev = tail
|
|
96
|
+
if (tail) {
|
|
97
|
+
tail.next = node
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
this.tail = node
|
|
101
|
+
if (!this.head) {
|
|
102
|
+
this.head = node
|
|
103
|
+
}
|
|
104
|
+
this.length++
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
Yallist.prototype.push = function () {
|
|
108
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
109
|
+
push(this, arguments[i])
|
|
110
|
+
}
|
|
111
|
+
return this.length
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
Yallist.prototype.unshift = function () {
|
|
115
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
116
|
+
unshift(this, arguments[i])
|
|
117
|
+
}
|
|
118
|
+
return this.length
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
Yallist.prototype.pop = function () {
|
|
122
|
+
if (!this.tail) {
|
|
123
|
+
return undefined
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var res = this.tail.value
|
|
127
|
+
this.tail = this.tail.prev
|
|
128
|
+
if (this.tail) {
|
|
129
|
+
this.tail.next = null
|
|
130
|
+
} else {
|
|
131
|
+
this.head = null
|
|
132
|
+
}
|
|
133
|
+
this.length--
|
|
134
|
+
return res
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
Yallist.prototype.shift = function () {
|
|
138
|
+
if (!this.head) {
|
|
139
|
+
return undefined
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var res = this.head.value
|
|
143
|
+
this.head = this.head.next
|
|
144
|
+
if (this.head) {
|
|
145
|
+
this.head.prev = null
|
|
146
|
+
} else {
|
|
147
|
+
this.tail = null
|
|
148
|
+
}
|
|
149
|
+
this.length--
|
|
150
|
+
return res
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
Yallist.prototype.forEach = function (fn, thisp) {
|
|
154
|
+
thisp = thisp || this
|
|
155
|
+
for (var walker = this.head, i = 0; walker !== null; i++) {
|
|
156
|
+
fn.call(thisp, walker.value, i, this)
|
|
157
|
+
walker = walker.next
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
Yallist.prototype.forEachReverse = function (fn, thisp) {
|
|
162
|
+
thisp = thisp || this
|
|
163
|
+
for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
|
|
164
|
+
fn.call(thisp, walker.value, i, this)
|
|
165
|
+
walker = walker.prev
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
Yallist.prototype.get = function (n) {
|
|
170
|
+
for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
|
|
171
|
+
// abort out of the list early if we hit a cycle
|
|
172
|
+
walker = walker.next
|
|
173
|
+
}
|
|
174
|
+
if (i === n && walker !== null) {
|
|
175
|
+
return walker.value
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
Yallist.prototype.getReverse = function (n) {
|
|
180
|
+
for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
|
|
181
|
+
// abort out of the list early if we hit a cycle
|
|
182
|
+
walker = walker.prev
|
|
183
|
+
}
|
|
184
|
+
if (i === n && walker !== null) {
|
|
185
|
+
return walker.value
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
Yallist.prototype.map = function (fn, thisp) {
|
|
190
|
+
thisp = thisp || this
|
|
191
|
+
var res = new Yallist()
|
|
192
|
+
for (var walker = this.head; walker !== null;) {
|
|
193
|
+
res.push(fn.call(thisp, walker.value, this))
|
|
194
|
+
walker = walker.next
|
|
195
|
+
}
|
|
196
|
+
return res
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
Yallist.prototype.mapReverse = function (fn, thisp) {
|
|
200
|
+
thisp = thisp || this
|
|
201
|
+
var res = new Yallist()
|
|
202
|
+
for (var walker = this.tail; walker !== null;) {
|
|
203
|
+
res.push(fn.call(thisp, walker.value, this))
|
|
204
|
+
walker = walker.prev
|
|
205
|
+
}
|
|
206
|
+
return res
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
Yallist.prototype.reduce = function (fn, initial) {
|
|
210
|
+
var acc
|
|
211
|
+
var walker = this.head
|
|
212
|
+
if (arguments.length > 1) {
|
|
213
|
+
acc = initial
|
|
214
|
+
} else if (this.head) {
|
|
215
|
+
walker = this.head.next
|
|
216
|
+
acc = this.head.value
|
|
217
|
+
} else {
|
|
218
|
+
throw new TypeError('Reduce of empty list with no initial value')
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
for (var i = 0; walker !== null; i++) {
|
|
222
|
+
acc = fn(acc, walker.value, i)
|
|
223
|
+
walker = walker.next
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return acc
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
Yallist.prototype.reduceReverse = function (fn, initial) {
|
|
230
|
+
var acc
|
|
231
|
+
var walker = this.tail
|
|
232
|
+
if (arguments.length > 1) {
|
|
233
|
+
acc = initial
|
|
234
|
+
} else if (this.tail) {
|
|
235
|
+
walker = this.tail.prev
|
|
236
|
+
acc = this.tail.value
|
|
237
|
+
} else {
|
|
238
|
+
throw new TypeError('Reduce of empty list with no initial value')
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
for (var i = this.length - 1; walker !== null; i--) {
|
|
242
|
+
acc = fn(acc, walker.value, i)
|
|
243
|
+
walker = walker.prev
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return acc
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
Yallist.prototype.toArray = function () {
|
|
250
|
+
var arr = new Array(this.length)
|
|
251
|
+
for (var i = 0, walker = this.head; walker !== null; i++) {
|
|
252
|
+
arr[i] = walker.value
|
|
253
|
+
walker = walker.next
|
|
254
|
+
}
|
|
255
|
+
return arr
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
Yallist.prototype.toArrayReverse = function () {
|
|
259
|
+
var arr = new Array(this.length)
|
|
260
|
+
for (var i = 0, walker = this.tail; walker !== null; i++) {
|
|
261
|
+
arr[i] = walker.value
|
|
262
|
+
walker = walker.prev
|
|
263
|
+
}
|
|
264
|
+
return arr
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
Yallist.prototype.slice = function (from, to) {
|
|
268
|
+
to = to || this.length
|
|
269
|
+
if (to < 0) {
|
|
270
|
+
to += this.length
|
|
271
|
+
}
|
|
272
|
+
from = from || 0
|
|
273
|
+
if (from < 0) {
|
|
274
|
+
from += this.length
|
|
275
|
+
}
|
|
276
|
+
var ret = new Yallist()
|
|
277
|
+
if (to < from || to < 0) {
|
|
278
|
+
return ret
|
|
279
|
+
}
|
|
280
|
+
if (from < 0) {
|
|
281
|
+
from = 0
|
|
282
|
+
}
|
|
283
|
+
if (to > this.length) {
|
|
284
|
+
to = this.length
|
|
285
|
+
}
|
|
286
|
+
for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
|
|
287
|
+
walker = walker.next
|
|
288
|
+
}
|
|
289
|
+
for (; walker !== null && i < to; i++, walker = walker.next) {
|
|
290
|
+
ret.push(walker.value)
|
|
291
|
+
}
|
|
292
|
+
return ret
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
Yallist.prototype.sliceReverse = function (from, to) {
|
|
296
|
+
to = to || this.length
|
|
297
|
+
if (to < 0) {
|
|
298
|
+
to += this.length
|
|
299
|
+
}
|
|
300
|
+
from = from || 0
|
|
301
|
+
if (from < 0) {
|
|
302
|
+
from += this.length
|
|
303
|
+
}
|
|
304
|
+
var ret = new Yallist()
|
|
305
|
+
if (to < from || to < 0) {
|
|
306
|
+
return ret
|
|
307
|
+
}
|
|
308
|
+
if (from < 0) {
|
|
309
|
+
from = 0
|
|
310
|
+
}
|
|
311
|
+
if (to > this.length) {
|
|
312
|
+
to = this.length
|
|
313
|
+
}
|
|
314
|
+
for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
|
|
315
|
+
walker = walker.prev
|
|
316
|
+
}
|
|
317
|
+
for (; walker !== null && i > from; i--, walker = walker.prev) {
|
|
318
|
+
ret.push(walker.value)
|
|
319
|
+
}
|
|
320
|
+
return ret
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
|
|
324
|
+
if (start > this.length) {
|
|
325
|
+
start = this.length - 1
|
|
326
|
+
}
|
|
327
|
+
if (start < 0) {
|
|
328
|
+
start = this.length + start;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
|
|
332
|
+
walker = walker.next
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
var ret = []
|
|
336
|
+
for (var i = 0; walker && i < deleteCount; i++) {
|
|
337
|
+
ret.push(walker.value)
|
|
338
|
+
walker = this.removeNode(walker)
|
|
339
|
+
}
|
|
340
|
+
if (walker === null) {
|
|
341
|
+
walker = this.tail
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (walker !== this.head && walker !== this.tail) {
|
|
345
|
+
walker = walker.prev
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
349
|
+
walker = insert(this, walker, nodes[i])
|
|
350
|
+
}
|
|
351
|
+
return ret;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
Yallist.prototype.reverse = function () {
|
|
355
|
+
var head = this.head
|
|
356
|
+
var tail = this.tail
|
|
357
|
+
for (var walker = head; walker !== null; walker = walker.prev) {
|
|
358
|
+
var p = walker.prev
|
|
359
|
+
walker.prev = walker.next
|
|
360
|
+
walker.next = p
|
|
361
|
+
}
|
|
362
|
+
this.head = tail
|
|
363
|
+
this.tail = head
|
|
364
|
+
return this
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function insert (self, node, value) {
|
|
368
|
+
var inserted = node === self.head ?
|
|
369
|
+
new Node(value, null, node, self) :
|
|
370
|
+
new Node(value, node, node.next, self)
|
|
371
|
+
|
|
372
|
+
if (inserted.next === null) {
|
|
373
|
+
self.tail = inserted
|
|
374
|
+
}
|
|
375
|
+
if (inserted.prev === null) {
|
|
376
|
+
self.head = inserted
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
self.length++
|
|
380
|
+
|
|
381
|
+
return inserted
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function push (self, item) {
|
|
385
|
+
self.tail = new Node(item, self.tail, null, self)
|
|
386
|
+
if (!self.head) {
|
|
387
|
+
self.head = self.tail
|
|
388
|
+
}
|
|
389
|
+
self.length++
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function unshift (self, item) {
|
|
393
|
+
self.head = new Node(item, null, self.head, self)
|
|
394
|
+
if (!self.tail) {
|
|
395
|
+
self.tail = self.head
|
|
396
|
+
}
|
|
397
|
+
self.length++
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function Node (value, prev, next, list) {
|
|
401
|
+
if (!(this instanceof Node)) {
|
|
402
|
+
return new Node(value, prev, next, list)
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
this.list = list
|
|
406
|
+
this.value = value
|
|
407
|
+
|
|
408
|
+
if (prev) {
|
|
409
|
+
prev.next = this
|
|
410
|
+
this.prev = prev
|
|
411
|
+
} else {
|
|
412
|
+
this.prev = null
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (next) {
|
|
416
|
+
next.prev = this
|
|
417
|
+
this.next = next
|
|
418
|
+
} else {
|
|
419
|
+
this.next = null
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
try {
|
|
424
|
+
// add if support for Symbol.iterator is present
|
|
425
|
+
require('./iterator.js')(Yallist)
|
|
426
|
+
} catch (er) {}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
The ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
15
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|